Struggling to get what should be a very simple automation to work. I have two freezer temperature sensors, and I’m trying to write an automation to notify our phone when it happens. I’ve tried several different variations of using the “trigger” variable, but each try gives me a different error when I try to manually run the automation. Here’s the latest code:
id: '1703126247572'
alias: Freezer Temp Warning
description: ''
trigger:
- platform: numeric_state
entity_id:
- sensor.garage_freezer_temperature
- sensor.kitchen_freezer_thermometer_temperature
for:
hours: 0
minutes: 5
seconds: 0
above: 20
attribute: current_temperature
condition: []
action:
- service: notify.all
data:
title: Freezer Warning!
message: '{{ trigger.to_state.name }} is too high: {{ state_attr(trigger.for, 'temperature') }} F '
mode: single
I’ve also used “trigger.name”, “trigger.event.data.name”, etc. I’ve tried many different variations based on google searches. I get an error that looks like this when I click “Run” on the automation:
Executed: December 22, 2023 at 11:27:16 AM
Error: Error rendering data template: UndefinedError: 'dict object' has no attribute 'to_state'
Is the “trigger” object not populated when you manually trigger the automation to test it?