SmartApp to automatically change bulb between colors

Is there an app that allows to create a schedule that would change a RGB bulb between colors at set time intervals? Such as for the holiday season changing the bulb between green and red every 10 minutes?

I guess I would see the configuration as selecting the colors and then setting the schedule and then it can be enabled and disabled with events or a daily schedule

You can do this with Rule Machine.

Check out this post where I did just what you’re describing:

2 Likes

Great, I will give this a try.

Thank you

What are valid values for color value? I’m used to #ff0000 as red. The input only allows numeric values.

0-100 are valid values. Most RGB bulbs operate using Hue/Sat to set color instead of the hex representation of RGB, so that’s the format used in most device handlers. The color value in Rule Machine represents the Hue value (and assumes 100 Sat for full colors).

I believe Rule Machine also allows for Red and Green to be selected directly instead of custom color values, so that might be easier. Alternatively, you could find the colors you want with your bulb, then record the Hue values at those colors and use them.

1 Like

Tried using the predefined color names, but didn’t work.
I’ve got an AEONLabs ZW098-A52 bulb. Using the app to set the color to green, here are the values I get from the devices details in the IDE.

switch: on
level: 99 %
hue: 32.48366013071895
saturation: 100
color: #0dff00

Does that look right for the Hue value, or is the bulb doing something non-standard

It’s right. You can use either 32 or 33 for the color value in Rule Machine and it should give you something very close to that shade of green.

You have the one bulb that works a bit differently for color since it’s zwave, so the Aeon bulb calculates the Hue value in the device handler which is why it’s not an integer. Most color bulbs are zigbee.

With the Rule Machine, I’m trying to figure out how to have this run only when the light is on.
Or does that not really matter? Let it continue changing the color values even though the light is off?

Edit - found a solution. I created another virtual on off tile(vSwitch B). I created a rule that will turn vSwitch B off, when the light is turned on. Then turns vSwitch B on when the light is off. Finally on the original rule, under “Switch to disable rule when ON”, added vSwitch B. so when the Light is on, vSwitch B is off, and the color changing rule is enabled and runs.

1 Like

Thanks for sharing this Bruce. I’m finding your app to be super powerful!

I’m, unfortunately, not well versed on virtual switches. Can the “Virtual Color Control” device be used to enable this scenario for more than 2 devices? (Not sure what “Virtual Color Control” really does and if Rule Machine even supports it)

Here is the FAQ about virtual switches:

You just need a simple virtual switch for this, nothing about “Color Control”.

I totally get you only need a Virtual On/Off switch in order to switch between 2 colors, but what if you wanted to loop between 3 devices?

Things just get more complicated. You probably need 2 switches and 2 rules. Not sure, haven’t worked it out. Certainly doable.

Do you want all three devices to be the same color?

Nope, the problem is getting 1 light strip to loop between 3 colors. With Bruce’s original post/solution only 2 colors are supported. Adding a 2nd virtual switch does add additional cases that MAY allow for a solution but it does become more complicated.

Ya, it’s going to get geometrically more complicated! Problem for the student: How many rules and switches does it take to have n colors? :grinning:

2 Likes

Or, it could be stupid simple:

Create a virtual dimmer.

One trigger per color: trigger is dimmer level = [1…n]; action is change to color i, set dimmer level to next value, delay for x minutes.

The last one sets the dimmer level to 1 instead of next value.

Start the whole thing up by setting the dimmer to one of the values, then the triggers would take over. Uses the virtual dimmer as a counter/trigger. Try this @EeriePhen0men0n!

2 Likes

Great idea! I’ll try this when I get home later :slight_smile:

Brilliant!!!

20 char

Well, guess what, it doesn’t work as intended. I believe there are race conditions within the cloud. Back to the drawing board…

I have a modified version of the above that works:

virtual dimmer
virtual momentary button

One trigger per color: trigger is momentary on; conditions as needed to separate dimmer levels; rule as needed for same (e.g. x >10 AND x < 20); actions for true are delayed turn on of momentary button in 1 minute, set new color, set new dim level.

Each trigger will respond to the button push, but only the one with the right dimmer level will do anything. The one that runs changes the dimmer level, sets the color, and pushes the button 1 minute later.

You can push the virtual button in the mobile app to change the color whenever you want, but not too fast without odd behavior.