Return to previous state question

Hi All,

The backstory:
I’m a newbie… I’m a very recent Vera to ST convert and still in the learning curve stage on this side. Question is this… I have a simple Smart Lighting Automation that lights two Philips Hue Iris lights red when my rear slider door is opened. The Automation turns the lights Off when the door is closed. 99.9% of the time this works exactly as intended. However, I also use the same Hue Iris lights as decorative/ambient lighting in the home - particularly around holidays.

The question:
How do I program an automation that will turn my Hue Iris lights red when the rear slider is opened and then back to their previous state (currently pink in the evenings for Valentine’s Day) when the door is closed. Bear in mind, if it is Christmas time these lights might be red & green, or if no holiday they may just be off so “Returning to Previous State” is the prime directive.


Is this through a smartapp you coded, or an existing app?

If you coded it, you just need to store the existing state at the beginning of your “open” method and then in your “close” method set the color to that state

ST Docs - Storing Data

Trying to accomplish via smartapp (Smart Lighting, Rule Machine, suggestion?).

@bravenel, can this be possibly done in Rule Machine? I was intrigued by this when I was playing with Smart Home Monitor. I have a few Smartsense moisture sensors. I set the leak detector in SMH to turn ON all the Philips Hue Color and Bloom lights and set them to red. Works great when the sensor is triggered. I was surprised to see that all the lights returned to their previous states and colors when I cleared the notification in SMH. Now I want to use the Bloom to set the color based on different events, and then return them to their previous states after the event is cleared.

I’ve been thinking about it. It can’t be done as of now, but … stay tuned.

1 Like

@bravenel, the hues are miserable when trying to capture their current state, if they were set from st, then all good, if they were set via another means st likely won’t have the actual state of the device…
If you desire to obtain an epic headache in state map manipulation, have a look at superState… yea, I would write it differently today…

OK, I bite. How about you write it!?

Then I can stop thinking about it and not doing anything.

Two actions: capture dimmers/switches/whatever-device/color-bulbs, as selected; restore same

What the heck would you do with your self then?

Return to a previous state?

Or, some random new state… (keeping with the pattern established by ST)?

1 Like

Which, was what, ahhh, let’s see, oh yea, writing apps for st!
I would seriously like to man, I just can’t change gears at the moment!

1 Like

OK, ok, some previous state to that…

What if the hues are totally controlled by ST?
I do have some hues that are controlled by the dimmer switch. But the Hue Bloom, which is what I am using for notification, is totally controlled by ST or Rule Machine.

saving state works fine in those cases, the HUE dimmer switch however, is not one of those cases…

I posted an update that includes Capture and Restore for switches:

1 Like

Playing with it right now. Based on the description, I did not think it saved color information just the ON/OFF and Dimmer state of the switch.

That is correct. It does not save color values. I may do that next…

LMAO, that didn’t take long!

superState says: sad puppy face, superState, sad puppy face… :disappointed_relieved:

1 Like

So… back to the Original Post…
I was looking to do the same thing.
Have 1 light in each room turn red when the front door opens, return to previous state when closed.

Now that rule machine does not exist (because some whiny man-child took his toys and went home), how would i do this?..


Capture State to Local Store
Restore State from Local Store

1 Like

That’s what I do.