I have an automation to send me a notification if someone enter’s my house.
How can I print the sensor friendly name in the notification?
alias: Avvisa quando arriva qualcuno
description: ""
trigger:
- type: motion
platform: device
device_id: 2f6dfca69c6ff86393887743400fdd20
entity_id: binary_sensor.soggiorno_home_security_motion_detection
domain: binary_sensor
condition:
- condition: zone
entity_id: device_tracker.iphone_di_marco
zone: zone.home
action:
- device_id: 922d9bfebeed1b650b08af5c102842b8
domain: mobile_app
type: notify
message: >-
Attenzione! Movimento rilevato da {{
states.binary_sensor.soggiorno_home_security_motion_detection.attributes.friendly_name
}} alle ore {{ now().strftime('%H:%m:%S') }}
- service: notify.alexa_media_echo_soggiorno
data:
message: Qualcuno è entrato in casa, avvio modalità antifurto
mode: single
When I run the automation, I get the following error:
2022-12-07 14:41:35.719 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'friendly_name' when rendering 'Attenzione! Movimento rilevato da {{ trigger.friendly_name }} alle ore {{ now().strftime('%H:%m:%S') }}'