I’ve been scratching my head on this one for a few weeks…
This year I put my house’s Christmas lights on a RF outlet controlled by Home Assistant by way of the rpi-rf switch. I’m going to leave out the switch configuration, because it works perfectly – I can turn on and off the switch manually without issue (so I know the codes / frequency are correct, and the range of the transmission doesn’t seem excessive).
I use an automation with the sun
trigger to turn on the lights at sunset. It works brilliantly, every time.
- alias: turn on christmas lights
trigger:
platform: sun
event: sunset
offset: '+00:00:00'
action:
service: switch.turn_on
entity_id: switch.christmas_lights
However, my automation to turn the lights off at 8:30 pm, using the time
platform doesn’t seem to ever work.
- alias: turn off christmas lights
trigger:
platform: time
after: '20:30:00'
action:
service: switch.turn_off
entity_id: switch.christmas_lights
Here’s the thing – I’m pretty sure it should work, because if I trigger it manually with the developer tools using automation.trigger
with {"entity_id": "automation.turn_off_christmas_lights"}
, it works brilliantly, and at 8:30 PM every night, I see in my logbook Turn Off Christmas Lights has been triggered
– but the light doesn’t turn off.
I’ve worked with a few RF libraries on the Pi before and had issues getting reliable transmission when the CPU was busy (presumably because it’s not a RTOS), but if this were the cause I would expect unreliable transmission at other times as well (e.g. at sunset – but it reliably gets turned on, or when triggering manually – but it seems to work every time manually).
Any ideas?
- The switch works
- The automation works when manually triggered
- The time trigger seems to be triggered appropriately
- The switch just isn’t getting turned off