If I have a timed automation, what is the best way to stop it performing the action if a sensor has not got a value? If this triggers just after HA is started, and before the sensor has a value, it ends up passing ‘unknown’ to the service.
- id: Watchdog - Greenhouse Temperature
alias: Watchdog - Greenhouse Temperature
description: ''
trigger:
- platform: time_pattern
minutes: /5
condition:
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.sensor.propagator_temperature.last_updated)|int)
> 270 }}'
action:
- service: shell_command.send_netlink
data_template:
key: extraTemp1
value: '{{ states(''sensor.propagator_temperature'')}}'
mode: single