Notification if any device goes unavailable

Trying to figure how I can make flow like my picture. Any bright ideas?

I wanna send a notification with the device/entity name if any device in HA is unavailable for 5 minutes.

I use @jazzyisj unavailable-entities-sensor: https://github.com/jazzyisj/unavailable-entities-sensor/blob/main/README.md

Then I use an events:state node to detect when something is unavailable and send a generic notification:

I don’t want a notification for each entity that goes unavailable because I usually have more than one entity go unavailable at once - I don’t want multiple notifications. Then I check to see what is unavailable.

Ok I see. But I’m more after filtering out which device that stope working.

This template will give you a list of devices associated with the entities in the unavailable entities sensor.

{% set devices = namespace(name=[]) %}
{% for item in expand(state_attr('sensor.unavailable_entities', 'entity_id')) 
    if device_id(item.entity_id) != none %}
{% set devices.name = devices.name + [device_attr(device_id(item.entity_id),'name')] %}
{% endfor %}
{{ devices.name | unique | sort | list }}

1 Like

Thanks how do I go from there if I wanna send a notification for each sensor with the name attached?