#Automations during specific calendar time frame
1 messages · Page 1 of 1 (latest)
You can use a template condition for that.
Easy for static dates, likely more complicated for dynamic ones.
Example for automations running between November 27th and January 6th:
{{ (now().month == 11 and now().day >= 27)
or (now().month == 12)
or (now().month == 1 and now().day <= 6) }}
That's the middle section of the automation, right?
The conditions part, yes.
Okay, I'll put it in and give it a shot
And lastly, if I want to trigger the automation to turn on 20m before sunset, is this the right format?
I think that would be -00:20:00
I missed my window today and am too lazy to refactor, so I'll wait for tomorrow
For the template you can compare using a tuple, which makes reading the code easier and also lets you do ranges easier.
{{ (now().month, now().day) >= (11, 27) or
(now().month, now().day) <= (1, 6) }}
(note for something that doesn't cross the end of the year you'd want AND rather than OR)
You could also create a holiday light calendar event that runs from 27th Nov to 6th Jan and just check if that's on
Okay, so it turned on tonight, which is good
I had disabled the date check to make sure that -00:20:00 worked
And already confirmed they turned off last night at 1:30AM, so fantastico 😄
or trigger off the calendar directly - {{ state_attr('calendar.party_at_home', 'message') == 'Party at Home' }} or condition: state
entity_id: calendar.roof_led_schedule
state: Halloween
attribute: message