UsingCapture/Restore in Rules

HE C8
Trying to capture the current state of a RGB light in rule machine, run an action, then restore the rgb to the former values. The bulb turns red for the allotted time as directed, but the prior state value that we're "captured" are not returned to the device. The color stays red and not the starting color. Tried setting the value of the parameters needed to a local variable before changing the color, but could not find a way to restore those values from the variables (write the variable to the device). Ideas, help, suggestions?

Tried using a delay prior to the color change action, that didn't work!

Can you post the logs of the rule? What is the current state of the bulb trying to be captured? CT or Color? How was it previously set (via Hubitat or LIFX app)?

The current state parameters before rule action is initiated:

Log:

Current state after actions:

This remains the same if it is set by HE or LIFX app.
Just in case it makes a difference, this rule is initiated by me just running actions from the rule and not by a trigger.

Based on the state parameters before running the actions, the switch is off. In looking at your logs, the actions perform as normal. The ending state/parameters shows as correct. It's not going to change back to the CT because the switch is off. If it sent a CT command, the bulb would turn on, but the capture state was off.

Try the following...turn on the bulb so that it is in CT at 3000K all via Hubitat. Then remove the off command from your actions, so that it looks the following:

Capture
Delay
setColor
Delay
Restore

Does this work?

-That worked - BUT, the way I need it, if it is in the off state (commanded by HE) when triggered, then I want it to finish in the off state.
-What I'm setting up, is if it starts to rain, the light will come on, if it is off, show color, then go back off or on depending on where it started.

  • Is there a way I can get a variable to write its value to the device?

I understand. You rule would still work even if the bulb was off. Try it again with the bulb off and test your actions. The light should go to Red and then turn off. However, if you go to the device page, you'll see the Red and RGB mode for the bulb with the switch OFF. This is expected behavior. The last known color state before turning off the bulb was Red/RGB mode. That's why your device detail shows the way that it does. The bulb would need to change to be issued a setCT command in order to change the device detail page.

How do you normally turn on the bulb? What apps control the color of the bulb?

Just curious, what is CT your messages?
For this light, HE is the controller.
-So if the state of the light is off when the action starts will it return to off after the Restore action?
-And the what is the purpose of Capture if it doesn't return the device to the condition before the other actions?
-Is there documentation on Capture/Restore for rules? I could not find it.
-So do you know of a way to get a variable to write to a device for changing a parameter?

  • thanks

CT is short for Color Temperature. That’s what your bulb was set to (3000K).

Correct. If the light was off, it will go back to being off.

It’s working correctly. If the light is off, it goes back to off. If the light is on, it goes back to on and the previous color/color temperature. The device details show the last known setting, which is color in your case if the bulb was off.

You could absolutely write a variable to track the previous value that the bulb was set to. It won’t change the device details as that is only last known states.

That’s why I asked how do you turn on the bulb in every day settings. If you use something like Room Lighting, it can help with this situation. When it gets dark, what are you using to turn on the bulb? Room Lighting, Basic Rules, Rule Machine, etc…? This is the key to helping your situation.

So the way I have that light set up is:
I have a tempest weather station that reports outdoor lumens. Depending on the brightness defined by me, it sets a mode - day, night, etc. This then triggers the light(s) on/off, brightness level.

This particular light I want to setup, that if it rains, it's going to flash blue for 20 seconds. After which I want it to return to the state is was in before the rain trigger. If it doesn't, then the next time it turns on it will remain blue and not the color temp of 3000.

At one point, I got all the parameters that I wanted to save into a local variables. But then I could not figure out how in rule machine to put those values back, and I still can't in RM.

I'm using a combination of room lighting and rule machine to accomplish these tasks due to what options they offer.

Can you post your Room Lighting setup that contains this bulb? When Room Lighting activates, it should send a color temperature command to the bulb and put it to the color you want. You might see a very brief flash of red as the color changes, but it should be minor.

Sorry for the delayed response, got caught up in another project.
You were correct, long as HE turned the light on/off capture/restore worked. Using room lighting with its options of setting color, was also dead on. It will turn on in the color from the rule and very quickly change to the CT of 3000, if the rule started with light off, and terminate with light off.
Thanks, now all I need to do is find how to get a variable to change (write to) a device parameter as an Action, which is not an option in custom attributes.

Which device parameter?

Maybe 'parameter' is the wrong verbiage and I should have said 'custom commands' of a device e.g.:

What is your variable storing?

The variable used is the local variable and it saves one of the states of the device. It will be written back to the same command, parameter at a later time.

Can you be more specific? Is the variable storing color temperature, color, level, or something else. Can you post the rule that sets the variable?