My ultimate goal is to have Voice Announcement on my Google devices to inform it is bedtime for the children. I made two input_datetime helpers called ‘bedtime_childname’ and a third input_datetime helper with a delay. Both bedtime helpers are set to the time that they need to go to bed, lets say 8PM. When it’s weekend, or when it’s holiday the delay should extend the bedtime with the input_datetime delay (30 minutes). The automation should kickin when it is actually bedtime, but this depends on the day of the week and an input_boolean whether it is vacation or not.
I’m thinking about two additional input_datetime helpers with the calculated bedtimes, but I cannot find articles explaining how to calculate with time, based on input_datetime and delay helpers.
Anyone any idea on how to approach my situation?
Hi @Didgeridrew ,
There is a small mistake in your template, but with a bit of googling I got it working. The if statements expects booleans and therefore the state check needs an ’ == “on”’ addition.
The actual template I now have is:
{% set base_time = today_at(states('input_datetime.bedtime_child_1')) %}
{{ base_time + states('input_datetime.delay') |
as_timedelta if (now().isoweekday() >= 6 or states('input_boolean.vacation') == 'on' ) else base_time }}