zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Bug with Legrand 067774 device since 1.33.1

Open Loic691 opened this issue 3 years ago • 15 comments

What happened?

Since Z2M 1.33.1, the double gang Legrand button send several times zigbee message when cliking on button. So Z2M send several times the GenOnOff toggle message and the action behind Z2M is the light switch on/off several times... This problem is not present after Z2M reboot since several minutes. I try to update firmware of the dongle with latest one but the problem is always here. This bug appears after updating Z2M from 1.33.0 to 1.33.1. The 1.33.2 version did not solve this issue. Version on the legrand 067774 device : 003c

The problem is not present on single Legrand 067646 button

What did you expect to happen?

One zigbee message when one click on the button as in the 1.33.0 version of Z2M

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

1.33.2

Adapter firmware version

7.3.1.0 build 176

Adapter

ZB Dongle E Sonoff

Debug log

Here's the log for just one click on the button

Debug 2023-11-24 09:31:06Received Zigbee message from 'btn_double_cuisine', type 'commandToggle', cluster 'genOnOff', data '{}' from endpoint 2 with groupID 0
Debug 2023-11-24 09:31:08Received Zigbee message from 'btn_double_cuisine', type 'commandToggle', cluster 'genOnOff', data '{}' from endpoint 2 with groupID 0
Debug 2023-11-24 09:31:12Received Zigbee message from 'btn_double_cuisine', type 'commandToggle', cluster 'genOnOff', data '{}' from endpoint 2 with groupID 0
Debug 2023-11-24 09:31:18Received Zigbee message from 'btn_double_cuisine', type 'commandToggle', cluster 'genOnOff', data '{}' from endpoint 2 with groupID 0

Loic691 avatar Nov 24 '23 08:11 Loic691

I see the same behavior. It only happens after the device was sleeping for a while.

Legrand 067774 with the latest firmware.

The device had been asleep for 50 minutes. Then I pressed the button once. Two toggle_right actions were generated.

Full logs:

debug 2023-12-01 21:13:14: Received Zigbee message from 'Wohnzimmer Doppelschalter', type 'raw', cluster 'manuSpecificUbisysDimmerSetup', data '{"data":[21,33,16,0,9,232,229,131,0,0,116,4,0,1],"type":"Buffer"}' from endpoint 1 with groupID 0
debug 2023-12-01 21:13:14: Received Zigbee message from 'Wohnzimmer Doppelschalter', type 'raw', cluster 'manuSpecificUbisysDimmerSetup', data '{"data":[21,33,16,1,9,232,229,131,0,0,116,4,0,2],"type":"Buffer"}' from endpoint 1 with groupID 0
debug 2023-12-01 21:13:14: Received Zigbee message from 'Wohnzimmer Doppelschalter', type 'commandToggle', cluster 'genOnOff', data '{}' from endpoint 2 with groupID 0
info  2023-12-01 21:13:14: MQTT publish: topic 'zigbee2mqtt/Wohnzimmer Doppelschalter', payload '{"action":"toggle_right","battery":80,"led_when_off":"ON","led_when_on":"ON","linkquality":171,"update":{"installed_version":2376195,"latest_version":2376195,"state":"idle"},"update_available":null,"voltage":2900}'
info  2023-12-01 21:13:14: MQTT publish: topic 'zigbee2mqtt/Wohnzimmer Doppelschalter', payload '{"action":"","battery":80,"led_when_off":"ON","led_when_on":"ON","linkquality":171,"update":{"installed_version":2376195,"latest_version":2376195,"state":"idle"},"update_available":null,"voltage":2900}'
info  2023-12-01 21:13:14: MQTT publish: topic 'zigbee2mqtt/Wohnzimmer Doppelschalter/action', payload 'toggle_right'
debug 2023-12-01 21:13:14: Device 'Wohnzimmer Doppelschalter' announced itself
info  2023-12-01 21:13:14: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"Wohnzimmer Doppelschalter","ieee_address":"0x000474000083e5e8"},"type":"device_announce"}'
debug 2023-12-01 21:13:15: Received Zigbee message from 'Wohnzimmer Doppelschalter', type 'readResponse', cluster 'genPowerCfg', data '{"batteryVoltage":29}' from endpoint 1 with groupID 0
info  2023-12-01 21:13:15: MQTT publish: topic 'zigbee2mqtt/Wohnzimmer Doppelschalter', payload '{"action":null,"battery":80,"led_when_off":"ON","led_when_on":"ON","linkquality":171,"update":{"installed_version":2376195,"latest_version":2376195,"state":"idle"},"update_available":null,"voltage":2900}'
debug 2023-12-01 21:13:16: Received Zigbee message from 'Wohnzimmer Doppelschalter', type 'commandToggle', cluster 'genOnOff', data '{}' from endpoint 2 with groupID 0
info  2023-12-01 21:13:16: MQTT publish: topic 'zigbee2mqtt/Wohnzimmer Doppelschalter', payload '{"action":"toggle_right","battery":80,"led_when_off":"ON","led_when_on":"ON","linkquality":171,"update":{"installed_version":2376195,"latest_version":2376195,"state":"idle"},"update_available":null,"voltage":2900}'
info  2023-12-01 21:13:16: MQTT publish: topic 'zigbee2mqtt/Wohnzimmer Doppelschalter', payload '{"action":"","battery":80,"led_when_off":"ON","led_when_on":"ON","linkquality":171,"update":{"installed_version":2376195,"latest_version":2376195,"state":"idle"},"update_available":null,"voltage":2900}'
info  2023-12-01 21:13:16: MQTT publish: topic 'zigbee2mqtt/Wohnzimmer Doppelschalter/action', payload 'toggle_right'
debug 2023-12-01 21:13:16: Retrieving state of 'Wohnzimmer Doppelschalter' after reconnect
debug 2023-12-01 21:13:17: Received Zigbee message from 'Wohnzimmer Doppelschalter', type 'readResponse', cluster 'genPowerCfg', data '{"batteryVoltage":29}' from endpoint 1 with groupID 0
info  2023-12-01 21:13:17: MQTT publish: topic 'zigbee2mqtt/Wohnzimmer Doppelschalter', payload '{"action":null,"battery":80,"led_when_off":"ON","led_when_on":"ON","linkquality":171,"update":{"installed_version":2376195,"latest_version":2376195,"state":"idle"},"update_available":null,"voltage":2900}'
debug 2023-12-01 21:13:19: Received Zigbee message from 'Wohnzimmer Doppelschalter', type 'commandToggle', cluster 'genOnOff', data '{}' from endpoint 2 with groupID 0
info  2023-12-01 21:13:19: MQTT publish: topic 'zigbee2mqtt/Wohnzimmer Doppelschalter', payload '{"action":"toggle_right","battery":80,"led_when_off":"ON","led_when_on":"ON","linkquality":174,"update":{"installed_version":2376195,"latest_version":2376195,"state":"idle"},"update_available":null,"voltage":2900}'
info  2023-12-01 21:13:19: MQTT publish: topic 'zigbee2mqtt/Wohnzimmer Doppelschalter', payload '{"action":"","battery":80,"led_when_off":"ON","led_when_on":"ON","linkquality":174,"update":{"installed_version":2376195,"latest_version":2376195,"state":"idle"},"update_available":null,"voltage":2900}'
info  2023-12-01 21:13:19: MQTT publish: topic 'zigbee2mqtt/Wohnzimmer Doppelschalter/action', payload 'toggle_right'

tkintscher avatar Dec 01 '23 21:12 tkintscher

I remember that there was an opposite issue last year: https://github.com/Koenkk/zigbee2mqtt/issues/14256

I will give it a try with publishDuplicateTransaction: false...

tkintscher avatar Dec 01 '23 21:12 tkintscher

I did some investigating with zigbee-herdsman debugging enabled.

When pressing the button after the device was asleep, this is received:

2023-12-02T12:50:24.208Z zigbee-herdsman:adapter:zStack:znp:AREQ <-- AF - incomingMsg - {"groupid":0,"clusterid":6,"srcaddr":5047,"srcendpoint":1,"dstendpoint":1,"wasbroadcast":0,"linkquality":105,"securityuse":0,"timestamp":1221642,"transseqnumber":0,"len":3,"data":{"type":"Buffer","data":[17,2,2]}}
2023-12-02T12:50:24.208Z zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":1,"manufacturerSpecific":false,"direction":0,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":2,"manufacturerCode":null,"commandIdentifier":2},"Payload":{},"Command":{"ID":2,"parameters":[],"name":"toggle"}},"address":5047,"endpoint":1,"linkquality":105,"groupID":0,"wasBroadcast":false,"destinationEndpoint":1}'
zigbee2mqtt  | 2023-12-02T12:50:24.879Z zigbee-herdsman:adapter:zStack:znp:AREQ <-- AF - incomingMsg - {"groupid":0,"clusterid":1,"srcaddr":5047,"srcendpoint":1,"dstendpoint":1,"wasbroadcast":0,"linkquality":94,"securityuse":0,"timestamp":1263530,"transseqnumber":0,"len":10,"data":{"type":"Buffer","data":[28,33,16,56,1,32,0,0,32,28]}}
2023-12-02T12:50:24.880Z zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":0,"manufacturerSpecific":true,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":56,"manufacturerCode":4129,"commandIdentifier":1},"Payload":[{"attrId":32,"status":0,"dataType":32,"attrData":28}],"Command":{"ID":1,"name":"readRsp","parameters":[{"name":"attrId","type":33},{"name":"status","type":32},{"name":"dataType","type":32,"conditions":[{"type":"statusEquals","value":0}]},{"name":"attrData","type":1000,"conditions":[{"type":"statusEquals","value":0}]}]}},"address":5047,"endpoint":1,"linkquality":94,"groupID":0,"wasBroadcast":false,"destinationEndpoint":1}'
2023-12-02T12:50:26.029Z zigbee-herdsman:adapter:zStack:znp:AREQ <-- AF - incomingMsg - {"groupid":0,"clusterid":6,"srcaddr":5047,"srcendpoint":1,"dstendpoint":1,"wasbroadcast":0,"linkquality":102,"securityuse":0,"timestamp":1335485,"transseqnumber":0,"len":3,"data":{"type":"Buffer","data":[17,2,2]}}
zigbee2mqtt  | 2023-12-02T12:50:26.030Z zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":1,"manufacturerSpecific":false,"direction":0,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":2,"manufacturerCode":null,"commandIdentifier":2},"Payload":{},"Command":{"ID":2,"parameters":[],"name":"toggle"}},"address":5047,"endpoint":1,"linkquality":102,"groupID":0,"wasBroadcast":false,"destinationEndpoint":1}'

Sequence:

  • a manufacturer-specific command (misidentified as Ubisys because they use the same cluster id)
  • a toggleCommand with transactionSequenceNumber: 2
  • the device announces itself
  • the toggleCommand again with transactionSequenceNumber: 2

Now, when the device is already awake, and the button is pressed again:

2023-12-02T12:50:30.869Z zigbee-herdsman:adapter:zStack:znp:AREQ <-- AF - incomingMsg - {"groupid":0,"clusterid":6,"srcaddr":5047,"srcendpoint":1,"dstendpoint":1,"wasbroadcast":0,"linkquality":94,"securityuse":0,"timestamp":1637963,"transseqnumber":0,"len":3,"data":{"type":"Buffer","data":[17,3,2]}}
2023-12-02T12:50:30.870Z zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":1,"manufacturerSpecific":false,"direction":0,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":3,"manufacturerCode":null,"commandIdentifier":2},"Payload":{},"Command":{"ID":2,"parameters":[],"name":"toggle"}},"address":5047,"endpoint":1,"linkquality":94,"groupID":0,"wasBroadcast":false,"destinationEndpoint":1}'

We see:

  • toggleCommand with transactionSequenceNumber: 3, not repeated.

I think the problem is the following: in hasAlreadyProcessedMessage it is checked if the last sequence number from that device is the same as the current one.

If we set publishDuplicateTransactions: true, we get duplicate messages every time the device has woken up again. This is the current state.

If we set publishDuplicateTransactions: false, then pressing the button the first time after starting zigbee2mqtt yields sequence number 2, the toggle action is sent, and the second command with number 2 is ignored as it should. If we now wait for very long, the device goes to sleep. When we press the button again much later, the device wakes up and the sequence number starts at 2 again, and is ignored again.

One solution could be to catch the manufacturer-specific 'raw' command (assuming that it is only set on wake up), and use that to reset the stored sequence number.

tkintscher avatar Dec 03 '23 18:12 tkintscher

There might be a simpler way:

Binding to an empty group completely changes the behavior. I played with it and liked the following settings:

  • Go to the device and click on the "Bind" tab.
  • Add a new binding using the bottom row of the table:
    • Source endpoint: 1
    • Destination: default_empty_group
    • Clusters: Identify
    • Press a button on the device to wake it up.
    • Click on "Bind".
  • Add a new binding using the bottom row of the table:
    • Source endpoint: 2
    • Destination: default_empty_group
    • Clusters: Identify
    • Press a button on the device to wake it up.
    • Click on "Bind".

When you refresh the page, it should look like this:

Screenshot 2023-12-03 at 19 53 41

Now, the manufacturer-specific messages do not show up anymore. Instead I get:

2023-12-03T19:04:23.201Z zigbee-herdsman:adapter:zStack:znp:AREQ <-- AF - incomingMsg - {"groupid":0,"clusterid":32,"srcaddr":5047,"srcendpoint":1,"dstendpoint":1,"wasbroadcast":0,"linkquality":105,"securityuse":0,"timestamp":8907561,"transseqnumber":0,"len":3,"data":{"type":"Buffer","data":[25,0,0]}}
2023-12-03T19:04:23.202Z zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":1,"manufacturerSpecific":false,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":0,"manufacturerCode":null,"commandIdentifier":0},"Payload":{},"Command":{"ID":0,"parameters":[],"name":"checkin"}},"address":5047,"endpoint":1,"linkquality":105,"groupID":0,"wasBroadcast":false,"destinationEndpoint":1}'

2023-12-03T19:04:23.247Z zigbee-herdsman:adapter:zStack:znp:AREQ <-- AF - incomingMsg - {"groupid":0,"clusterid":6,"srcaddr":5047,"srcendpoint":2,"dstendpoint":1,"wasbroadcast":0,"linkquality":109,"securityuse":0,"timestamp":8911780,"transseqnumber":0,"len":3,"data":{"type":"Buffer","data":[17,1,2]}}
2023-12-03T19:04:23.248Z zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":1,"manufacturerSpecific":false,"direction":0,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":1,"manufacturerCode":null,"commandIdentifier":2},"Payload":{},"Command":{"ID":2,"parameters":[],"name":"toggle"}},"address":5047,"endpoint":2,"linkquality":109,"groupID":0,"wasBroadcast":false,"destinationEndpoint":1}'

2023-12-03T19:04:23.693Z zigbee-herdsman:adapter:zStack:znp:AREQ <-- AF - incomingMsg - {"groupid":0,"clusterid":32,"srcaddr":5047,"srcendpoint":1,"dstendpoint":1,"wasbroadcast":0,"linkquality":98,"securityuse":0,"timestamp":8929843,"transseqnumber":0,"len":5,"data":{"type":"Buffer","data":[24,202,11,0,0]}}
2023-12-03T19:04:23.694Z zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":0,"manufacturerSpecific":false,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":202,"manufacturerCode":null,"commandIdentifier":11},"Payload":{"cmdId":0,"statusCode":0},"Command":{"ID":11,"name":"defaultRsp","parameters":[{"name":"cmdId","type":32},{"name":"statusCode","type":32}]}},"address":5047,"endpoint":1,"linkquality":98,"groupID":0,"wasBroadcast":false,"destinationEndpoint":1}'

2023-12-03T19:04:24.635Z zigbee-herdsman:adapter:zStack:znp:AREQ <-- AF - incomingMsg - {"groupid":0,"clusterid":1,"srcaddr":5047,"srcendpoint":1,"dstendpoint":1,"wasbroadcast":0,"linkquality":94,"securityuse":0,"timestamp":8998550,"transseqnumber":0,"len":10,"data":{"type":"Buffer","data":[28,33,16,204,1,32,0,0,32,29]}}
2023-12-03T19:04:24.636Z zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":0,"manufacturerSpecific":true,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":204,"manufacturerCode":4129,"commandIdentifier":1},"Payload":[{"attrId":32,"status":0,"dataType":32,"attrData":29}],"Command":{"ID":1,"name":"readRsp","parameters":[{"name":"attrId","type":33},{"name":"status","type":32},{"name":"dataType","type":32,"conditions":[{"type":"statusEquals","value":0}]},{"name":"attrData","type":1000,"conditions":[{"type":"statusEquals","value":0}]}]}},"address":5047,"endpoint":1,"linkquality":94,"groupID":0,"wasBroadcast":false,"destinationEndpoint":1}'
  • a check-in message (seq. number 0)
  • the toggle message (seq. number 1)
  • the device annoncement (seq. number 202)
  • the battery report (seq. number 204)

No duplicate messages anymore!

(For completeness: I also tried binding the genOnOff cluster to the empty group. This also worked, but it always produced the check-in message, a toggle-message to the group, and a toggle-message to the coordinator. Due to the additional toggle-message to the group, the latency was higher compared to the solution above.)

@Loic691 can you try the steps above and see if that solves the issue for you?

If so, I would modify the default device setup, so that these binding are always generated when setting up the device.

tkintscher avatar Dec 03 '23 19:12 tkintscher

Hi @tkintscher

I've tried your suggestion a couple of days now, however i think I'm getting the issue discribed here https://github.com/Koenkk/zigbee2mqtt/issues/14256, instead of getting duplicate messages i'm not getting any or i get them with huge delays.

I'll try to enable the zigbee debug today and share the logs.

On you side do you have these delays? I'm not sure if it's a connection/range issue as it happens even after a couple of minutes after not pushing any buttons, so i guess the switch hasn't gone to sleep yet?

nicozocco avatar Jan 17 '24 07:01 nicozocco

Hi Do you have news for this issue. I tried this week to reset my 067774 device but i have a problem on it... When i pushed the reset button on it about 8 seconds, no red led flashing... i can't reset it :-( I see the device in z2m but it is not configured and no interview is done... On the device I saw 2 leds flashing but with a small small luminosity. Do you have already the same behaviour ? Is there a solution to hatd reset the device ?

Do you have

Loic691 avatar Mar 08 '24 17:03 Loic691

I've tried your suggestion a couple of days now, however i think I'm getting the issue discribed here #14256, instead of getting duplicate messages i'm not getting any or i get them with huge delays.

Yes, I ran into this issue again as well.

However, I have now reconfigured my switch an am reasonably happy with the setup. Basically the answer is in the docs already: https://www.zigbee2mqtt.io/devices/067774.html#binding

Both endpoints must be bound to a group! (It must be a group, it did not work reliably for me when binding to devices!)

To be precise:

  • I have bound Ota, genPollCtrl and PowerCfg to the Coordinator.
  • Then I have bound LevelCtrl and OnOff on endpoint 1 to a group.
  • And LevelCtrl and OnOff on endpoint 2 to another group. image

This way, I always get very quick response times. The switch turns the lights on/off, and long-press allows for dimming.

In addition, I get the toggle_left, toggle_right, ... messages via MQTT and could handle them in Home Assistant (not using this at the moment).

tkintscher avatar Mar 15 '24 14:03 tkintscher

My 067774 is OK now for since version of Z2M... I'm on 24 firmware. Yesterday, strangly, the device stop working. I have to remove battery to get it again (no reset). Therefore I have a pending firmware update on it but it t's not working

Loic691 avatar Apr 09 '24 13:04 Loic691

Does anyone know if it's possible to configure the switch to have on_left, off_left, on_right, off_right? I would prefer that to toggle_left, toggle_right, since it would allow me to have access to the 4 buttons on click.

Mincka avatar Jun 25 '24 14:06 Mincka

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days

github-actions[bot] avatar Jan 02 '25 00:01 github-actions[bot]

Not stale

Mincka avatar Jan 02 '25 09:01 Mincka

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Mar 05 '25 00:03 github-actions[bot]

Not staled

I'm also getting these "double tap" effect on 067773 with a zstack 3 coordinator. Pretty annoying to activate a light.. which randomly turn on then off 2 seconds later.

After updating all routers and some 067773 I see less latency issues at least.

nosignleft avatar Mar 09 '25 22:03 nosignleft

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar May 09 '25 00:05 github-actions[bot]

Not stale. Bug also present for BTicino AM4003C

ilGaspa avatar Jan 04 '26 09:01 ilGaspa