luar123 / zigbee_esphome

External zigbee component
68 stars 6 forks source link

Zigbee attribute reporting #5

Open luar123 opened 3 months ago

luar123 commented 3 months ago

This came up in #4:

But I found an issue where the delay in sensor data reporting is very high, and it can take from one minute to a few minutes to wait. It can be reported normally in your esphome_zb_sensor project.

There are multiple ways of attribute reporting available:

  1. you can issue a report command, to report the attribute value immediately. This is done with zigbee.report for all attributes that are written with zigbee.setAttr
  2. you can configure reporting based on value change or time interval. This is activated by setting report: true for an attribute with setting: min_interval = 10, max_interval = 0, delta = 0 -> report on every attribute change, but no periodic reporting. This setting is hardcoded at the moment, but can be overwritten by the coordinator (e.g. zigbee2mqtt)

esphome_zb_sensor uses the brute-force method: Whenever the attribute is set, a report command is issued. If you want to replicate this (I won't recommend) run zigbee.report after zigbee.setAttr.

Important: If you use z2m with the default settings and either no custom configuration for your device or using the modern extend functions, reporting settings might get overwritten. E.g. for temperature it is set to an interval between 10s and 1h and a difference of 1°C: https://github.com/Koenkk/zigbee-herdsman-converters/blob/41b26f2025b0627f984ccf0da65ca4051bd404f0/src/lib/modernExtend.ts#L561 You can always change these settings through the web frontend.

papylhomme commented 1 week ago

Hello, I stumbled onto this issue before opening a new one. For me reporting doesn't seem to work at all, I even added an interval to call the zigbee.report action with no luck. I'm using HA with ZHA (coordinator is a SLZB-06M).

The clusters are configured with report: true, and the interval component is as follow (I can see the execution in the logs)

interval:
  - interval: 1min
    then:
      - logger.log: "Zigbee Report !"
      - zigbee.report: zb

For each report call, there is a Zigbee warning/error from 30s to 1m later : [15:19:21][I][zigbee:193][Zigbee_main]: ZDO signal: ZDO Device Unavailable (0x3c), status: ESP_OK

However I can successfully read the attributes directly by issuing a command from HA. image

Any idea how I can investigate this further ?