I want to turn on a light at sunset and then turn it off at 12pm.
I am doing this now with 2 scenes, but it would be nice to use just one scene.
Is this possible?
In PLEG you do do it with 1 Schedule and 2 Conditions and 2 Actions.
If you were really good you could do this with 1 Schedule, NO coditions, and 2 Actions … requires you to attach Actions to an input using the Graph Editor.
Or, if the light didn’t need to turn off exactly at midnight, you could add a delayed action to the scene to turn the same light off about 5 or 6 hours later. I’ve got scenes that turn on a set of lights based on a switch being activated, then the same set of lights turn off 15 minutes later. Assuming Vera can handle a 5-6 hour delay in a scene, that should do the trick.
However, as we get further into the solar cycle, the light may turn off too late for you
The problem with putting a delay in the Scene action is that if Vera restarts … then the delayed action will NEVER happen.
PLEG does handle this correctly.
Lua code could calculate the needed time delay to make it turn off at midnight, but as noted this has the drawback of being missed if the Vera restarts.
But why do you want to do this in 1 scene? Is there some issue with 2 scenes? You could use PLEG. Or you can do this with 1 “workflow” in AltUI.
Can you shed some light on what would cause Vera to restart (aside from out and out power failures)? How does PLEG overcome this? But this topic might have been covered elsewhere, could you point me to that discussion? This could explain some things…
It is possible without PLEG, although PLEG will give you probably less hassle.
You have to make scene with lua code setting the light on if the time is between sunset and 12 pm, and off if it is outside this period
Then you have to add command to run this scene in case of restart and a timer which will run this scene in every certain period of time.
If the conditions will be met, the scene will turn lights on. If not, then the scene will turn them off
PLEG is retaining state information so it can get back to where it should be if there is a restart. The call_timer is lost over a restart, so anything you had scheduled with it won’t happen. I am a bit curious as to how well PLEG tries to get realigned. Does it try to replay things that were missed in order or with appropriate time gaps? I.e., if 2 events were missed due to the restart, but does PLEG fire them both immediately after the restart? Guess we should ask in the PLEG forum.
As to your first question, I also thought Vera wouldn’t restart, and it’s unclear to me how common it really is, but apparently the Vera does restart for all sorts of reasons and if you are counting on something really happening (maybe turning off a water valve), then you can have a nasty surprise with the call_timer. For that matter, if you really, really need something to happen, I’d think about a secondary mechanism of some sort. Vera can be pretty good, but’s not the 5 9’s (99.999%) reliability. Then again, I don’t think I am 99.999% reliable either.