In /config/logs I didn’t find nothing related this automation.
In general I use “Developer tools” and I change states to check the trigger but in this case I donno how to set “unavailable” state.
Ok, with state set to “unknown” or “unavailable”, the automation work but if I remove the battery from device, nothing happens.
Maybe there is another status to add to “to:”?
alias: Devices go offline
trigger:
- platform: state
entity_id:
- binary_sensor.door_1_open
- binary_sensor.door_2_open
condition: []
action:
- service: rest_command.telegram_notify_offline
data:
device: "{{ trigger.to_state.name }}"
offline: "{{ trigger.to_state.state }}"
mode: single
In theory, if the state change, the automation should start.
If I remove the battery, nothing happens.
If I insert the battery, nothing happens.
If I open “Developer tools → States” and I change “binary_sensor.door_1_open” state to “antani”, the automation start and I see on my remote server “The new state is antani”.
It’s a feature of Zigbee - the coordinator does not poll battery-powered sensors, it waits for them to check in (this is to conserve battery).
If nothing is happening (i.e. the door is not opening or closing) the only thing the sensor might need to report is battery level - typically it would do that every few hours, depending on the manufacturer. The coordinator waits until all possible check-ins have clearly been missed before marking the device as unavailable.
oh! thanks for the clarification.
btw I think there is some other problems because now if I look the monitor state (/config/devices/device/), seems stuck into “open”.
I try to delete and re-configure… umpf
If you removed the sensor to take out the battery (as I have to do with mine) the last known state would have been “open”. It will stay that way until the coordinator decides it has lost contact and updates it to “unavailable”.
Yes, I know but I’ve removed the sensor (deleted), rebooted HA and re-added the sensor and HA is stuck in “configuring”.
I decided to reset the automations (deleted all) and the sensors.
Then rebooted the HAOS.
Added the SNZB-04, checked if the state is working into device info page. All ok.
Then re-created the automations.
Now the “the door is open/closed” alert is working without problem.
I removed the battery and now I’ll wait to check if in some hours the alert is sent.
Sorry but I’m new in HA and this kind of “game”.
Tnx guys for all clarifications.