I’m trying the following code to get the time length of a previous state in an Automation.
But the only result I get from the {{ trigger.from_state.for }} is ‘None’
automation 1:
- alias: ‘Alarm’
trigger:- platform: state
entity_id: sensor.gpio17
to: ‘0’
action: - service: notify.mail
data_template:
title: >
message: >
{{ trigger.from_state.for }}
- platform: state
Am I using the wrong syntax?
Thanks