Two Lightbulbs, Rotate between Two Colors

I’ve been bouncing this idea around in my head for a bit. I have two color bulbs with some pretty basic Holiday automations setup. What I would like to do is rotate the colors between the two bulbs on a regular interval, say 30 mins or an hour. The current automation just sets the colors at sunset, I’ll use Christmas as an example, one turns Green and One Turns Red.

Every concept I come up I feel like I’m over thinking it. I don’t think I can simply use a Time trigger since they would both trigger on that interval. Currently I was thinking two automations with an input_boolean as a condition, one looks for on and one looks for off. Toggle the input_boolean every X mins with a separate automation.

Just tossing some ideas around. Any thoughts?

I’m not sure why you’re hesitant to use a time trigger. Here’s a basic break down of what you want to accomplish, using a time trigger. It flips the colors on the hour and on the half.

  - alias: Change lights 1
    trigger:
      platform: time
      minutes: 0
      seconds: 0
    action:
      service: light.turn_on
      entity_id: light.christmas_light_1
      data: 
        color_name: red
      service: light.turn_on
      entity_id: light.christmas_light_2
      data: 
         color_name: green

  - alias: Change lights 2
    trigger:
      platform: time
      minutes: 30
      seconds: 0
    action:
      service: light.turn_on
      entity_id: light.christmas_light_1
      data: 
        color_name: green
      service: light.turn_on
      entity_id: light.christmas_light_2
      data: 
         color_name: red
1 Like

Interesting, guess I wasn’t visualizing it that way. I’ll give this a shot.

Aside from entity id’s, that script should be fully fleshed out for you.

Made a few modifications with some conditions and what not, giving a POC test now. Guess I was incorrectly thinking time was more X amount of time passed as opposed to time of day on the hour, on the half hour, etc. More like a timer (if that makes sense), but the more I think about it the more illogical that sounds. Appreciate the advice.

minutes: '/5'

will trigger every 5 minutes.

minutes: 5

will trigger every hour at 5 after.

I just did this yesterday, fading in and out one light on a 5 second cycle, another on a 7 second cycle, to give a nice little spooky effect. I used the basic idea above–a principally recursive flow of execution where two scripts call each other. Let me know if you need any help with it. For next time I will be writing a script in python or C, to directly talk to the lights though, because at this short of a cycle, there’s a lot of traffic going through hass (it seg faulted one time, but held up after restarting another 5 hours until I turned it off). At a half hour interval though, I think the above solution is perfect.