I’m brand new to HA after spending my time in the smart home world in SmartThings and doing the best I could with it.
Now we’re migrating over and getting there piece by piece. So far, so good.
One question: I own four Novostella RGB landscape lights that are working just fine in HA, with an automation to turn each of them on and off around sunrise and sunset. Now I’d like to go a step up and tie specific (perhaps scenes?) to calendar periods. For example, around Halloween I’d like all the lights to go mainly orange, but then during the Christmas period (say all December) have the lights switch between green and red and potentially do it in some staggered fashion so that when lights 1 and 3 are red, lights 2 and 4 are green… switch and repeat.
Create a Trigger-based Template Sensor, called sensor.festive_season, that reports either halloween or christmas during whatever stretch of days you choose for these holiday events. In this example, Halloween is two days (30/31) and Christmas season is December 1 to January 10. This Template Sensor is updated at the start of every day or whenever Home Assistant is restarted or when you execute Reload Template Entities.
template:
- trigger:
- platform: time
at: '00:00:00'
- platform: event
event_type: event_template_reloaded
- platform: homeassistant
event: start
sensor:
- name: 'Festive Season'
state: >
{% set m = now().month %}
{% set md = (m, now().day) %}
{{ 'halloween' if (md == (10,30) or md == (10,31)) else 'christmas' if (m == 12 or (1,1) <= md <= (1,10)) else 'none' }}
icon: "{{ 'mdi:party-popper' if states('sensor.festive_season') != 'none' else 'mdi:sleep' }}"
Create an automation with a State Trigger that monitors sensor.festive_season and triggers whenever the sensor’s value changes to either halloween or christmas. Depending on which holiday it changed to, you can do different things (turn on various lights, switches, etc).
I’m unfamiliar with the lighting you described so I simply made an assumption that there are 4 lights and you can control each one individually. Change it to whatever it is you are using.
What date range are you trying to establish there? Halloween is a single day but it seems like you’re trying to define a range of days albeit using an incorrect comparison.
Tell me what you tried in order to fix it. What didn’t work?
BTW, I assume you have a 15-minute Time Pattern Trigger purely for testing purposes because the production version only needs to trigger at the beginning of each new day.
It was working before I added the lengthy list of dates. I have no idea why it triggered to ‘pride’ in the first place as those dates aren’t until June.
I am doing every 15 minutes because I only want it to turn on once the lights come on automatically at sunset (-60). Is there a better idea?
Not unless you have designed your automation to use this Trigger-based Template Sensor in that way.
It’s a Trigger-based Template Sensor designed to report if the current day is a holiday. It only needs to check if the current day is a holiday at the start of each new day (midnight). It doesn’t need to repeatedly check every 15 minutes if today is a holiday.