Save switch states at first execution

Hi,

I currently have a light and blind scene setup which switches 5 dimmer lights off and closes 2 curtains when executed at the press of a button. What I would like to do now is use PLEG to remember the current state of all the lights (% on) as well as whether the curtains are open or closed at the time when I press the button and set these back to the old settings once another button is pressed.

Is this possible?

Thanks

Clever use of the “?” operator will get you what you want:

Some condition:

SAVEDSTATE TriggerToSaveState ? NewValue : SAVEDSTATE

Then you can use {(SAVEDSTATE)} in an action when you want to restore.

Thanks. I will try that

Hi Richard,

I’m having slight trouble implementing this.
Ideas is to have 2 triggers via IR. One triggers the initial movie state, the second the restore.

What I have created now is the following:

Triggers
Name Description
IRMovie IR code received
IRRestore IR code received

Device Properties
Name Device Name Device Variable
CorridorLight Corridor Light LoadLevelTarget
EntryLight Entry Light LoadLevelTarget

Conditions
Name Repeat Expression
Trigger_Movie No IRMovie
Restore No IRRestore

Actions

Actions for Condition: Trigger_Movie
Device Actions:
Immediate
Device Action Arguments
Entry Light SetLoadLevelTarget newLoadlevelTarget=0
Corridor Light SetLoadLevelTarget newLoadlevelTarget=0

With this the lights go off once IRMovie receives the respective code. What I tried but can not get to work is:

[ul][li]How do I now save the LoadLevelTarget = state before the Trigger_Movie action for both lights individually?[/li]
[li]How do I pass the individual saved LoadLevelTarget (could be different for each light) to the action task once IRRestore is triggered to set the lights back to the previous dim level or on/off state? [/li][/ul]

Thanks for the help.

Any suggestions?
Thanks a lot

Sent from my Nexus 10 using Tapatalk