I hope some one can help me with this automation to do the watering. I am having trouble implementing the turn-off part of the automation. I want the length of watering to be shorter when the temperature is lower, so trying to do that using a template. I am getting an error - hope someone can assist. Thanks in advance!
The automation is:
id: water_system_on
alias: Turn on watering system
initial_state: true
trigger:
platform: sun
event: sunset
offset: “-01:00:00”
condition:
condition: numeric_state
entity_id: sensor.yr_precipitation
below: 2
action:
service: notify.pushover
data:
message: “The watering system switched off”
title: “Home Assistant”
The error I get is
Invalid config for [automation]: offset {% if ‘sensor.yr_temperature’ > 25 %}
minutes: 15
{% elif ‘sensor.yr_temperature’ > 15 %}
minutes: 10
{% elif ‘sensor.yr_temperature’ > 8 %}
minutes: 5
{% else %}
minutes: 2
{% endif %}
should be format ‘HH:MM’ or ‘HH:MM:SS’ for dictionary value @ data[‘trigger’][0][‘for’]. Got None. (See /config/configuration.yaml, line 71). Please check the docs at https://home-assistant.io/components/automation/
I’m trying to think of a way to do this with a value template and I can’t. You may need to utiliize the last_updated or last_changed (i forget the property) for the sensor.yr_temperature. Maybe even the history statistics component may get you the information you are looking for.
In case this helps anyone else, have worked out a solution using Timers (have defined a timer called ‘timer0’ for the automation below. Will test it tomorrow and let you know if it works OK.