I am new to both home automation and my Vera lite. Is it possible to create a scene that has multiple device actions? I.E. can I have a single scene that turns my Christmas lights on at sunset, and off at sunrise? Or do I have to create one scene to have the lights turn on at sunset, and then create a second scene to turn off at sunrise? Essentially the result will be the same but I am hoping to consolidate my scene listing. I’m sure I’m missing something, but I do not see how it is possible in Vera to create a trigger event for sunset, add an action turn on my Christmas lights device, then add a second trigger event, and add an action to turn off my christmas lights. Am I missing something?
You’re expected to make two scenes.
You can have multiple triggers that invoke a scene. However the problem here is that the scene either turns on the Christmas lights, or the scene turns them off. You cannot do both, using the standard Vera scene controls (time delayed actions notwithstanding). You could write LUA code to accomplish this using only one scene, but I think it would be just easier to have two scenes.
Also, you do not want to have long delayed time actions in a scene. If Vera reboots before the delayed action occurs, the delayed action will be lost. So it is recommended to have two scheduled scenes rather than one scene with a long delayed action.
Got it. Thanks guys!
You can do this with in PLEG with one Schedule, One Condition, and One Action:
Schedule:
LightSchedule - On at sunset off at Sunrise
Condition:
SetLight LightSchedule or !LightSchedule
Action:
SetLight Initially set the light on, then go to the advanced tab and change the value from “1” to:
{(LightSchedule ? 1 : 0)}
Set repeats on SetLight this way the actions get fired when the Schedule becomes true and when it becomes false.
Hi Richard,
I’m trying to utilize a single schedule, condition, and action to turn a light on and off as you describe below but there are 2 things I am not clear on:
-
If a condition only fires when it becomes true, how would you get the SetLight condition to fire at sunrise to turn the light off?
-
In the PLEG advanced tab, what field and where do you insert the {(SetLight ? “1” : “0”)}?
I appreciate any insight.
Thanks!
Oops … I updated my entry above.
Hi Richard,
Thanks for the reply. I tried your suggestion to change the arguments to my condition to LightSchedule or !LightSchedule but this did not work (neither ON or OFF actions happened). After thinking about this more, I think I understand why: LightSchedule or !LightSchedule is ALWAYS true so it never fires. Do you agree?
Once I solve this mystery, I still need to determine how you put the {(SetLight ? “1” : “0”)} in the advanced tab. Whenever I do that and save, Vera truncates my entry in the advanced field to {(SetLight ?
Hopefully you have a few more ideas on this. Thanks for the help!
Did you set the “REPEATS” for the condition ?
Also leave out the four "
I have a bug in the JavaScript code:
{(SetLight ? 1 : 0)}
Thanks again for the help. I am getting closer. Setting repeats on the condition made it fire so the light turns on as expected… But no luck getting it to turn off even using the updated {(SetLight ? 1 : 0)} JavaScript code. What else could I be missing?
I’m testing this on an ON/OFF switch. If I can make this work, I want to extend this to a dimmer switch next, but since my condition evaluates to a 1 or 0, I’m not sure how to get there yet.
Change the Action value from:
{(SetLight ? 1 : 0)}
to:
{(LightSchedule ? 1 : 0)}
Gentlemen,
Thank you very much for the help. It has been a few weeks but I was finally able to try this tonight at it worked! The action above works for an ON/OFF switch. If anybody wants to use this for a dimmer switch, use the following action instead:
{(LightSchedule ? 100 : 0)}