I’m trying to setup an automation to turn on our ‘Holiday’ lights outside.
I thought I’d start with a simple automation first and then make it more complicated. the simple automation I want is to turn the lights on to a solid colour after sunset.
Below is the automation I tried last week, it didn’t work and I think it crashed HA taking the VM with it. Either that or the crash was a very precise coincidence.
alias: Holiday Light test
description: Turn on the Holiday Lights
trigger:
- platform: template
value_template: '{{ now().strftime("%m-%d") == "11-15" }}'
condition:
- condition: sun
after: sunset
action:
- service: light.turn_on
target:
device_id: f8170eb7cc72b6712b87dec319a3cadf
data:
color_name: purple
effect: Solid
mode: single
If you made this last week… it wasn’t November 15th.
Also, that’s not the right trigger to use. Triggers execute upon a change, so when triggering off the date, the trigger executes after midnight. As far as Home Assistant is concerned, after midnight will always be before sunset not after.
So I want to set the trigger to ‘After sunset’ and then a condition template of {{ now().strftime("%m-%d") == "11-15" }} to have them turn on, on only the 15th of Nov?