Automation Events - TheThinkingHome/device_sentinel GitHub Wiki
Let your automations fix a problem for you. Device Sentinel fires an event when a device breaks, when it recovers, and when a broker, bridge, Wi-Fi network or integration goes down. An automation can power-cycle a frozen sensor the moment it freezes, without checking sensor states each minute.
The events follow the Problem List: a device that drops off for a few seconds and comes straight back fires nothing, and a device with two problems fires one event carrying both.
Device Events
device_sentinel_fault
Fires when a device lands on the Problem List, and again when a new problem joins it.
| Field | What it is |
|---|---|
device_id |
The device's ID in Home Assistant. Use this one: it survives a rename. |
name, area |
The device's name and area. |
kinds |
Each problem, worst first. |
since |
When the worst problem began. |
renewed |
True if it fires again because you unticked an acknowledged problem. |
battery_level, battery_type |
With a battery problem, such as 2× CR2032. |
signal_value |
With a signal problem. |
The kinds, worst first: unavailable, frozen, unknown, never_reported, low_battery, falling_battery, short_drop_outs, railed_signal.
device_sentinel_recovered
Fires when the worst problem clears. It carries device_id, name and area, plus kind (the problem that cleared), down_for (in seconds) and resolved_by (self, intervention or unknown). A sensor that comes back with a low battery fires a recovery for unavailable and stays on the list for its battery.
device_sentinel_acknowledged
Fires when you tick a problem on the Problem List. Unticking fires the fault again, with renewed: true.
device_sentinel_withdrawn
Fires when a problem leaves the list because the device is no longer watched: excluded, muted, set aside or removed. It closes a fault, but it isn't a recovery.
Outage Events
device_sentinel_upstream_down and device_sentinel_upstream_restored
One event for a broker, bridge, Wi-Fi network or integration going down, instead of seventy device faults, and one when it comes back. Both carry kind (broker, bridge, wifi or integration), name, since and devices (how many sit behind it). The restored event adds for_seconds.
When Nothing Fires
- Right after a restart. A problem still true once the house has finished reporting is announced then, once.
- Device faults during an outage. The outage events stand for them.
- Quiet Hours don't apply. They silence your phone, not your automations.
Tips
Match device_id in the trigger, and check the problem in a condition, since kinds is a list:
condition:
- condition: template
value_template: "{{ 'unavailable' in trigger.event.data.kinds }}"
Example: Power-Cycle a Frozen Sensor
This automation watches three presence sensors. When one is reported frozen or unavailable, it switches off the plug that powers it, waits ten seconds and switches it back on. If the sensor hasn't recovered within fifteen minutes, a notification names the room.
