Rule to change and restore state?

Weird over the years I've not needed this yet. I want to use my new smart led strip to notify of various events, but the strip is also now a key element of lighting in the room. I want a trigger to result in changes to the device, followed by the device doing whatever it was doing already. If it was on 45% brightness and 3500k color temperature, to revert, if it was off, do the thing and go back to off.

What do, please?

To do this in RM, setup a variable per parameter that you want to store.

Step 1 will be to save all your parameters each to a variable
Step 2 will be to make your changes
Step 3 will be to set your strip to the values stored in the variables

Let me know if you would like me to provide an example.

Check out Capture and Restore actions in a rule. Capture the device's state, then change it to whatever. When done, Restore will put it back the way it was.

1 Like

Note that if you capture a bulb/light that is off and then change something like color or color temperature, RM will only restore the "off" state--so it's correct in that sense but might give surprising results the next time you turn the light on if that automation just uses an "On" instead of, say, a "Set Color Temperature" to put things how you really want them.

If that is a problem for you, take a look at this post I wrote a while back that has a workaround--basically, saving the on/off state yourself first, then turning it on and capturing the states before changing them to what you want, then restoring the states and turning the light back off if it was off to start:

If that is not actually a concern for you, carry on. Just something to keep in mind otherwise!

2 Likes

Example would be nice! I'm using an rbgw dimmer, so color, on/off and dimmer value would be at play for my use

Have you looked at the link provided by @bertabcd1234? The screenshot provided by that post is an excellent option. (Better than the one I proposed in my opinion...)