I’m looking to turn on Christmas lights on November 15th, and turn them off on January 3rd, every year. I’d like to use Sunset as the trigger, but I’m having trouble figuring out how to make a condition so it is only run during a specific time frame.
Thank, I think that will work, but I cannot get conditions to save when done through “Edit in YAML”
My condition looks like the below. Any time I add it, it disappears after saving.
condition:
- condition: template
value_template: >
{% set n = now() %}
{{ n.month == 11 and n.day >=20 or n.month == 1 and n.day <= 3 }}
Indentation
condition:
- condition: template
value_template: >
{% set n = now() %}
{{ n.month == 11 and n.day >=20 or n.month == 1 and n.day <= 3 }}
Another way to do the same thing:
condition:
- condition: template
value_template: >
{% set t = (now().month, now().day) %}
{{ t >= (11, 20) or t <= (1, 3) }}
That was it, thanks.