Revert to original state once complete?


#1

1) Give a description of the problem
When a piston runs, I want to grab the current state of a light or switch, do X with a device, and then return to the current state

Example: Office lamp set to 80% warm white. Doorbell pressed, Office light flashes Red, Yellow Green, Office Light returns to 80% warm white

I can capture the attributes of a device and save it as a variable, but I’m not sure how to reapply it back to a device?


#2

Restore attributes from local state


#3

Oh wow, completely missed that.

Does 1 state work for multiple lights or does each need it’s own state?


#4

Capture/Restore will handle multiple lights and attributes in the same capture/restore sequence.
Example:


#5

What I mean is, would it work with different types of devices. As you can see below, I have White Bulbs and RGB Bulbs, capturing the attributes of all at once only have the level and switch. No colour or hue


#6

Looks like your second if is capturing state again? Is that intended or are you wanting to restore the state?

Secondly. Your second if statement is going to fire as soon as your first one completes, every time. The reason for this is your first one turns on the switch, Anderson’s then the state changes to on, thus firing the second one. If thst is intended, then the second if is really just redundancy


#7

Not sure if you can do that in one request or not (only have whitebulbs - dimmable or not). But, if not, you could do it with two variables, captures and restores.


#8

The second if isn’t finished :slight_smile:


#9

I’m demonstrating my magical powers of thread resurrection…

I don’t know what it is about me and Capture/Restore, but I don’t think I’ve ever been able to get it right.

I read through everything above, set my piston up accordingly, and it’s still not working.

Is Capture/Restore supposed to work with Philips Friends of Hue Iris Lights?


#10

:mage:


#11

I’m brand new to webCoRE, just set it up yesterday. My first piston was similar. If someone unlocks the door in our garage, blink the Hue light over our sink multiple times. I had zero success in getting the Capture/Restore to work so that it reverted the bulb back to the same level and color as it was prior. It almost seemed like it reverted to some random color each time. I ultimately used variables and set the color to soft white and it’s working correctly now.


#12

With Philips Hue lights (and some other brands) the restore works much better if you capture the Hue, Saturation, and Level… and only restore those 3 afterwards…

For some reason, restoring color or colorTemperature never returns to the exact color for me.


#13

I just tried using saturation and hue, worked perfectly!


#14

OK…I just changed it to use only Hue, Saturation, and Level as suggested by @WCmore but it’s still not working.

I’ve been using webCoRE for a long time now, and I have lots of things happening in all kinds of ways, but I assume there’s something I just don’t understand about Capture/Restore, and I’m probably not even using the feature properly.

Here is my green screenshot…

Any ideas why it’s not restoring the previous state of these two Philips ‘Friends of Hue’ Iris lights?


#15

Your mileage may vary, but I have found “Capture attributes” to be less than reliable…

I usually capture to variables like this:

temp

and restore HSL using those variables:

temp


#16

OK, thanks…but…what? lol

Man, I’m sorry…you lost me there. Sometimes I feel as dumb as a bag of rocks.

So, is this language something I need to go study somewhere in webCoRE-world?


#17

The first picture I posted shows capturing the 3 numbers into a variable… Once that is done, you can change/flash lights etc… When you are ready to have the piston return to the original color, the second picture is one line that restores to the previous color and brightness levels.


#18

@WCmore

Really sorry to keep pestering you on this, but here’s part of my problem…
The problem (for me) with looking at piston screenshots is the fact that I have no idea what was done to get there. So, I have no way of reproducing it unless/until I get some instruction on the steps needed.

Again, sorry.
Part of the problem is also the fact that I’ve been out of the scene for a while (since before July when I sold my house), and even if it is something that I ‘learned’ previously (I must have known how to do this for other things in some of my other Pistons in the past), I’m just drawing a blank.


#19

No problem at all! We all had to start somewhere. :sunglasses:


I guess I should probably mention…

I may not have the time for a detailed walkthru until after the holidays.
…or I could probably spit out a sample piston sooner…

The choice is yours.


#20

Aha. Well, I will gladly pay you Tuesday for a hamburger today lol

No, seriously though, if you’re willing to do a sample that I could import, at least I could get by with that in the meantime.

I think you know what I want to do, but basically, I just want to Capture HSL from a Friends of Hue Iris light, make the light do some things, and then restore HSL.