I’m trying to do something that I thought would be really simple:
Set a boolean to ‘true’ or ‘on’ when a certain point in time has gone by - can’t seem to figure it out.
I have a sensor that calculates when my sprinklers should run next time from the time the ran previously:
- platform: template
sensors:
sprinkler_next_runval:
friendly_name: Sprinkler Next Runval
value_template: '{{ ((states.input_datetime.sprinkler_last_runtime.attributes["timestamp"]) + (3600 * 24 * (states.sensor.sprinkler_offset_in_days.state | float) - 60)) }}'
Once this time has come I want to indicate that it is now an option to run the sprinklers again by using a simple automation (I still want to check a few conditions, though, like accumulated precipitation over the last 7 days and that it’s actually not during the middle of the day).
I have spent the last two days trying to make this work, but I can’t, the trigger doesn’t seem to work in my setup:
- alias: Set Time to Water State
trigger:
platform: template
value_template: "{{ ((as_timestamp(now()) | float) > ((states.sensor.sprinkler_next_runval.state) | float)) }}"
action:
- service: homeassistant.turn_on
entity_id: input_boolean.time_to_water
If I test it in the template editor it works fine, as part of the automation it does not.
Anybody out the who can help?