Goal: To iterate over all Z2M devices, and generate alerts for any offline devices.
I have previously made this blueprint for the community, to notify when any Zigbee(ZHA), or ZWave devices have gone offline.
I was just looking at “nice” ways to extend this for Zigbee2Mqtt.
I see that Z2M has an “availability” “field”, but it is not part of the H.A entity, rather it is published separately as an MQTT topic, e.g: zigbee2mqtt/LOUNGE_MOTION_SENSOR/availability
My question is: How can I create a blueprint that will effectively iterate over all mqtt sensors, and then create a list of ones where availability==false
e.g I can generate a list of all MQTT entities easily enough (see code below), but I am not sure how to access MQTT payloads from within Jinja? (and I want this to be fully automatic - I don’t want to have to manually create a MQTT Sensor for each devicve)
{{ states | selectattr('entity_id', 'in', integration_entities('mqtt')) | map(attribute='entity_id') | list }}