Can i check a thermostat setpoint ?

My StellaZs do not always react to a setpoint change. At the moment i am using a scene which repeats the setpoint every 5 mins, so that at every wakeup it should get the new setpoint. This is now working with a 99% reliability. I thought it might be better though to somehow get the current setpoint in a variable, and then somehow compare it to the desired setpoint in PLEG. Then use PLEG to repeat the desired setpoint until it has been accepted by the thermostat. Is that possible, if so how would i do it ? I can probably work out the logic once i have the setpoint in a variable or something, that is the main issue for me

I don’t know about the StellaZ but most thermostats have a variable CurrentSetpoint. If you create a PLEG Device Property for this you can include it in a condition expression to compare it with your desired value.

If your target value is calculated in a condition expression, you can send it to the device using the SetCurrentSetpoint NewCurrentSetpoint = {(condition-name-or-expression)} feature.

I have set up a currentsetpoint variable, StudySetpoint. My thermostat has a wakeup interval of 240 secs. So once the setpoint changes, i need to check 245 seconds later if it has been changed. I have 2 setpoint temperatures, 2 degrees and 24 degrees. StudyHeatOn triggers my scene to set it to 24 degrees, StudyHeatOff to 2 degrees via another scene.

StudyHeatOn (StudyWD1 or StudyWE1 or StudyWE2) and NOT Away 2013-11-24 13:00:00.204 true
StudyHeatOff NOT StudyHeatOn or Away 2013-11-20 22:00:00.161 false

These are the current conditions which i want to change. StudyWD1 or StudyWE1 or StudyWE2 are schedules to determine if the thermostat should be on.

I am not sure how to do this from here though

I have not tested this logic but I would try something like this:

Conditions
StudyHeatOn (StudyWD1 or StudyWE1 or StudyWE2) and NOT Away
StudyTarget StudyHeatOn ? 24 : 2
SendStudySP (StudySetPoint != StudyTarget) and (SendStudySP; Now > 4:05)

Actions
SendStudySP SetCurrentSetpoint NewCurrentSetpoint={(StudyTarget)}

I am going to try that, i think that might work. I do not understand all of it yet, and some of it i did not know you can do, so i learnt something again which is good. I assume

StudyTarget StudyHeatOn ? 24 : 2
this turns to 24 when true, otherwise 2. I did not know that function (but i am not very good at deciphering the PLEG wiki i have to say)
If i changed the setpoint manually to something other than 24 or 2, would that setpoint then stay until the next automatic setpoint change ? That is something else which i would like to have just in case. If theis function
SendStudySP (StudySetPoint != StudyTarget) and (SendStudySP; Now > 4:05)
only checks when scheduled changes occur (via StudyHeatOn) then it would work. I dont understand what the ! after the expression does, thats why i am not sure exactly what it does

I really appreciate your input ! Great help.

If i changed the setpoint manually to something other than 24 or 2, would that setpoint then stay until the next automatic setpoint change ? That is something else which i would like to have just in case.
The logic I suggested will attempt to override any manual setting. If you want a manual override facility, you will have to change the logic to be event-driven rather than comparing target and setpoint. One possibility would be to define a PLEG self-triggered timer of 4:05 and start it with an action when you send the new setpoint. When the timer expires, you can check whether the setpoint [i]stuck[/i] and, if not, resend it. Try to identify all required functionality before starting to design the logic.
I dont understand what the ! after the expression does, thats why i am not sure exactly what it does
SendStudySP has two parts:

(StudySetPoint != StudyTarget) will be true when the current setpoint does not equal the target setpoint. This will happen when the target setpoint changes due to StudyHeatOn changing, if you manually change the current setpoint or if the SetCurrentSetpoint action was not successful.

The second part: and (SendStudySP; Now > 4:05) is intended to repeat the action every 4:05 until the current setpoint matches the target. It does this by reference to the timestamp when the condition was last true - and therefore the action last fired.

So as long as the current setpoint does not equal the target setpoint, the condition and action will fire every 4:05. In practice the time will be about 5 minutes because NOW runs once per minute.

Another simple approach is to define the action with built-in retries. Just add delays of, say, 5 minutes to the action and repeat the SetCurrentSetpoint command.

I have a few mission-critical actions where I repeat the command three times with appropriate delays. In most cases the action works on the first attempt but, if not, it gets two more shots. If it fails after three attempts, it’s broken. :o

Rex: What do you consider to be be critical to your home’s ‘mission’?

Rex: What do you consider to be be critical to your home's 'mission'?
It is the home-automation that has the mission - the reason I installed it in the first place. This is to make my home apparently occupied when I am not there.

[quote=“RexBeckett, post:7, topic:177934”]Another simple approach is to define the action with built-in retries. Just add delays of, say, 5 minutes to the action and repeat the SetCurrentSetpoint command.

I have a few mission-critical actions where I repeat the command three times with appropriate delays. In most cases the action works on the first attempt but, if not, it gets two more shots. If it fails after three attempts, it’s broken. :o[/quote]

I am doing that at the moment with my scenes. I had it at 3 repeats, as i still had a few failures to set the setpoint, i upped it to 4 setpoint resends (every 4.05 mins to make sure its awake). Fairly decent reliability, But still, when i got up this morning the house was cold as the thermostat was still on night time setting. That is the reason i wanted to use a different logic.
I think if i could somehow to get your logic to ignore setpoints which are not 24 or 2, and then just change them on the next scheduled event. Meaning, when i change it manually i have to change it to something different than 2 or 24, and then it should be ignored until the next scheduled change. Is that a possibility ?

The logic I suggested will attempt to override any manual setting. If you want a manual override facility, you will have to change the logic to be event-driven rather than comparing target and setpoint. One possibility would be to define a PLEG self-triggered timer of 4:05 and start it with an action when you send the new setpoint. When the timer expires, you can check whether the setpoint stuck and, if not, resend it. Try to identify all required functionality before starting to design the logic.

This sounds like it could be a solution. But how do i do the self triggered timer ?

I think if i could somehow to get your logic to ignore setpoints which are not 24 or 2, and then just change them on the next scheduled event. Meaning, when i change it manually i have to change it to something different than 2 or 24, and then it should be ignored until the next scheduled change. Is that a possibility ?
Yes that is easy to do but would it work as you want? It would mean that if you set the 'stat to, say, 20 degrees the logic would not change it to 2 or 24 when [i]StudyHeatOn[/i] changed. How is the logic to determine the difference between an unresponsive thermostat and one that has been manually adjusted?
But how do i do the self triggered timer ?
Create a new timer (MyTimer) in your PLEG and set [b]Start Type:[/b] to [i]Self Trigger[/i], [b]Stop Type:[/b] to [i]Interval[/i] and [b]Every[/b] to the required duration (4:10?).

You start the timer using the PLEG action StartTimer for the timer name. You would do this from the condition that sends the SetCurrentSetpoint action as a result of StudyHeatOn changing.

Now you need a condition that fires when the timer finishes and the setpoint is still wrong:
TimerEnded !MyTimer
ResendSP TimerEnded AND (TimerEnded; NOW < 1:00) AND (StudySetPoint != StudyTarget)

The action for this condition should resend the SetCurrentSetpoint and also start the timer again.

I have not tested this. It may need some additional lockout terms.

This is what i have created, testing now…

Device Properties
StudySetpoint Study Rad CurrentSetpoint 2013-11-24 21:06:53 2

Conditions
StudyHeatOn (StudyWD1 or StudyWD2 or StudyWE1 or StudyWE2) and NOT Away 2013-11-24 13:00:00 false
StudyHeatOff NOT StudyHeatOn or Away 2013-11-24 22:10:00 true
StudyTarget StudyHeatOn ? 24 : 2 2013-11-25 12:44:33 2
ResendSP !StudyTimer AND (StudySetPoint != StudyTarget) 0 false
SendStudySP (StudySetPoint != StudyTarget) and (SendStudySP; Now > 4:05) 2013-11-25 12:44:33 false

Actions
Actions for Condition: StudyHeatOn
Immediate
Device Action Arguments
MultiSwitch SetStatus1 newStatus1=1
HVAC PLEG StartTimer timerName=StudyTimer

Actions for Condition: StudyHeatOff
Immediate
Device Action Arguments
MultiSwitch SetStatus1 newStatus1=0

Actions for Condition: ResendSP
Immediate
Device Action Arguments
Study Rad SetCurrentSetpoint NewCurrentSetpoint={(StudyTarget)}
HVAC PLEG StartTimer timerName=StudyTimer

Actions for Condition: SendStudySP
Immediate
Device Action Arguments
Study Rad SetCurrentSetpoint NewCurrentSetpoint={(StudyTarget)}

So if this works (and i believe it does) then unless i manually enter a setpoint while the system is still trying to set a setpoint it should accept a manual setpoint and keep it until changed again by the scheduled events.
If this all works i can create the same thing for my normal heating thermostat… (cant risk the other half sitting in the cold…)

Great help RexBeckett

Hope this might help others too

Your logic has got two different solutions running at the same time. Also I added some logic to the timer condition that you did not notice. I anticipate problems when you try changing the setpoint manually…

Remove the action and condition SendStudySP. Change the conditions to:

StudyHeatOn (StudyWD1 or StudyWD2 or StudyWE1 or StudyWE2) and NOT Away
StudyHeatOff NOT StudyHeatOn or Away
StudyTarget StudyHeatOn ? 24 : 2
TimerEnded !StudyTimer
ResendSP TimerEnded AND (StudyTimer; TimerEnded < 5:00) AND (StudySetPoint != StudyTarget)

Add an action to StudyHeatOn to SetCurrentSetpoint to 24. Add an action to StudyHeatOff to SetCurrentSetpoint to 2. Add an action to StudyHeatOff to start StudyTimer.

Ok i have changed it to:

StudyTarget StudyHeatOn ? 24 : 2 2013-11-25 12:44:33 2
ResendSP StudyTimerEnded AND (StudyTimer; StudyTimerEnded < 5:00) AND (StudySetPoint != StudyTarget) 0 false
StudyTimerEnded !StudyTimer 2013-11-25 15:11:18 true

Actions for Condition: StudyHeatOn
Immediate
Device Action Arguments
MultiSwitch SetStatus1 newStatus1=1
HVAC PLEG StartTimer timerName=StudyTimer
Study Rad SetCurrentSetpoint NewCurrentSetpoint=24

Actions for Condition: StudyHeatOff
Immediate
Device Action Arguments
MultiSwitch SetStatus1 newStatus1=0
HVAC PLEG StartTimer timerName=StudyTimer
Study Rad SetCurrentSetpoint NewCurrentSetpoint=2

Actions for Condition: ResendSP
Immediate
Device Action Arguments
Study Rad SetCurrentSetpoint NewCurrentSetpoint={(StudyTarget)}
HVAC PLEG StartTimer timerName=StudyTimer

See how i get on with that

That isn’t what I suggested. Put StudyTimerEnded before ResendSP. The order of conditions is important in PLEG.

Done it. It needs to be before ResendSP so that ResendSP has the right time stamp when it is checked ?

It is working, but when i change the setpoint manually the ResendSP comes into action and changes it back…

For some reason when i change the setpoint manually, the StudyTimer starts, which then triggers ResendSP. Just not sure why the timer starts when i change the setpoint manually ???

Actually looking at the time stamps, ResendSP triggers the StudyTimer. So the problem is ResendSP. I am not sure how i can get that to ignore manual changes. If it is possible.

Can you post a complete status report?

Sure. Here it is, but it is quite long… i have started working on using your logic to contraol my main heating thermostat as well, but have not added any actions yet as i first need to solve the manual setpoint problem. I have now changed the setpoint for my Study manually, just waiting for ResendStudySP (renamed from ResendSP) to change it back then i will add it here.
From what i understand, ResendStudySP will always compare the setpoint with the target setpoint, i think that is the problem. So i think i know where it is going wrong, i just cannot work out a solution. Its going to be even trickier with my main heating, as there are 4 different main setpoints plus i want manual setpoints possible, but thats next on the list…

HVAC PLEG
Device ID: 2502013-11-25 22:39:07.519 PLC Version: 5.4
Triggers
Name Description Last Trigger State
OutsideHot Temperature outside temperature goes above 19 degrees 2013-11-06 21:24:19.705 false
AC_Auto_ON MultiSwitch Switch 3 is turned on 2013-11-25 16:25:46.418 true
RWindowOpen Window Right is tripped 2013-10-30 19:57:05.335 false
LWindowOpen Window Left is tripped 2013-10-30 19:36:15.288 false
HeatingON MultiSwitch Switch 4 is turned on 2013-09-24 05:35:51.009 true
HotWaterON MultiSwitch Switch 5 is turned on 2013-09-24 05:35:51.070 true
Away MultiSwitch Switch 7 is turned on 2013-11-25 19:25:55.727 false
Vacation MultiSwitch Switch 8 is turned on 0 false
ACisON Air Condition is set to cool 2013-10-04 20:45:05.261 false
BedroomHot1 Temperature Master Bedroom temperature goes above 23.5 degrees 2013-10-23 16:24:09.866 false
BedroomVeryhot1 Temperature Master Bedroom temperature goes above 26 degrees 2013-09-05 19:30:17.819 false
BedroomCold1 Temperature Master Bedroom temperature goes below 21.5 degrees 2013-11-25 22:25:07.305 true
BedroomVeryCold Temperature Master Bedroom temperature goes below 16 degrees 2013-11-21 04:35:33.561 false
HeatACOff Temperature Master Bedroom temperature goes above 19 degrees 2013-11-25 12:29:43.292 false
ACHeatOn Air Condition is set to heat 2013-11-20 03:11:18.512 true
Justhome1 ()Justine?s iPhone is present 2013-11-25 16:29:54.443 true
Mikehome1 (
)Mike is present 2013-11-25 18:27:55.067 true
Autoaway1 MultiSwitch 2 Switch 5 is turned on 2013-11-25 11:48:42.201 false
StudyOn MultiSwitch Switch 1 is turned on 2013-11-25 20:40:50.807 false
Schedules
Name Type Time Days Random On Delay Off After Type Off Time Off Days Random Off Delay State Last Schedule
check_Window Weekly 21:20:00 1,2,3,4,5,6,7 None None None false 2013-11-25 21:20:00.100
HWOnWD1 Weekly 04:46:00 1,2,3,4,5 None Weekly 05:29:00 None false 2013-11-25 04:46:00.100
HWOnWE1 Weekly 05:57:00 6 None Weekly 06:40:00 6 None false 2013-11-23 05:57:00.101
HWOn1 Weekly 16:30:00 1,2,3,4,5,6,7 None Weekly 16:50:00 None false 2013-11-25 16:30:00.102
HeatWDOn Weekly 05:05:00 1,2,3,4,5 None Weekly 22:10:00 1,2,3,4,5 None false 2013-11-25 05:05:00.100
HeatWEOn Weekly 06:35:00 6 None Weekly 22:40:00 6 None false 2013-11-23 06:35:00.100
WD1 Weekly 21:30:00 1,2,3,4,7 None Interval 7:20:00 None true 2013-11-25 21:30:00.102
WE1 Weekly 22:00:00 6 None Interval 9:10:00 None false 2013-11-23 22:00:00.080
WD2 Weekly 21:45:00 5 None Interval 09:20:00 None false 2013-11-22 21:45:00.100
StudyWD1 Weekly 18:15:00 1,2,3,4 None Weekly 22:00:00 1,2,3,4 None false 2013-11-25 18:15:00.100
StudyWD2 Weekly 18:15:00 5 None Weekly 22:20:00 5 None false 2013-11-24 18:15:00.100
StudyWE1 Weekly 08:15:00 6 None Weekly 20:00:00 6 None false 2013-11-23 08:15:00.100
StudyWE2 Weekly 13:00:00 7 None Weekly 22:10:00 7 None false 2013-11-24 13:00:00.081
GuestbedWD1 Weekly 06:00:00 1,2,3,4 None Weekly 08:00:00 1,2,3,4 None false 2013-11-25 06:00:00.080
GuestbedWD2 Weekly 20:30:00 1,2,3,4,5 None Weekly 22:00:00 1,2,3,4,5 None false 2013-11-25 20:30:00.007
GuestbedWD3 Weekly 07:00:00 5 None Weekly 11:00:00 5 None false 2013-11-22 07:00:00.079
GuestbedWE1 Weekly 07:00:00 6,7 None Weekly 09:00:00 6,7 None false 2013-11-24 07:00:00.100
GuestbedWE2 Weekly 21:00:00 6,7 None Weekly 22:00:00 6,7 None false 2013-11-24 21:00:00.079
HeatWEOn2 Weekly 06:40:00 7 None Weekly 22:10:00 7 None false 2013-11-24 06:40:00.104
LoungeWD1 Weekly 17:45:00 1,2,3,4,5 None Weekly 23:30:00 1,2,3,4,5 None true 2013-11-25 17:45:00.100
LoungeWE1 Weekly 08:30:00 6 None Weekly 23:59:00 6 None false 2013-11-23 08:30:00.080
LoungeWE2 Weekly 11:30:00 7 None Weekly 22:45:00 7 None false 2013-11-24 11:30:00.081
StudyTimer Self Trigger None Interval 00:04:05 None false 2013-11-25 22:34:43.689
HeatTimer Self Trigger None Interval 04:50 None false 0
Device Properties
Name Device Name Device Variable Last Change Value
DOW DOW 2013-11-25 00:00:00.102 2
WE Weekend 2013-11-25 00:00:00.331 0
StudySetpoint Study Rad CurrentSetpoint 2013-11-25 22:38:44.975 2
HeatSetpoint Heating Thermostat CurrentSetpoint 2013-11-25 22:32:06.965 16
Conditions
Name Expression Last True State
OpenWindow BedroomHot1 and AC_Auto_ON and (WD1 or WD2 or WE1) and (NOT OutsideHot) and check_Window and NOT WindowOpen and NOT Vacation and NOT Away 0 false
CloseWindow BedroomHot1 and AC_Auto_ON and WindowOpen and check_Window and OutsideHot and NOT Vacation and NOT Away 2013-09-05 20:20:00.045 false
WindowOpen RWindowOpen or LWindowOpen 2013-10-30 19:57:05.361 false
ACmanualHigh BedroomVeryhot1 and (21:42:00;NOW) and NOT Vacation and AC_Auto_ON 0 false
AC_On BedroomHot1 and AC_Auto_ON and (WD1 or WD2 or WE1) and NOT WindowOpen 2013-10-04 20:45:00.118 false
AC_Off ((BedroomCold1 and (AC_On; Now > 15:00)) or (NOT WD1 and NOT WD2 and NOT WE1) or NOT AC_Auto_ON or WindowOpen or HeatBedoff) and ACisON 2013-11-02 05:49:13.661 false
Bedtoocold BedroomVeryCold and NOT Vacation and AC_Auto_ON and (WD1 or WD2 or WE1) and NOT WindowOpen 2013-11-21 04:09:33.587 false
HeatBedoff (HeatACOff or WindowOpen or (NOT WD1 and NOT WD2 and NOT WE1)) and ACHeatOn 2013-11-25 04:50:00.096 false
HWOn (HWOnWD1 or HWOnWE1 or HWOn1) and HotWaterON 2013-11-25 16:30:00.147 false
HWOff NOT HWOn 2013-11-25 16:50:00.141 true
HeatON ((HeatWEOn or HeatWDOn or HeatWEOn2) and HeatingON) and NOT Autoaway1 2013-11-25 16:25:45.313 false
HeatOff NOT HeatON or NOT HeatingON 2013-11-25 22:10:00.150 true
HeatAway Autoaway1 2013-11-25 11:48:42.249 false
AC_message AC_On and (NOT OutsideHot) and (NOW;22:45:00) 2013-10-04 20:45:00.146 false
StudyHeatOn (StudyWD1 or StudyWD2 or StudyWE1 or StudyWE2) and NOT Away and StudyOn 2013-11-25 20:40:50.864 false
StudyHeatOff NOT StudyHeatOn or Away 2013-11-25 20:40:54.295 true
GuestbedHeatOn (GuestbedWD1 or GuestbedWD2 or GuestbedWD3 or GuestbedWE1 or GuestbedWE2) and NOT Away 2013-11-25 19:44:35.949 false
GuestbedHeatOff NOT GuestbedHeatOn or Away 2013-11-25 22:00:00.310 true
LoungeHeatOn LoungeWD1 or LoungeWE1 or LoungeWE2 2013-11-22 17:45:00.169 true
LoungeHeatOff NOT LoungeHeatOn 2013-11-21 23:30:00.151 false
StudyTarget StudyHeatOn ? 24 : 2 2013-11-25 12:44:33.515 2
StudyTimerEnded !StudyTimer 2013-11-25 22:38:48.445 true
ResendStudySP StudyTimerEnded AND (StudyTimer; StudyTimerEnded < 5:00) AND (StudySetPoint != StudyTarget) 2013-11-25 22:34:43.645 false
HeatTarget HeatON ? 20 : 16 2013-11-25 22:09:07.583 16
HeatTimerEnded !HeatTimer 2013-11-25 22:09:07.586 true
ResendHeatSP HeatTimerEnded AND (HeatTimer; HeatTimerEnded < 5:00) AND (HeatSetPoint != HeatTarget) 0 false
Actions
Actions for Condition: ACmanualHigh
Immediate
Device Action Arguments
Push Notification Prowl SendProwlNotification Event=Turn On AC High Description=Bedroom very hot Priority=1 URL=
HVAC PLEG RunScene SceneNameOrNumber=64
Actions for Condition: AC_On
Immediate
Device Action Arguments
Air Condition SetModeTarget NewModeTarget=CoolOn
Push Notification Prowl SendProwlNotification Event=AC Description=AC is ON Priority=1 URL=
Actions for Condition: HWOn
Immediate
Device Action Arguments
Hot Water SetModeTarget NewModeTarget=HeatOn
Actions for Condition: HWOff
Immediate
Device Action Arguments
Hot Water SetModeTarget NewModeTarget=Off
Actions for Condition: CloseWindow
Immediate
Device Action Arguments
Push Notification Prowl SendProwlNotification Event=test Description=close window Priority= URL=
HVAC PLEG RunScene SceneNameOrNumber=71
Actions for Condition: HeatON
Immediate
Device Action Arguments
HVAC PLEG RunScene SceneNameOrNumber=74
Actions for Condition: HeatOff
Immediate
Device Action Arguments
HVAC PLEG RunScene SceneNameOrNumber=73
Actions for Condition: AC_Off
Immediate
Device Action Arguments
Air Condition SetModeTarget NewModeTarget=Off
Actions for Condition: OpenWindow
Immediate
Device Action Arguments
Push Notification Prowl SendProwlNotification Event=Open Bedroom Description=Window Priority=1 URL=
HVAC PLEG RunScene SceneNameOrNumber=59
Actions for Condition: Bedtoocold
Immediate
Device Action Arguments
HVAC PLEG RunScene SceneNameOrNumber=83
Air Condition SetModeTarget NewModeTarget=HeatOn
Air Condition SetCurrentSetpoint NewCurrentSetpoint=24
Actions for Condition: AC_message
Immediate
Device Action Arguments
HVAC PLEG RunScene SceneNameOrNumber=59
Actions for Condition: StudyHeatOn
Immediate
Device Action Arguments
MultiSwitch SetStatus1 newStatus1=1
HVAC PLEG StartTimer timerName=StudyTimer
Study Rad SetCurrentSetpoint NewCurrentSetpoint=24
Actions for Condition: StudyHeatOff
Immediate
Device Action Arguments
MultiSwitch SetStatus1 newStatus1=0
HVAC PLEG StartTimer timerName=StudyTimer
Study Rad SetCurrentSetpoint NewCurrentSetpoint=2
Actions for Condition: HeatAway
Delay 02:00
Device Action Arguments
Heating Thermostat SetCurrentSetpoint NewCurrentSetpoint=18
Actions for Condition: LoungeHeatOn
Immediate
Device Action Arguments
HVAC PLEG RunScene SceneNameOrNumber=96
MultiSwitch SetStatus2 newStatus2=1
Actions for Condition: LoungeHeatOff
Immediate
Device Action Arguments
HVAC PLEG RunScene SceneNameOrNumber=97
MultiSwitch SetStatus2 newStatus2=0
Actions for Condition: ResendStudySP
Immediate
Device Action Arguments
HVAC PLEG StartTimer timerName=StudyTimer
Study Rad SetCurrentSetpoint NewCurrentSetpoint={(StudyTarget)}