Hi guys.
I have an automation that detects which Zigbee devices have not been transmitting for x minutes.
For some time now, the message no longer works, or rather it no longer shows me the offline devices (only the simple text part arrives “OFFLINE Zigbee Devices:”).
This is the Action of automation:
action:
- service: notify.notification_service
data:
title: Z2M DEVICE ALERT
message: >
OFFLINE Zigbee Devices:
{% macro GetDroppedZigbee() -%}
{% for state in states.sensor -%}
{%- if ("linkquality" in state.name and state_attr(state.entity_id, "last_seen") != None and (as_timestamp(now()) - as_timestamp(state_attr(state.entity_id, "last_seen")) > (5 * 60 * 60))) -%}
{{ state.name | regex_replace(find=' linkquality', replace='', ignorecase=False) }} -- Da {{ ((as_timestamp(now()) - as_timestamp(state.attributes.last_seen)) / (3600)) | round(0) }} ore {{- '\n' -}}
{%- endif -%}
{%- endfor %}
{%- endmacro -%}
{{ GetDroppedZigbee() }}
I don’t understand why it doesn’t work anymore, it always worked very well.
I use Zigbee2mqtt, and the last_seen option is enabled.
Thanks