srescio
(Simone Rescio)
March 2, 2024, 2:19pm
1
hi folks, I’ve setup a rather straightforward automation but has just now behaved unexpectedly,
I have two devices, a Nuki smartlock with a button entity that opens the door and an Ezviz alarm that enables/disables notifications for sensors
in the automations UI i created the following, where WHEN the button for opening the door is pressed THEN it should disabled the alarms,
to my surprise, later today I found that the alarm got deactivated without me doing so nor opening the door, but it appears this happened because the nuki device at some point was not available:
but again the trigger I set up should be very clear, a button press is a button press, not a wild card on any device event,
why would this result in the trigger being activated?
feels like a bug, at least on the UI during setup
srescio
(Simone Rescio)
March 2, 2024, 2:44pm
2
this is the yaml related to the trigger
Another reason not to use Device triggers…
Don’t forget that the first post in a community guide is a wiki - feel free to add to it or correct it.
This guide was written with reference to:
Home Assistant 2023.8.3
Supervisor 2023.08.1
Operating System 10.5
Frontend 20230802.1 - latest
Background
When you start writing automations, a device trigger seems the obvious choice. Everybody knows what a device is and it comes at the top of the UI dropdown list.
[image]
It works… but it is certainly not a “great way to start” because it …
You can switch to a State trigger which allows you to exclude values like “unavailable” and “unknown”…
trigger:
- platform: state
entity_id: button.EXAMPLE
not_to:
- unavailable
- unknown
not_from:
- unavailable
- unknown
… or you can use an Event trigger for the button.press
service call.
- platform: event
event_type: call_service
event_data:
domain: button
service: press
service_data:
entity_id: button.EXAMPLE
1 Like
srescio
(Simone Rescio)
March 2, 2024, 5:40pm
4
more complex than expected
this also calls in question the claim on it being the first suggested option, or the claim that its the best way to start, as I started with that and failed immediatey
1 Like
Believe me, many of us have advocated for those things to be changed…
3 Likes
Edwin_D
(Edwin D.)
March 2, 2024, 6:08pm
6
Should read: When something happens to a device, this completely breaks. Great way to get lost.
I was thinking something like:
or
2 Likes