Hi. I’ve tried the solution posted here: Show triggering sensor in notification?
The goal is to setup a notification that will have several sensors as possible triggers that will send out a notification once the temperature is above a certain level. I’m trying to get the notification to show which one actually triggers the automation.
Unfortunately, it doesn’t work. My setup is similar but with temperature instead of humidity. When I run the automation, nothing happens at all. This is the error from the automations log:
Error: Error rendering data template: UndefinedError: 'dict object' has no attribute 'to_state'
- id: '1646071707542'
alias: High temp
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.test_2
above: '30'
for:
hours: 0
minutes: 0
seconds: 5
condition: []
action:
- service: notify.mobile_app_sm_g973f
data:
title: ALERT - High temperature alarm
message: Temperature is high - current temperature is {{ states('sensor.test_2')
}} {{ '°C' }} {{ trigger.to_state.attributes.friendly_name }}
- service: notify.gmail
data:
title: ALERT - High temperature alarm
message: Temperature is high - current temperature is {{ states('sensor.test_2')
}} {{ '°C' }} {{ trigger.to_state.attributes.friendly_name }}
mode: single