All,
Would appreciate any help here. I have 2 thermostats (one on the first floor, one on the second floor; both are auto-changeover so do heating and cooling automatically) and I’m trying to use PLEG to manage the temperatures that they heat or cool to in a smart way. Judging by the results, it may be too smart for my own good =)
Here’s how I’d like it to happen:
- While sleeping, make sure temperature stays between 68 (StdMin) and 80 (StdMax) - e.g., standard temps for indoors
- While out of the house, save energy and set to broader set points: 62 (MinSaving) and 84 (MaxSaving) - e.g., energy saving temperatures
- In the other times (from waking to leaving the house and from returning home until going to sleep) set the minimum temperature/heat point to the outside temperature plus a ‘comfort factor’ (CF; 6), unless that is lower than the energy saving temperature or higher than the standard; set the maximum temperature/heat point to the outside temperature minus a comfort factor (with the same caveats). E.g., rather than have hard temperature minimums/maximums, make them relative to the outside temperature
In the attached I’ve shown the logic that I have right now, and I’m hoping the logic is OK (although I’m sure next to impossible to follow).
My main question is: how do I store a numerical value in a condition, and use it to set a device? I thought I’d followed the same logic as I saw in this thread in terms of how “SetPoint” is set based on evaluating a formula with values and true or false values, but all my target values (e.g., MinTempTarget) are always 0.
What’s the trick to be able to have a Condition hold a numerical value and then set that somewhere else?
Thanks in advance,
Jon
It’s hard for me to follow your logic.
I assume you have used the Status command to see the values of conditions and variables.
Your expressions for MinTempTarget and MaxTempTarget are mixing binary and numeric values.
i.e. 0 + (True * MaxTempCalc) + (False * MaxSavings)
In a numeric context, True has a value of 1 and False has a value of 0.
But it’s hard to tell if this is what you want or an error.
I would recommend using the conditional expression instead:
(MinTempCal > MinSavings) ? MinTempCal : MinSavings
My main question is: how do I store a numerical value in a condition, and use it to set a device?
If the expression evaluates as a number than you are saving a number, similarly for strings and booleans.
You already seem to be setting Virtual Device properties with the value of conditions.
Thanks (for trying to understand my horrendous approach).
Taking a step forward, and using conditional expressions…
I also think PLEG didn’t like that I tried to add service variable/values to the device itself and then read them as device properties?
I also think PLEG didn't like that I tried to add service variable/values to the device itself and then read them as device properties?
I have not done that ... But It should work.
I also noted:
(Wake OR Return) AND (NOT (Sleep OR LEAVE))
Wake, Return, Sleep, Leave are only true at the time of there schedule. And as you have defined them at most 1 will be true at a time. So this expression is equivalent to:
(Wake OR Return)
Good catch!
What’s wrong with:
((OutdoorTemp - 6) < 84) ? 84 : (OutdoorTemp - 6)
As a condition?
I get the error:
Program Logic : ((OutdoorTemp - 6) < 84) ? 84 : (OutdoorTemp - 6): Invalid Value token: 84
Ooops … that’s a bug.
A workaround is:
((OutdoorTemp - 6) < 84) ? 0 + 84 : (OutdoorTemp - 6)
Aha - thanks!
Are nested conditional expressions allowed?
Nested Conditions are supported.
The bug is that numbers are only recognized in numeric expressions … so 84 is unknow … but 84 + 0 is recognized.
Got it, and I’m making progress. Thanks!
OK - I’ve made progress… but how can I get PLEG to re-evaluate what the temperature should be set to?
Per the attached, it evaluated SendFl2ToCoolTo at 5:15PM, but I want to be able to update the target cooling temperature every, say, 5 minutes…
Is there a way?
It will recompute when any of the inputs change.
There no sense to re-compute if the numbers are all the same!
Hmm, but even when the temperature’s changing, the SetPoint’s aren’t being set for the thermostat…?
Thats because your logic only allows them to be set when
Test or Wake or Return
become true!
Wake or Return only happen once a day.
Is there a way to have it set in addition when the temperature changes? How would I do that?
OK - so attached is how I tried to do it… it seems to be working but not sure if it’s a ridiculously bad way to do it?