I’m trying to create a binary sensor which would replicate zigbee button status (hue button connected via zigbee2mqtt).The sensor shall stay in ON state as long, as the button as pressed and shall go to OFF when the button is released. I need that to identify x1/x2/x3… clicking patterns afterwards.
I was able to read payload from the trigger, but have difficulties to find the right syntaxis to do the comparison… nothing works there. I would appreciate a lot if someone could give me a hand here. Thanks!
Just guessing, did you try using only trigger in the template? Payload might just be added in the logs.
And your elif line is missing a ) at the end of states.
The documentation is referring to a capitalized True.
Updated accordingly, no changes… I have added one more sensor for troubleshooting.
bin_Button_1 - works as expected (showing the button action status, including “press” and “release”)
bin_Button_2 - no changes, if/else statements are never executed.
But now there is a problem: the sensor’s state is cleared on ‘off’ event.
is it possible to create sensor’s trigger condition which would trigger only payloads “press” and “release” ? This should be easy to do, just can’t find how… any hints?