Hi all, I read through several articles and none of them fit my rather basic problem. I bought the OSRAM Lightify LED strip and made a very basic rule machine automation. When movement is detected, capture the state of the LED strip, cycle through ROYGBV, restore the state.
When the LED is on, the capture works as expected. The color changes and goes back to its original on state.
Starting from off is the problem. I turn the LED on to white, then turn it off. Then I run my automation, the colors cycle, I restore the state, and the color stays at the last color, violet. When I look at my dashboard at the color, it indeed says that the color was the last cycled color, not the white I intended to restore.
Am I missing something? I’d prefer not to make it a scene since it’s just a one off light strip.
How are you controlling them to begin with? Are you using the native Generic Zigbee RGBW light driver or a custom driver? When the strip is "off" is that what is displayed in the Edit Device page as well?
Native Generic Zigbee RGBW driver. With that driver I can set any color, turn on/off, control from google home.
Yes, Edit Device shows that the device is off. I can watch the light come on, change colors, and turn off. The only thing capture isn't capturing is the color from when it was off.
Wait... So, the light turns off? Then it's restoring to its previous state. It can't restore the color setting that was set while it was off and still turn off. That's not how it works. If the driver were to issue the color setting to the bulb, the bulb would turn on to that color. Just like if you were to issue a setLevel command. This is true of all devices. It's going to restore the switch state if the device was off.
No. After the color changes, I run a restore. The on/off status returns to captured state, the color does not.
When looking at the dashboard or edit device, I can see what color the light was when it turned off. There are two situations:
- The light is on, and runs the rule. Capture, change color, restore. It returns the light to its previous color. No problems here.
- The light is off, and runs the rule. The restore turns the light back off, but does not set the light back to the color from when it was off. The capture knows the light was off.
The color of the LED strip and the brightness level is stored while the light is off, I can see that in Edit Device. The capture is supposed to capture the brightness, color, hue, warmth. Everything. Restore should set everything back, but it's only restoring the brightness and on/off status.
And I am saying that Restore is NOT going to ever restore the color attribute when the capture was on a device that was off. It is designed to only restore the switch state if the switch was off. You can't do it any other way unless you want light flashing odd colors.
How would it do that? You can't set the color attribute without turning the device on. So, what would happen if it worked the way you wanted to, the color would change from whatever you modified it to to the previous setting in the driver and then turn off. That is not what is intended by the restore function. If you want it to do that you would have to perform your own sequence. You could do this...if if the device is on, capture the switch state in a global variable, then turn the light on then capture it, then set it the way you want. After you were done you would restore it and then turn it off. But the capture restore is working correctly. It is capturing everything its supposed to and restoring what it is supposed to.
That doesn’t make sense though... Let’s say I turned the light on, changed it to green at 58% brightness, then turned it off. With your logic, when I turned the light back on, since off state is not preserved, the light would turn on to white at 100%.
How does the light know to turn back to a certain color and a certain brightness without the rule The Hubitat is a computer with memory, the state of devices is preserved.
I can change the color while the LED is off, and it’ll immediately turn on to that color. I can’t have it stay off, but it doesn’t flash from the previous color to my picked color to the color I chose.
No, what I'm saying is, the only way to turn the setting back to white is turn the light on to white. If the restore tried to restore the color state, the light would come on white.
How then will I turn the light back on to what it was before the rule ran if the light was off? A global variable only has 4 data types.
You should never rely on the devices stored settings to turn it back on. What are you using to turn the bulb back on? A pico via Button Controller? That should be the place to set the setting of the bulb to what you want them to be. You don't just "Turn on" a bulb, you have to set it the way you want it to be. How did you set the bulb to those specific settings in the first place?