I have this plan for my front lights to change color every holiday. So far it worked for Halloween. But I wanted a simultaneous automation that if it wasn’t a holiday to turn the lights white and then of course off/on normally in the Day/night for typical outside lights. I created a helper toggle switch to be ON for these special holiday date ranges then in my ordinary time automation if the toggle is on it doesn’t fire. For example I have this Halloween season October 22 to 31st. On Nov 1st I want to return to normal. This makes it easy to just duplicate the automation for Christmas, St. Patty’s day etc. I used the examples HERE I notice my HASS changed value_template: >
to value_template: |-
I don’t know why does that “>” vs “|-” make a difference? Is there a way to test this besides waiting a full calendar? Here is what I have so far, is my logic sound? I will add dates if this continues to work. I was tinkering last night and clicked ‘run’ on this automation and it toggled my switch even though it didn’t meet the condition stated. I went through the “traces” and it didn’t meet the condition but why would the service run? Thank you for any help.
alias: Season end-season
description: ""
trigger:
- platform: sun
event: sunrise
offset: "+00:15:00"
condition:
- condition: template
value_template: |-
{% set n = now() %}
{{ ( n.month == 11 and ( n.day == 1 )) or ( n.month == 1 and ( n.day == 6 )) or ( n.month == 2 and ( n.day == 15 )) or ( n.month == 11 and ( n.day == 29 ))}}
action:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.holiday_rgb
mode: single