Hi folks,
I am pretty new to ZHA automations and I lost many hours searching on this forum, none of the proposed solutions worked for me.
I have 3 temperature sensors (same model Xiaomi Lywsd03mmc) and I see that they are going into Unavailable state many times/day even if they are on the same desk.
I am trying to do a Notification template so that each time any of the device becomes unavailable and I just want to receive in the message body the name of the sensor. Pretty simple.
I receive this error:
ERROR [homeassistant.components.automation.email_notif_device_offline] Error while executing automation automation.email_notif_device_offline: Error rendering data template: UndefinedError: âdict objectâ has no attribute âto_stateâ
- id: â1706885476017â
alias: Notification & Email â Device offline
description: ââ
trigger:- device_id: 48605f24afb9588cea3799da
domain: zha
platform: device
type: device_offline
subtype: device_offline - device_id: dc6e68038186f9406c8d52f3fb
domain: zha
platform: device
type: device_offline
subtype: device_offline - device_id: 4e9a705a1a5db77a087985ba
domain: zha
platform: device
type: device_offline
subtype: device_offline
condition:
action: - service: notify.persistent_notification
metadata: {}
data:
title: Device is offline
message: â{{ trigger.to_state.name }} is offline for 5 minutesâ
mode: single
- device_id: 48605f24afb9588cea3799da
Please help!
I tried also:
{{ trigger.to_state.entity_id) }}
and
{{ trigger.to_state.attributes.friendly_name }}
and
{{ state_attr(trigger.to_state.entity_id, âfriendly_nameâ) }}