Color cycling for the season

I have 5 Kasa RGBW bulbs in the front of my house. I've looked at the various holiday lighting / garden hue options and neither exactly matches my vision. Is there a downside to having a rule that sets a color pattern. Waits five minutes, sets another color pattern waits five minutes and starts the loop again? It would run from sunset-30 until midnight. Meaning the same rule would be active for about 7-8 hours. And strain on hub resources doing this? I'm just not sure why people don't do this vice using one of the community apps... Thanks!

2 Likes

Perhaps @kahn-hubitat can add what you're look for to Garden Hue

Adding to @rlithgow1 's comment, maybe list what you have already looked at and what they lacked or added to your options? My first thought is a circadian lighting option which I am struggling to remember who to attribute to, but have planned to look at for some time now...

1 Like

Should be no more strenuous on the hub than 5 minute polling which I believe the author of the Kasa app has tested 1 minute polling on a large number of devices without any serious issues.

2 Likes

Thanks @jtp10181. That's what I was thinking.

For those asking about my "coffee induced vision" :crazy_face:
I have five lights on the front of my house. Two are on either side of the front door. The post light comes next and then there are lights on either side of the garage. Like this:


Decorations in progress.

Here's the light pattern I would like:

Repeat from Sunset-30 until Midnight:

:green_circle: :green_circle: :green_circle: :green_circle: :green_circle:

:red_circle: :green_circle: :red_circle: :green_circle: :red_circle:

:green_circle: :red_circle: :green_circle: :red_circle: :green_circle:

:red_circle: :white_circle: :red_circle: :white_circle: :red_circle:

:white_circle: :red_circle: :white_circle: :red_circle: :white_circle:

:green_circle: :red_circle: :white_circle: :green_circle: :red_circle:

At Midnight:

:white_circle: :white_circle: :white_circle: :white_circle: :white_circle:

1 Like

Well, nobody told me it was a terrible idea, so I wrote this rule. I'll find out tonight if it works as I intended it to work:

OK, I JUST posted on this and am keenly watching the outcome of your:
"Repeat 35 times every 0:02:00"

Well, I think that each time through the sequence will take 12 minutes. 35 times 12 minutes should take exactly 7 hours. I suspect an extra 2 minutes at the end of each cycle will be it would run longer than that. Times like this I wish we had access to a real programming language and my trusty vi editor... Yes, I'm vi years old. :roll_eyes:

That's EXACTLY the thought process I was going through trying to be up with the times using the Repeat feature ...and then found myself thinking...."this is ridiculous, there's got to be a better way to loop this during the desired time window and just stop it when it ends".

I would make it repeat forever, then inside the loop put a condition IF time is > ### THEN end repeating actions.

EDIT: Couldn't you also use a required expressions to make it only trigger between the two dates?
Then for the While loop, use between two times. Seems like the most logical solution.

I can mock it up later if needed.

2 Likes

YES...much cleaner, got to this in the other thread discussion referenced above. Thanks.

EDIT: But, it would be nice if the time increment of repetition wasn't required. Would like to just put in this alone:
image

And while we're on the subject:

This IF statement will be evaluated and cause the Repeating to cease and execution to flow through to lines below the END-REP despite being withing the END-REP, right?

I have a shorter sequence set up like this... I'll post a screenshot later when i get home.

I think I asked this before and it was something along the lines of they require the time increment in there to safeguard against people making infinite loops with no delays that would run as fast as it can non-stop until the hub locks up. But yeah if you have your own delays built into the loop and a clear exit point it really is not needed and can be an annoyance. I think the loop will restart even if the current iteration has a delay and has not reached the end :frowning:

I have never actually tested that, but I would assume so.

Well, I tested the color part by changing the start time to noon. Works great. The question of whether it will run the they loop X times and gracefully terminate will be tested tonight when it goes off as written. Seems to be fine though. Not elegant, but really has any code been elegant since Fortran IV?

-that is a "white hair" certified statement if I ever heard one :rofl:
But there are a few left older than us that would say - "Assembly"

Back on topic.... I found the lights were still on this morning so clearly the repetition stopped before my final OFF was executed. Not good cause this configuration is solar+battery and when I put the next batch of lights on there's not enough juice to run past midnight. Anyway this is what put me back under the hood and back in here looking at the errors of my ways.

1 Like

Let's find out. I added a loop counter and put out a log entry giving the loop count. The time will be logged of course too.

p.s. I loved assembly. I programmed in C the longest and the results never failed to amaze me. Truly the bug implementation language.

1 Like

Here's my version. It's triggered by a smart plug that I use to control some outdoor holiday lights. When those lights turn on, this rule runs in a repeating loop until they turn off.

1 Like

OK. So, yes that was a bug. Didn't understand that it bounces you out of the while loop at the end of the timer. So I increased the "every" to 15 minutes. That gives the loop enough time to go through all the color changes. I'll be tuning this today.

Logs before change:

As you can see, it looped once a minute, even though all the actions hadn't been completed inside the while loop.

After the change it looped every 15 minutes:

Using this debug info I'll be able to get this tuned so it runs from sunset to about midnight cycling through patterns of red/green/white on those five lights. Didn't crash the hub or anything. And since Kasa lights are WiFi doesn't really affect either my Z-Wave or Zigbee meshes. I really like WiFi (Kasa) for seasonal use since they don't mess up the mesh when tucked away for 11 months.

Following up on your ideas here's what worked for me last night-


[Doing stuff here inside of repeat, ONs/OFFs, and WAITs that hold each lighting scheme for awhile]

[Doing final OFF assurance stuff here in case the Repeat loop didn't end/wrap up as I expect]

Notes: the "99 iterations" is just a bogus number to keep the thing running until the internal IF statement goes FALSE and bumps the processing out of the REPEAT. The "00:25:00" is roughly the amount of cumulative time my WAITs amount to for one "cycle" of lighting scheme renditions. In concept I really just wanted a DO LOOP that I kicked off and tested every iteration so perhaps I'm abusing the REPEAT in this use.

1 Like

Just to close the loop. Very happy with my color cycling rule. Here's the final in case anyone cares. :slight_smile:

Additionally, I created a Christmas Dashboard that shows the 5 lights in the order they appear on the front of the house. So, now I can watch the color pattern without having to actually go outside. :wink:

2 Likes

Download the Hubitat app