zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Testing: reporting

Open Koenkk opened this issue 7 years ago • 106 comments

Reporting is a new feature which is currently only available in the dev branch. When reporting is enabled, the device will report their state changes to zigbee2mqtt. This is especially handy when the state of a bulb is changed by e.g. a remote or via groups.

To enable report, add the following to your configuration.yaml:

advanced:
  report: true

As reporting is a feature of the device, not all devices may support this.

Current findings

  • IKEA TRADFRI bulbs work as expected
  • Hue bulbs only report on/off state (limitation of Hue bulbs) (https://github.com/Koenkk/zigbee2mqtt/issues/1064#issuecomment-468962505)

Koenkk avatar Feb 10 '19 18:02 Koenkk

Hi!

Gledopto GL-B-007Z:

Changing color temperature triggers this (along with actual ct of the bulb changing):

zigbee2mqtt:error 2019-2-10 22:06:26 No converter available for 'color_temp' (166)

Changing brightness doesn't trigger anything in the logs (but the brightness of the physical bulb actually changes, HA still thinks the brightness is unchanged).

milakov avatar Feb 10 '19 19:02 milakov

@milakov should be fixed in the latest dev branch, if not, please open a separate issue as this is not related to this issue.

Koenkk avatar Feb 10 '19 19:02 Koenkk

Just tried with a group of two Hue bulbs. Changing the state (ON or OFF) of the group does not report the individual change of state of each bulb. Logs in debug mode are here.

sylvarg avatar Feb 10 '19 20:02 sylvarg

I tried to activate reporting for a Philips and a Ikea bulb. But when I control the bulbs with a bound Philips dimmer switch the status changes are not reported. Here is the log for the Ikea bulb:

2019-2-10 22:58:08 - debug: Setup reporting for 0x000d6ffffe1df5f5 - genOnOff - onOff 2019-2-10 22:58:09 - debug: Setup reporting for 0x000d6ffffe1df5f5 - genLevelCtrl - currentLevel 2019-2-10 22:58:09 - debug: Successfully setup reporting for 0x000d6ffffe1df5f5 - genOnOff - onOff 2019-2-10 22:58:09 - debug: Successfully setup reporting for 0x000d6ffffe1df5f5 - genLevelCtrl - currentLevel 2019-2-10 22:58:09 - debug: Setup reporting for 0x000d6ffffe1df5f5 - lightingColorCtrl - currentX 2019-2-10 22:58:09 - debug: Successfully setup reporting for 0x000d6ffffe1df5f5 - lightingColorCtrl - currentX 2019-2-10 22:58:09 - debug: Setup reporting for 0x000d6ffffe1df5f5 - lightingColorCtrl - currentY 2019-2-10 22:58:09 - debug: Successfully setup reporting for 0x000d6ffffe1df5f5 - lightingColorCtrl - currentY

JumpmanJunior avatar Feb 10 '19 22:02 JumpmanJunior

I tested reporting of two Tradfri GU10 in my hallway this morning. I switched them off with the wire switch (220V) and put them back on. This is the log:

2/12/2019, 6:19:55 AM - debug: Saving state to file /app/data/state.json 2/12/2019, 6:21:53 AM - debug: Received zigbee message of type 'endDeviceAnnce' with data '"0x90fd9ffffe1a7413"' of device 'TRADFRI bulb GU10 W 400lm' (0x90fd9ffffe1a7413) 2/12/2019, 6:21:53 AM - debug: Setup reporting for 0x90fd9ffffe1a7413 - genOnOff - onOff 2/12/2019, 6:21:53 AM - debug: Received zigbee message of type 'endDeviceAnnce' with data '"0x90fd9ffffe2a3f57"' of device 'TRADFRI bulb GU10 W 400lm' (0x90fd9ffffe2a3f57) 2/12/2019, 6:21:54 AM - debug: Setup reporting for 0x90fd9ffffe1a7413 - genLevelCtrl - currentLevel 2/12/2019, 6:21:54 AM - debug: Successfully setup reporting for 0x90fd9ffffe1a7413 - genOnOff - onOff 2/12/2019, 6:21:54 AM - debug: Successfully setup reporting for 0x90fd9ffffe1a7413 - genLevelCtrl - currentLevel 2/12/2019, 6:21:54 AM - debug: Setup reporting for 0x90fd9ffffe2a3f57 - genOnOff - onOff 2/12/2019, 6:21:54 AM - debug: Successfully setup reporting for 0x90fd9ffffe2a3f57 - genOnOff - onOff 2/12/2019, 6:21:54 AM - debug: Setup reporting for 0x90fd9ffffe2a3f57 - genLevelCtrl - currentLevel 2/12/2019, 6:21:54 AM - debug: Successfully setup reporting for 0x90fd9ffffe2a3f57 - genLevelCtrl - currentLevel 2/12/2019, 6:21:55 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe1a7413"' 2/12/2019, 6:21:56 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe1a7413"' 2/12/2019, 6:21:56 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe1a7413"' 2/12/2019, 6:21:57 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe1a7413"' 2/12/2019, 6:21:57 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe1a7413"' 2/12/2019, 6:21:58 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe1a7413"' 2/12/2019, 6:21:58 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe1a7413"' 2/12/2019, 6:21:58 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe1a7413"' 2/12/2019, 6:21:59 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe1a7413"' 2/12/2019, 6:21:59 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe1a7413"' 2/12/2019, 6:21:59 AM - debug: Received zigbee message of type 'devIncoming' with data '"0x90fd9ffffe1a7413"' of device 'TRADFRI bulb GU10 W 400lm' (0x90fd9ffffe1a7413) 2/12/2019, 6:21:59 AM - info: Device incoming... 2/12/2019, 6:21:59 AM - info: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"pairing","message":"device incoming"}' 2/12/2019, 6:21:59 AM - debug: Received zigbee message of type 'devStatus' with data '"online"' of device 'TRADFRI bulb GU10 W 400lm' (0x90fd9ffffe1a7413) 2/12/2019, 6:22:01 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe2a3f57"' 2/12/2019, 6:22:01 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe2a3f57"' 2/12/2019, 6:22:01 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe2a3f57"' 2/12/2019, 6:22:02 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe2a3f57"' 2/12/2019, 6:22:02 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe2a3f57"' 2/12/2019, 6:22:03 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe2a3f57"' 2/12/2019, 6:22:03 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe2a3f57"' 2/12/2019, 6:22:03 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe2a3f57"' 2/12/2019, 6:22:04 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe2a3f57"' 2/12/2019, 6:22:04 AM - debug: Received zigbee message of type 'devInterview' with data '"0x90fd9ffffe2a3f57"' 2/12/2019, 6:22:04 AM - debug: Received zigbee message of type 'devIncoming' with data '"0x90fd9ffffe2a3f57"' of device 'TRADFRI bulb GU10 W 400lm' (0x90fd9ffffe2a3f57) 2/12/2019, 6:22:04 AM - info: Device incoming... 2/12/2019, 6:22:04 AM - info: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"pairing","message":"device incoming"}' 2/12/2019, 6:22:04 AM - debug: Received zigbee message of type 'devStatus' with data '"online"' of device 'TRADFRI bulb GU10 W 400lm' (0x90fd9ffffe2a3f57) 2/12/2019, 6:24:55 AM - debug: Saving state to file /app/data/state.json

I have now multiple questions:

  • What is "endDeviceAnnce" and why did the bulb publish this?
  • Am I correct to interpreting this as when physically switched off, the bulb lose it's reporting function (if it has one)?
  • Am I also correct that when physically switched off, the bulb re-pair itself ?

As I'm unable to bind my Hue Dimmer Switch to my Hue suspension Fair I cannot test the reporting function on those one.

way2many avatar Feb 12 '19 08:02 way2many

I am also trying to achieve the same. I have a TRADFRI remote and TRADFRI driver paired to zigbee2mqtt. I have found out the group ID of the remote by sniffing. Then I have created a group with this ID and added the TRADFRI driver to this group. I can successfully control the driver with the remote and z2m.

The reporting configuration seems to have worked:

  zigbee2mqtt:debug 2/13/2019, 1:45:38 PM Setup reporting for 0x000d6ffffe2cxxxx - genOnOff - onOff
  zigbee2mqtt:debug 2/13/2019, 1:45:38 PM Successfully setup reporting for 0x000d6ffffe2cxxxx - genOnOff - onOff
  zigbee2mqtt:debug 2/13/2019, 1:45:38 PM Setup reporting for 0x000d6ffffe2cxxxx - genLevelCtrl - currentLevel
  zigbee2mqtt:debug 2/13/2019, 1:45:38 PM Successfully setup reporting for 0x000d6ffffe2cxxxx - genLevelCtrl - currentLevel

However, I do not get any reports in z2m if it is controlled by the remote.

nanosonde avatar Feb 13 '19 13:02 nanosonde

I am not seeing any attribute reports with the sniffer either. So is it the report configuration which did not work properly although it claims success?

nanosonde avatar Feb 13 '19 13:02 nanosonde

From the ZCL Configure Reporting Message I see that there is a min interval of 1 and a max interval of 3600. 3600s would be 1h. So how does the device choose which to use? Is it possible to lower the value to 10s and see what happens?

Of course I would expect that it immediately sends a changed state, but I do not how this reporting is meant to work in detail.

nanosonde avatar Feb 13 '19 13:02 nanosonde

@nanosonde just change https://github.com/Koenkk/zigbee2mqtt/blob/dev/lib/extension/reporting.js#L12 to 10 .

Koenkk avatar Feb 13 '19 13:02 Koenkk

@Koenkk I have changed it to 10s and verified with the sniffer that this is sent over the wire. Unfortunately, it does not work too.

nanosonde avatar Feb 13 '19 14:02 nanosonde

@Koenkk Somewhere in the deconz-plugin issues I have read that reporting for a TRADFRI device(?) only worked when it is read back. I am not absolutely sure anymore.

nanosonde avatar Feb 13 '19 14:02 nanosonde

Got it working. I have disabled the generic reporting setup using "report: true". Instead I have changed device.js for the 10W dimmer similiar to the TRADFRI power outlet.

    {
        zigbeeModel: ['TRADFRI transformer 10W', 'TRADFRI Driver 10W'],
        model: 'ICPSHC24-10EU-IL-1',
        vendor: 'IKEA',
        description: 'TRADFRI driver for wireless control (10 watt)',
        //extend: generic.light_onoff_brightness,
        fromZigbee: [fz.ignore_onoff_change, fz.state],
        toZigbee: [tz.on_off],
        configure: (ieeeAddr, shepherd, coordinator, callback) => {
            const device = shepherd.find(ieeeAddr, 1);
            const cfg = {direction: 0, attrId: 0, dataType: 16, minRepIntval: 0, maxRepIntval: 1000, repChange: 0};
            const actions = [
                (cb) => device.bind('genOnOff', coordinator, cb),
                (cb) => device.foundation('genOnOff', 'configReport', [cfg], foundationCfg, cb),
            ];

            execute(device, actions, callback);
        },
    },

This way the driver immediately reports state changes.

nanosonde avatar Feb 13 '19 15:02 nanosonde

@Koenkk Maybe I am missing something, but is the binding to the coordinator missing if reports are enabled using the generic mechansim? Or is this only required for TRADFRI devices?

https://github.com/Koenkk/zigbee2mqtt/blob/c9c599b60b709d897eb12286cdd57eb5214f0eb1/lib/extension/reporting.js#L43

There is no binding to the coordinator happening as it is done as show in my previous comment.

nanosonde avatar Feb 13 '19 16:02 nanosonde

BTW: It looks like this with the above code change:

  zigbee2mqtt:debug 2/13/2019, 7:10:02 PM Received zigbee message of type 'cmdToggle' with data '{"cid":"genOnOff","data":{}}' of device 'TRADFRI remote control' (0xd0cf5efffe0bxxxx)
  zigbee2mqtt:info 2/13/2019, 7:10:02 PM MQTT publish: topic 'zigbee2mqtt/ikea_remotecontrol', payload '{"action":"toggle","linkquality":10,"last_seen":"2019-02-13T19:10:02.922Z","elapsed":5628497}'
  zigbee2mqtt:debug 2/13/2019, 7:10:02 PM Received zigbee message of type 'attReport' with data '{"cid":"genOnOff","data":{"onOff":1}}' of device 'TRADFRI transformer 10W' (0x000d6ffffe2cyyyy)
  zigbee2mqtt:info 2/13/2019, 7:10:02 PM MQTT publish: topic 'zigbee2mqtt/ikea_driver', payload '{"state":"ON","last_seen":"2019-02-13T19:10:02.955Z","linkquality":7,"elapsed":628194}'

nanosonde avatar Feb 13 '19 19:02 nanosonde

@nanosonde I've also added the binding, meaning it should be the same as your custom configure now. Can you factory reset/re-pair the device and verify that it works with report: true?

Koenkk avatar Feb 13 '19 19:02 Koenkk

@Koenkk I have tested latest dev and seems to be working now as with the custom configure. As I did a complete ./update.sh I experience an error now concerning the remote control:

  zigbee2mqtt:debug 2/13/2019, 8:42:05 PM Coordinator is already in group '611'
  zigbee2mqtt:error 2/13/2019, 8:42:05 PM Failed to apply coordinator group for IKEA TRADFRI remote control (0xd0cf5efffe0bxxxx)
  zigbee2mqtt:debug 2/13/2019, 8:42:05 PM Coordinator is already in group '99'

Did you change anything here? This was working before. Group ID 611 is correct. Why is the coordinator already in group 611? Is it from my testgroup under "groups" in the configuration with the same ID to which I have added my tradfri driver?

If I remove "coordinator_group" from the device config then this error is gone and I also receive the reports from button pushes.

BTW: Neither the driver nor the remote control need to be put close to the coordinator to pair them. The remote control just needs the 4-button-press sequence for factory reset which also restarts pairing (without touchlink). The driver just needs a short press with a paperclip to factory reset and restart pairing.

nanosonde avatar Feb 13 '19 20:02 nanosonde

@Koenkk I have tested latest dev and seems to be working now as with the custom configure. As I did a complete ./update.sh I experience an error now concerning the remote control:

  zigbee2mqtt:debug 2/13/2019, 8:42:05 PM Coordinator is already in group '611'
  zigbee2mqtt:error 2/13/2019, 8:42:05 PM Failed to apply coordinator group for IKEA TRADFRI remote control (0xd0cf5efffe0bxxxx)
  zigbee2mqtt:debug 2/13/2019, 8:42:05 PM Coordinator is already in group '99'

Ok, I will answer that by myself after studying the code. So actually this is NOT a failure, but it is just as the previous message tells it: the ZDO of the coordinator already has the group added. So this is a bit misleading and not a real failure.

nanosonde avatar Feb 14 '19 15:02 nanosonde

@nanosonde you are right, fixed.

Koenkk avatar Feb 14 '19 18:02 Koenkk

Groups will now also report their state (on zigbee2mqtt/[GROUP_FRIENDLY_NAME). (dev branch)

Koenkk avatar Feb 14 '19 19:02 Koenkk

  zigbee2mqtt:error 2019-2-15 10:15:42 Failed to setup reporting for 0x84182600000b8298 - lightingColorCtrl - currentX - (Error: AF data request fails, status code: 233. MAC no ack.)
  zigbee2mqtt:error 2019-2-15 10:15:44 Failed to setup reporting for 0x84182600000b79b7 - genLevelCtrl - currentLevel - (Error: AF data request fails, status code: 233. MAC no ack.)
  zigbee2mqtt:warn 2019-2-15 10:15:45 Failed to configure Motion (0x000d6f000e059aae) ('Error: AF data request fails, status code: 240. MAC transaction expired.') (attempt #1)
  zigbee2mqtt:warn 2019-2-15 10:15:45 This can be ignored if the device is working properly
  zigbee2mqtt:error 2019-2-15 10:15:45 Failed to setup reporting for 0x7cb03eaa00a1184a - lightingColorCtrl - currentX - (Error: AF data request fails, status code: 233. MAC no ack.)
  zigbee2mqtt:error 2019-2-15 10:15:46 Failed to setup reporting for 0x84182600000b743a - genOnOff - onOff - (Error: AF data request fails, status code: 205. No network route. Please confirm that the device has (re)joined the network.)
  zigbee2mqtt:error 2019-2-15 10:15:47 Failed to setup reporting for 0x84182600000b743a - lightingColorCtrl - colorTemperature - (Error: AF data request fails, status code: 205. No network route. Please confirm that the device has (re)joined the network.)
  zigbee2mqtt:error 2019-2-15 10:15:47 Failed to setup reporting for 0x84182600000b743a - genLevelCtrl - currentLevel - (Error: AF data request fails, status code: 205. No network route. Please confirm that the device has (re)joined the network.)
  zigbee2mqtt:error 2019-2-15 10:15:47 Failed to setup reporting for 0x84182600000b83ef - genOnOff - onOff - (Error: AF data request fails, status code: 233. MAC no ack.)
  zigbee2mqtt:error 2019-2-15 10:15:47 Failed to setup reporting for 0x84182600000b83ef - genLevelCtrl - currentLevel - (Error: AF data request fails, status code: 233. MAC no ack.)
  zigbee2mqtt:error 2019-2-15 10:15:47 Failed to setup reporting for 0x84182600000b743a - lightingColorCtrl - currentY - (Error: AF data request fails, status code: 205. No network route. Please confirm that the device has (re)joined the network.)
  zigbee2mqtt:error 2019-2-15 10:15:47 Failed to setup reporting for 0x84182600000b743a - lightingColorCtrl - currentX - (Error: AF data request fails, status code: 205. No network route. Please confirm that the device has (re)joined the network.)
  zigbee2mqtt:error 2019-2-15 10:15:48 Failed to setup reporting for 0x8418260000ca9270 - lightingColorCtrl - currentY - (Error: AF data request fails, status code: 233. MAC no ack.)
  zigbee2mqtt:error 2019-2-15 10:15:50 Failed to setup reporting for 0x7cb03eaa00a1184a - genLevelCtrl - currentLevel - (Error: AF data request fails, status code: 205. No network route. Please confirm that the device has (re)joined the network.)

I added reporting to all my bulbs, in a group or not. Reporting does not work, but on startup you see this after it reconnected to all Zigbee devices. Do I have to repair all my bulbs to make it work?

EDIT: Debug loglevel: https://h.kremowka.xyz/etayakilox.coffeescript

dreimer1986 avatar Feb 15 '19 19:02 dreimer1986