Xiaomi Button duplicate messages

Hi guys,
I recently migrated over to VM and hadn’t used HA for a while, so I’m not sure how recent this issue is.

So I have a nodered automation to receive button clicks from my Xiaomi buttons/switches. I’ve previously used the clicks to “toggle” lights or switches.

Now, what is happening, is the last message is being sent twice. So “toggle” functions are just returning the switch/light to its previous state very quickly.
My current workaround is to us the “deduplicate” node, but I’m just wondering if there is a proper fix for this, or if anyone else has encountered this issue?

Any ideas please?

Here is my automation:

[{"id":"c1b02bb7.568b58","type":"tab","label":"Xiaomi Button Control","disabled":false,"info":""},{"id":"b353ce0f.95d3","type":"api-call-service","z":"c1b02bb7.568b58","name":"Desk Lamp Toggle","server":"1b36a1cc.1e72ee","service_domain":"switch","service":"toggle","data":"{\"entity_id\":\"switch.plug_158d00011048ac\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","x":950,"y":60,"wires":[[]]},{"id":"b7d24198.6c62","type":"switch","z":"c1b02bb7.568b58","name":"Xiaomi Buttons","property":"payload.entity_id","propertyType":"msg","rules":[{"t":"eq","v":"binary_sensor.switch_158d00012690c8","vt":"str"},{"t":"eq","v":"binary_sensor.switch_158d0001b199ee","vt":"str"},{"t":"eq","v":"binary_sensor.switch_158d0001d8ea91","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":160,"y":240,"wires":[["65c40896.f93e88"],["6140fd67.4c79f4"],["46095e85.d548f"]]},{"id":"65c40896.f93e88","type":"switch","z":"c1b02bb7.568b58","name":"Button 1 Click Type","property":"payload.event.click_type","propertyType":"msg","rules":[{"t":"eq","v":"single","vt":"str"},{"t":"eq","v":"double","vt":"str"},{"t":"eq","v":"long_click_press","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":510,"y":120,"wires":[["60585fdd.6017a"],["61cfe145.bcae7","3d2d2472.f4e75c"],[]]},{"id":"6140fd67.4c79f4","type":"switch","z":"c1b02bb7.568b58","name":"Button 2 Click Type","property":"payload.event.click_type","propertyType":"msg","rules":[{"t":"eq","v":"single","vt":"str"},{"t":"eq","v":"double","vt":"str"},{"t":"eq","v":"long_click_press","vt":"str"}],"checkall":"true","outputs":3,"x":510,"y":240,"wires":[[],[],[]]},{"id":"46095e85.d548f","type":"switch","z":"c1b02bb7.568b58","name":"Button 3 Click Type","property":"payload.event.click_type","propertyType":"msg","rules":[{"t":"eq","v":"single","vt":"str"},{"t":"eq","v":"double","vt":"str"},{"t":"eq","v":"long_click_press","vt":"str"}],"checkall":"true","outputs":3,"x":510,"y":360,"wires":[[],[],[]]},{"id":"eb7cad75.8fef4","type":"server-events","z":"c1b02bb7.568b58","name":"","server":"1b36a1cc.1e72ee","event_type":"","x":160,"y":120,"wires":[["b7d24198.6c62"]]},{"id":"8e133a46.abc058","type":"api-call-service","z":"c1b02bb7.568b58","name":"","server":"1b36a1cc.1e72ee","service_domain":"light","service":"toggle","data":"{\"entity_id\":\"light.yeelight_color2_04cf8c780309, light.yeelight_color2_04cf8c7822e4\"}","mergecontext":"","output_location":"","output_location_type":"none","x":940,"y":120,"wires":[[]]},{"id":"61cfe145.bcae7","type":"debug","z":"c1b02bb7.568b58","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":220,"wires":[]},{"id":"60585fdd.6017a","type":"deduplicate","z":"c1b02bb7.568b58","name":"","keyproperty":"","expiry":"1","x":750,"y":60,"wires":[["b353ce0f.95d3"],[]]},{"id":"3d2d2472.f4e75c","type":"deduplicate","z":"c1b02bb7.568b58","name":"","keyproperty":"","expiry":"1","x":750,"y":120,"wires":[["8e133a46.abc058"],[]]},{"id":"1b36a1cc.1e72ee","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

EDIT:
I have since simplified the deduplicate placement, but it’s still a workaround. Not sure what has changed with HA or Xiaomi since last time I used it.

Why not try using one of the xiaomi nodered nodes, there are a number of them in the node-red library. i use this one and my button clicks work flawlessly, https://flows.nodered.org/node/node-red-contrib-mi-sensors

Not sure it’s related, I had a similar issue just after changing the name or the entity_id of the entity. A HA reboot solved the duplicated messages.

Have anyone had this problem? i’m having the same issue, and i don’t want to create a new connection to the gateway.

Thanks!

Solved Restarting completely the system, power off…