Template OFFSET for SUN trigger in Automation, any ideas?
Automation:
- alias: Irrigate Pots at Sunrise
trigger:
platform: sun
event: sunrise
# Time offset, to start action once Lawn irrigation duration has elapsed
offset: '00:{{states.input_slider.lawn_irrigation_duration.state|round(0)}}:00'
condition:
#To do its not raining today
action:
service: homeassistant.turn_on
entity_id: script.pot_irrigation_timer
Error:
ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: offset 00:{{states.input_slider.lawn_irrigation_duration.state|round(0)}}:00 should be format ‘HH:MM’ or ‘HH:MM:SS’ for dictionary value @ data[‘trigger’][0][‘offset’]. Got None.
As for the code, the only thing I have close to that is this:
‘/home/hass/.homeassistant/GFChime/GrandFatherChime{{ now().strftime("%I") }}.wav’
This puts a number in the name so that the correct file is played for that particular hour.
My guess is that {{states.input_slider.lawn_irrigation_duration.state|round(0)}} is not returning a number. Have you tried removing the pipe and the round section? What about removing the last state? I’m not a coding guy