Even without the delay, you won’t get it to work. It could work some times that by “accident” it checks exactly at the moment the state is as desired.
That’s the problem with using states for button presses rather than events.
I think you are right. I’ll move to using helpers for the state switch. Not ideal, but it should work. Gonna get myself a lot of helpers
With helpers it will get even more complex and you need to think about all the possible scenarios while you implement it.
If I were you, I’d use the AppDaemon app I suggested until something native gets implemented.
Wait how many?
Do you need all of them at the same time?
Still working on my issue with the until condition not fireing.
Found this which is interesting : Looking at the event bus the new state is NOT ‘button_1_release’ but the new state is empty. Gonna do some more digging but this might very well be the reason the until condition doesn’t trigger.
{
"event_type": "state_changed",
"data": {
"entity_id": "sensor.wallswitch_attic_action",
"old_state": {
"entity_id": "sensor.wallswitch_attic_action",
"state": "button_1_release",
"attributes": {
"action": "",
"battery": 100,
"linkquality": 68,
"voltage": 3055,
"friendly_name": "wallswitch_attic_action",
"icon": "mdi:gesture-double-tap"
},
"last_changed": "2020-10-05T13:20:52.904463+00:00",
"last_updated": "2020-10-05T13:20:52.924913+00:00",
"context": {
"id": "97e4b1d2070d11eba067a71995daf1e6",
"parent_id": null,
"user_id": null
}
},
"new_state": {
"entity_id": "sensor.wallswitch_attic_action",
"state": "",
"attributes": {
"action": "",
"battery": 100,
"linkquality": 68,
"voltage": 3055,
"friendly_name": "wallswitch_attic_action",
"icon": "mdi:gesture-double-tap"
},
"last_changed": "2020-10-05T13:20:52.926017+00:00",
"last_updated": "2020-10-05T13:20:52.926017+00:00",
"context": {
"id": "97e4dd71070d11eba750f384ba08fbe1",
"parent_id": null,
"user_id": null
}
}
},
"origin": "LOCAL",
"time_fired": "2020-10-05T13:20:52.926033+00:00",
"context": {
"id": "97e4dd71070d11eba750f384ba08fbe1",
"parent_id": null,
"user_id": null
}
}
yep, it might be just to fast.
just use helpers its easy as hell
I use it to control my blinds (switch channels )
It is the reason, you don’t need to dig any further. At the point the until condition checks, the state will only be button_1_released in very rare cases by accident or maybe even never.
Was sort off hoping I could test for the old_state. That one is retained until I toggle the switch a second time…
Eventually the digging helped. Here is the situation :
If I press the switch and hold for less than ( about ) four seconds is sends out the release topic when it is released.
But : If I hold the button for more than ( about ) four seconds the release topic is never send.
Hence the weird responses to my automation. Sometimes the release topic gets send, sometimes it doesn’t, depending on how long I hold the button.
Now that is absolutely unworkable for a dim function since you are very likely to hold that button more than four seconds if you want to dim or brighten more than a few percent.
Haven’t figured out the root cause of this : Zigbee2Mqtt or the actual switch.
Hi Burningstone,
I gave up. Never gonna work the way I wanted to. Followed your advice and took a look at ControlerX. Got it up-and-running in 10 minutes.
Thanx for the tip.