little PLEG programming problem

I have a schedule in my pleg, which is HeatWDOn or HeatWEOn, and HeatWDOff or HeatWEOff, these give me the times for when i want my heating on or off. I have created to triggers, Away and Vacation. When either of them are turned on, heating should be off. So far this works. What i would like now, when i turn Away or Vacation off again, my heating will stay off until the next HeatWDOn or HeatWEOn time. Is there a way to make the change from Away On to Away off turn the heating on, and only when it is before HeatWDOff or HeatWEOff…

I have created 3 scenes, which set the thermostats temperature, i have not linked them to actions yet as i am still developing this part of my HVAC PLEG

This is what i have:

Triggers

HeatingON MultiSwitch Switch 4 is turned on
Away MultiSwitch Switch 7 is turned on
Vacation MultiSwitch Switch 8 is turned on

Schedules

HeatWDOn Weekly 04:50:00 1,2,3,4,5
HeatWDOff Weekly 22:20:00 1,2,3,4,5
HeatWEOn Weekly 06:45:00 6,7
HeatWEOff Weekly 23:00:00 6,7

Conditions

HeatON (HeatWDOn or HeatWEOn) and HeatingON
HeatOff HeatWDOff or HeatWEOff or (NOT HeatingON) or Away or Vacation

I do mine using sequence expressions. Something like:

HeatON ((HeatWDOff; HeatWDOn) or (HeatWEOff; HeatWEOn)) and HeatingON and (not Away)
HeatOff (HeatWDOn; HeatWDOff) or (HeatWEOn; HeatWEOff) or (NOT HeatingON) or Away or Vacation

The sequence expressions in HeatOn will be true between the on and off times so if HeatingON is on and Away turns off, the condition will fire. Reversing the order of the on and off times in HeatOff makes the sequences true between the off and on times.

brilliant, so easy… dont know why i did not manage. I think i’ll use that logic on another part of my PLEG where i had a similar problem

Something very strange happening. I copied and pasted your formula into my PLEG. Everything worked fine. Played around with a few other (unrelated) things, tried again - and it does not work any more, i did not change anything related to this condition. I changed it to HeatOff Away, to see if pressing Away turns the Heating off, and it does. So added (copied pasted) your condition in again, it works. Changed a few other things, unrelated again, and it stopped working. Unfortunately with my browser here at work i have no access to status report of PLEG, but somehow the condition for HeatOff must be false although Away is true

??? ??? ???

Just ‘repaired’ it again, by deleting everything except the Away from the HeatOff condition, and then re-pasting the condition in. But it only works once. So i press Away once, it turns the heating off, then press it again, it turns the heating back on. Press it again, nothing happens.

No idea why.

With the temporary lack of a status report, i have created the following condition, which in my opinion should be true at the moment

Schedules

HeatWDOn Weekly 04:50:00 1,2,3,4,5
HeatWDOff Weekly 22:20:00 1,2,3,4,5

Conditions

_HeatOntest (HeatWDOff; HeatWDOn) i also tried
HeatOntest (HeatWDOff; HeatWDOn)

linked that to an action to see if it activates the action - it doesnt.

Why are you without Status ?
The status command works for me remotely.
If that is not working … chances are there is something seriously wrong.
Please send me the output from:
http://Your.IP.Address:3480/data_request?id=user_data

Do not post it … You may want to edit out any passwords from cameras etc.
You can email it to me.

I assumed you defined these before 4:50:00 today.

In this scenario … the condition variable will toggle between true and false twice a day.
There is no need for the condition variable to be preceded by an underscore.

I think it is my browser here at work (no status). It has never worked here, but it is IE8 with serious limitations, which probably explains that. Makes my life very difficult doing programming my Vera from work…

I will send you the data within the next 2 to 3 hours when i’m back home.

And it is 16:45 local time (so within (HeatWDOff; HeatWDOn))

I have just posted the data dump. It is 19:40 local time, and heer is the PLEG status:

Triggers
Name Description Last Trigger State
BedroomHot RFX Temp Master Bed temperature goes above 23 degrees 2013-08-23 19:01:46.334 true
BedroomVeryhot RFX Temp Master Bed temperature goes above 26 degrees 0 false
BedroomCold RFX Temp Master Bed temperature goes below 21 degrees 2013-08-22 22:35:52.400 false
OutsideHot RFX Temp Outside temperature goes above 19 degrees 2013-08-23 19:31:30.012 true
AC_Auto_ON MultiSwitch Switch 3 is turned on 2013-08-23 15:22:25.997 true
LWindowOpen Window Right is tripped 2013-08-23 01:50:51.690 false
RWindowOpen Window Left is tripped 2013-08-22 23:00:20.552 false
LWindowOpenArmed Window Right armed is tripped 0 false
RWindowOpenArmed Window Left armed is tripped 0 false
HeatingON MultiSwitch Switch 4 is turned on 2013-08-23 15:22:26.057 true
HotWaterON MultiSwitch Switch 5 is turned on 2013-08-23 15:22:26.155 true
AC_Test Test Multi Switch Switch 3 is turned on 2013-08-22 21:30:01.281 false
Away MultiSwitch Switch 7 is turned on 2013-08-23 19:34:29.323 true
Vacation MultiSwitch Switch 8 is turned on 2013-08-23 15:22:21.128 false
Schedules
Name Type Time Days Last Schedule
WeekdayOn1 Weekly 21:30:00 1,2,3,4,5 2013-08-22 21:30:00.102
WeekdayOff1 Weekly 05:00:00 1,2,3,4,5,6 2013-08-23 05:00:00.106
WeekendOn1 Weekly 22:00:00 6,7 2013-08-18 21:45:00.101
WeekendOff1 Weekly 07:20:00 1,6,7 2013-08-18 07:20:00.104
check_Window Weekly 21:20:00 1,2,3,4,5,6,7 2013-08-22 21:20:00.100
HWOnWD1 Weekly 04:45:00 1,2,3,4,5 2013-08-23 04:45:00.102
HWOffWD1 Weekly 05:35:00 1,2,3,4,5 2013-08-23 05:35:00.101
HWOnWE1 Weekly 05:50:00 6,7 0
HWOffWE1 Weekly 06:40:00 6,7 0
HWOn1 Weekly 16:30:00 1,2,3,4,5,6,7 2013-08-23 16:30:00.105
HWOff1 Weekly 16:50:00 1,2,3,4,5,6,7 2013-08-23 16:50:00.101
HeatWDOn Weekly 04:50:00 1,2,3,4,5 2013-08-23 04:50:00.106
HeatWDOff Weekly 22:20:00 1,2,3,4,5 2013-08-22 22:20:00.101
HeatWEOn Weekly 06:45:00 6,7 0
HeatWEOff Weekly 23:00:00 6,7 0
Device Properties
Name Device Name Device Variable Last Change Value
DOW DOW 2013-08-23 00:00:00.101 6
WE Weekend 2013-08-19 00:00:00.136 0
Conditions
Name Expression Last True State
Window BedroomHot and AC_Auto_ON and (ACWDIsOn or ACWEIsOn) and (NOT OutsideHot) and check_Window and NOT WindowOpen and NOT Vacation 2013-08-18 07:07:23.653 false
CloseWindow BedroomHot and AC_Auto_ON and WindowOpen and check_Window and OutsideHot and NOT Vacation 2013-08-21 21:20:00.158 false
WindowOpen LWindowOpen or RWindowOpen 2013-08-22 23:00:13.581 false
ACmanualHigh BedroomVeryHot and (21:42:00;NOW) and NOT Vacation 0 false
ACWDIsOn (WeekdayOff1; WeekdayOn1) and WE==0 2013-08-22 21:30:00.115 false
ACWEIsOn (WeekendOff1; WeekendOn1) and WE==1 0 false
ACWDIsOff (WeekdayOn1; WeekdayOff1) 2013-08-23 05:00:00.134 true
ACWEIsOff (WeekendOn1; WeekendOff1) 0 false
AC_On BedroomHot and AC_Auto_ON and (ACWDIsOn or ACWEIsOn) and NOT WindowOpen 2013-08-22 21:30:00.190 false
AC_Off (BedroomCold and (AC_On; Now > 15:00)) or ACWDIsOff or ACWEIsOff or (NOT AC_Auto_ON) or WindowOpen 2013-08-22 23:00:13.597 true
HWOn (HWOnWD1 or HWOnWE1 or HWOn1) and HotWaterON 2013-08-23 16:30:00.133 false
HWOff (HWOffWD1 or HWOffWE1 or HWOff1) or (NOT HotWaterON) 2013-08-23 16:50:00.133 false
HeatON ((HeatWDOff; HeatWDOn) or (HeatWEOff; HeatWEOn)) and HeatingON and (NOT Away) 2013-08-23 19:34:26.770 false
HeatOff (HeatWDOn; HeatWDOff) or (HeatWEOn; HeatWEOff) or (NOT HeatingON) or Away 2013-08-23 15:17:09.847 true
_ACtestON WeekdayOn1 or WeekendOn1 2013-08-22 21:30:01.276 false
_ACtestOFF WeekdayOff1 or WeekendOff1 2013-08-23 05:00:00.159 false
AC_On_test BedroomHot and AC_Auto_ON and _ACtestON and NOT WindowOpen 0 false
AC_Off_test (BedroomCold and (AC_On_test; Now > 15:00)) or _ACtestOFF or (NOT AC_Auto_ON) or WindowOpen 2013-08-23 15:22:20.995 false
AC_On_test2 BedroomHot and AC_Auto_ON and AC_Test and NOT WindowOpen 2013-08-22 21:30:01.323 false
HeatOntest (HeatWDOff; HeatWDOn) 0 false
Htest Away 2013-08-23 19:34:29.372 true
Actions
Actions for Condition: AC_Off
Device Action Arguments
Air Condition SetModeTarget NewModeTarget=Off
Actions for Condition: Window
Device Action Arguments
Push Notification SendProwlNotification Event=Open Bedroom Description=Window Priority=1 URL=
HVAC RunScene SceneNameOrNumber=59
Actions for Condition: ACmanualHigh
Device Action Arguments
Push Notification SendProwlNotification Event=Turn On AC High Description=Bedroom very hot Priority=1 URL=
HVAC RunScene SceneNameOrNumber=64
Actions for Condition: AC_On
Device Action Arguments
Air Condition SetModeTarget NewModeTarget=CoolOn
Push Notification SendProwlNotification Event=AC Description=AC is ON Priority=1 URL=
Actions for Condition: HWOn
Device Action Arguments
Test Multi Switch SetStatus1 newStatus1=1
Hot Water SetModeTarget NewModeTarget=HeatOn
Actions for Condition: HWOff
Device Action Arguments
Test Multi Switch SetStatus1 newStatus1=0
Hot Water SetModeTarget NewModeTarget=Off
Actions for Condition: AC_On_test
Device Action Arguments
Test Multi Switch SetStatus4 newStatus4=1
Actions for Condition: AC_Off_test
Device Action Arguments
Test Multi Switch SetStatus4 newStatus4=0
Actions for Condition: CloseWindow
Device Action Arguments
Push Notification SendProwlNotification Event=test Description=close window Priority= URL=
HVAC RunScene SceneNameOrNumber=71
Actions for Condition: HeatON
Device Action Arguments
Test Multi Switch SetStatus2 newStatus2=1
HVAC RunScene SceneNameOrNumber=74
Actions for Condition: HeatOff
Device Action Arguments
Test Multi Switch SetStatus2 newStatus2=0
HVAC RunScene SceneNameOrNumber=73
Test Multi Switch SetStatus7 newStatus7=-1
Actions for Condition: _ACtestON
Device Action Arguments
Test Multi Switch SetStatus3 newStatus3=1
Actions for Condition: _ACtestOFF
Device Action Arguments
Test Multi Switch SetStatus3 newStatus3=0
Actions for Condition: Htest
Device Action Arguments
Test Multi Switch SetStatus5 newStatus5=-1
Actions for Condition: HeatOntest
Device Action Arguments
Test Multi Switch SetStatus8 newStatus8=-1

When you first create condition statements using sequences, you can get unexpected results - particularly if they rely on newly-created schedules. My practice is to temporarily set the schedules to times in the near future (in the correct chronological order) and let them cycle to establish timestamps. Then I set them to the times I really want.

I’ll change them and see what happens. Cant hurt to try it… Have a few months before i really need it… the british summer should last another month or so

;D

I have tried your suggestion [quote=“RexBeckett, post:10, topic:176610”]When you first create condition statements using sequences, you can get unexpected results - particularly if they rely on newly-created schedules. My practice is to temporarily set the schedules to times in the near future (in the correct chronological order) and let them cycle to establish timestamps. Then I set them to the times I really want.[/quote]

In this case it did not help, but I think its a good idea

I am not sure if there is a problem with the logic, or if RichardTSchaefer has found a bug. I have been triying a few things in the meantime. But my HeatOff does not seem to switch off. I have changed the schedule a few times so that it had a full cycle, but last trigger was 2 days ago, and it had a few times in between where it should have been off.

Schedules
HeatWDOn Weekly 04:45:00 1,2,3,4,5 2013-08-23 22:00:00.101
HeatWDOff Weekly 22:20:00 1,2,3,4,5 2013-08-23 22:20:00.101
HeatWEOn Weekly 14:21:00 6,7 2013-08-25 14:21:00.101
HeatWEOff Weekly 14:33:00 6,7 2013-08-25 14:33:00.101

Conditions
HeatON ((HeatWDOff; HeatWDOn) or (HeatWEOff; HeatWEOn)) and HeatingON and (NOT Away) 2013-08-25 14:21:00.137 false
HeatOff (HeatWDOn; HeatWDOff) or (HeatWEOn; HeatWEOff) or (NOT HeatingON) or Away 2013-08-23 15:17:09.847 true
HeatOntest (HeatWDOff; HeatWDOn) 2013-08-23 22:00:00.158 false
HeatOntest2 (HeatWEOff; HeatWEOn) 2013-08-25 14:21:00.175 false
HeatOntest3 (HeatWEOn; HeatWEOff) 2013-08-25 14:33:00.140 true
HeatOntest4 (HeatWDOn; HeatWDOff) 0 false
Htest Away 2013-08-25 12:52:11.682 false

This is what i am using for my AC logic, it seems to work so far, but looks way more complicated and i wanted to simplyfy it similar to the heating logic

Schedules
WeekdayOn1 Weekly 21:30:00 1,2,3,4,5 2013-08-23 21:30:00.104
WeekdayOff1 Weekly 05:00:00 1,2,3,4,5,6 2013-08-24 05:00:00.101
WeekendOn1 Weekly 22:00:00 6,7 2013-08-24 22:00:00.101
WeekendOff1 Weekly 07:20:00 1,6,7 2013-08-25 07:20:00.101

Device Properties
WE Weekend 2013-08-24 00:00:00.192 1

Conditions
ACWDIsOn (WeekdayOff1; WeekdayOn1) and WE==0 2013-08-23 21:30:00.120 false
ACWEIsOn (WeekendOff1; WeekendOn1) and WE==1 2013-08-24 22:00:00.169 false
ACWDIsOff (WeekdayOn1; WeekdayOff1) 2013-08-24 05:00:00.118 true
ACWEIsOff (WeekendOn1; WeekendOff1) 2013-08-25 07:20:00.142 true
AC_On BedroomHot and AC_Auto_ON and (ACWDIsOn or ACWEIsOn) and NOT WindowOpen 2013-08-24 01:20:04.056 false
AC_Off (BedroomCold and (AC_On; Now > 15:00)) or ACWDIsOff or ACWEIsOff or (NOT AC_Auto_ON) or WindowOpen 2013-08-24 02:18:06.692 true

I think you need to change HeatOff to _HeatOff so it fires when one of the terms becomes true even if the condition was already true.

I tried that but it did not work. But i think i found a solution which works:

HeatON ((HeatWDOff; HeatWDOn) or (HeatWEOff; HeatWEOn)) and HeatingON and (NOT Away) 2013-08-26 09:06:16.985 false
HeatOff ((HeatWDOn; HeatWDOff) and (HeatWEOn; HeatWEOff)) or (NOT HeatingON) or Away 2013-08-26 09:10:00.138 true

the problem was that HeatOff stayed true, so the HeatON did not do anything when that became true. I have tested the above a few times now, and it seems to work fine, even the Away button turns the heating off, when i unclick Away the heating comes on again. So that part of my logic problem is solved.
But over the weekend i noticed the smae thing happening on my AC control, which worked fine all week, but come weekend it started behaving very strange, so i think that needs rewriting as well…

That makes sense. An and is a better way to combine the two sequence expressions.

Mike,
Wait 1 week before you try to rework this.
My next release with have some changes to simplify this logic.

Mike,
I was pleasantly surprised to see my 5.0 release (made last night) accepted in just a couple of hours.

It has features that should help simplify this logic.

@ RichardTSchaefer, PLEG is getting better and better…

When you said there is some options in there to simplify my logic, you meant the timer ? I could try and work out how many hours or minutes the on period is supposed to be. I have seen the drop down menu, you can enter hours, minutes or seconds. Is there an option to say 1 1/2 hours ? Or do i say 90 minutes ? (that was obviously just an example)
Would it be possible in some future update to be able to specify a specific ‘off’ time ? Would make it easier to see and define the off time

@ RichardTSchaefer

something else i noticed, in my logic i am using 2 window sensors (bypassed). Occasionally they are still marked as open in the logic, although in UI5 they are green closed. When i open and close the window, the status in PLEG is correct again. It does happen frequently, although not all the time. I noticed while i am testing my logic, as the AC is supposed to switch off when a window is opened, or not switch on when a window is opened