I am trying to start an automation based on tomorrows calendar entry: If I have a first event any time before 9 am, I want the heater to start at 10 pm today.
The google calendar integration works, the heater automation works, and I managed to scrounge a template sensor to show ‘true’ when there is an event in the calendar for tomorrow. However, I fail to find a way how to manage the start time.
This is what I use so far
rk_dienst_date:
friendly_name: "Nächster Dienst im RK"
value_template: >
{% set start_time = states.calendar.fjf_vienna_gmail_com.attributes.start_time %}
{% set start_time_2 = strptime(states.calendar.fjf_vienna_gmail_com.attributes.start_time, "%Y-%m-%d %H:%M:%S").strftime("%H:%M") %}
{% set pickupday = strptime(states.calendar.fjf_vienna_gmail_com.attributes.start_time, "%Y-%m-%d %H:%M:%S").strftime("%A") %}
{% if as_timestamp(start_time) > (as_timestamp(now()) + 86400) %}
false
{% elif as_timestamp(start_time) > as_timestamp(now()) %}
true
{% elif (as_timestamp(start_time) - as_timestamp(now())) > -86400 %}
false
{% else %}
Unknown
{% endif %} "
start_time_2 should have the info I need (start time w/o the date component), all I need - I think - is a way to use this in a condition ( ’ if start_time_2 < 09:00 ).
I am still a dilettante in HA, so any and all hints are appreciated! Thanx!
Franz