I’m using Zigbee2MQTT, and just paired a wireless Xiaomi dual button. It automatically created a sensor. The state of the sensor changes to Left, right, left_double, right_double, etc, based on which button I press/double press. How can I make it so that a light toggles when a button is pressed. I don’t think the ‘state_changed’ event will work for the times where I press the left button, and then press it again a minute later, since I’m guessing that wouldn’t actually change the state.
It’s always the same afterwards - look at the payload and define the trigger & In condition comes the part when you realy want it to trigger. so for example
like 'zigbee2mqtt/sz_cube_pc', payload '{"battery":37,"voltage":2975,"linkquality":89,"action":"rotate_right","angle":23.12}'
For the sake of the argument it sould only trigger when I put in a supernew battery.
the condition would be then value_template: "{{ '100' == trigger.payload_json.battery}}"
and change the automation to the things you want
same with right click, left click and so on
Ah. I didn’t even think about looking at MQTT. I was just looking at the sensor. I got something working using State_change on the sensor, but it didn’t work right, and then our lights came on randomly in the middle of the night last night for no reason, and I had to wake up to shut them off. So I’m going to try out what you said. Thanks for your help with this.