So I just finished setting up zigbee2mqtt and connect all my zigbee devices to it (works like a charm btw) - one of which is a Xiaomi Aqara douple wall switch (WXKG02LM)
Pairing was no problem and Home assistant recognizes right, left, both - double and long
Sounds awesome, right?!
Unfortunately there is one huge problem. Home Assistant remembers the last press forever instead of going back to nothing after pressing the switch…
So the sensor (what the switch technically is) always shows the state it was last in. This is a huge problem If you want for example toggle a light with each click. Because going form “right” to “right” changes nothing, hence no action will be performed.
I also tried just making “right” and “right_long” automations for ON and OFF, but it is no solution … if you toggle a light from womewhere else (for example if you have two switches, each on opposite sides of the room), chances are, the switch already is in the state you want it to go into … which is not possible.
So I thought there must be a solution to this. The best way to solve that issue would be to have the sensor (the wall switch) always go back to a “null” stage right after using it, so even pressing “right” multiple times, would work: “null” -> “right” -> “null” -> “right” -> “null” -> “right” -> “null” and so on (maybe with a second delay before going to “null”) - each time it’s a “to: right” command, even if the last thing you did was pressing “right”. In this case using an automation like this would work
- id: 'xiaomi_switch_01' alias: Xiaomi_switch_01 trigger: - entity_id: sensor.0x07158d0242cb7d41_click platform: state to: left condition:  action: - data: entity_id: light.0x0242480102l10ob4_light service: light.toggle
The bad thing is, I have no Idea how to do that, I just don’t know enough about writing scripts etc…
So, anyone know how to accomplish such a configuration?