vespuccio
(vespuccio)
February 20, 2025, 5:26pm
1
Right now if I reboot my raspberry pi some automations that depend on the state of a device are triggered. My guess is that when I reboot their state is set to NULL and then when zigbee2mqtt starts, it sets then again to what they were.
So now my automaitons like
when power plug goes on/off
are triggered when I reboot or do something in zigbee2mqtt that restarts it
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
February 20, 2025, 6:18pm
2
I assume state or event triggers, (show us your triggers)…
You would add not_from: unavailable unknown…
Example :
automation:
triggers:
- trigger: state
entity_id: vacuum.test
not_from:
- "unknown"
- "unavailable"
to: "on"
vespuccio
(vespuccio)
February 20, 2025, 9:52pm
3
alias: energia voltou
description: ""
triggers:
- type: not_moist
device_id: d626eca66a9c739a435c31e12b1423a4
entity_id: ae9e3f6ec50d17fc0f294a2c800458ae
domain: binary_sensor
trigger: device
conditions: []
actions:
- action: notify.notify
metadata: {}
data:
message: energia voltou
mode: single
in this case it looks like the trigger is different. Where do I put the not_from?
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
February 21, 2025, 5:04am
4
It’s a device trigger. change it to a state trigger and add code similar to the example.
This topic is part of the community-driven cookbook where you can find other topics you might be interested in or might like to contribute to.
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 is storing up problems for the future. Far better to use an entity, with state or numeric_state.
Devi…