Here is what i would like to do… sounds easy but it isnt…
I would like a condition (lets call it a) to become true weekdays between 22.00 and 5.00, another weekends between 22.30 and 7.00 (using pleg schedule?)
The problem (as far as i understand so far) is that a pleg schedule will return a true just for the second when it is weekday and 22.00.
I have tested this, with a schedule with my times, and a condition to test it. Pleg will turn true at 22.00, that part works, but it will not turn it off at 5.00, although it looks as if i can set ‘on/off’ times in schedule
So to get round this problem, my idea is to have this condition, lets call it aOn, be a variable, which turns to 1 or true at 22.00, and turns to 0 at 5.00 the next morning. I know pleg can now handle variables, would that not be a way to have a condition become true (or 1) between set times ? then i could have another condition for other days of the week where i can have different times
LogicTimer provides properties for day-of-week and also weekend. You can use these to calculate the on and off times and then set timers appropriately. For example:
Set a schedule At0305 to run every day at 0305.
Set a trigger TimerEnded for LogicTimer has ended.
Set a property DOW for LogicTimer DOW.
Set a property Flag for LogicTimer Flag.
Conditions _StartTime (223600) + (((DOW == 1) or (DOW == 7)) * 1800) <Seconds: 22:00 on weekdays, 22:30 at weekends> _StopTime (53600) + (((DOW == 1) or (DOW == 7)) * 2 * 3600) <Seconds: 05:00 on weekdays, 07:00 at weekends> _StartTimer At0305 DoOn TimerEnded and (Flag eq “DoOn”) DoOff TimerEnded and (Flag eq “DoOff”)
Actions _StartTimer LogicTimer Start Timer newTimerCmd=A {(_StartTime)} F DoOn DoOn
LogicTimer Start Timer newTimerCmd=A {(_StopTime)} F DoOff DoOff
LogicTimer Set Flag newFlag=Finished
I am using DOW in preference to Weekend because, otherwise, you have to wait for the beginning or end of the next weekend to get the timer values to calculate the first time. DOW changes at 00:00 every day so you don’t have so long to wait.
Thanks very much, i think i need a little while to digest that. But will try tomorrow, too late for me now, have been programming other stuff on PLEG… But having had a quick look i think it makes sense. But dont think i would have had any chance to get there on my own
So really appreciate your effort !
I have tried your first solution as it looks the easiest. Thought i understood, but i think i am making a mistake somewhere. Looking at my status, in schedules, weekdayOn and Off seem to trigger at the time i have set, that seems to be working fine, but in conditions, it has not been triggered, although it should have ? I had this condition first like this: WDIsOn (WeekdayOff;WeekdayOn), then looked at your post again and added a space, so maybe it will trigger tonight but i am not sure that really was the problem ?
Thanks guys for your help. I think I understand this now.
Once I set the start/times in the schedule I need to “set” the state to reflect the actual time as compared to the state using the DoItNow button.
It seems to be working now.
Best Home Automation shopping experience. Shop at Ezlo!