I know this is simple but I’m not sure how to complete this.
The idea is to trigger a scene every time the CurrentSetPoint of the thermostat is changed.
I have the variable, trigger and scene working for both the cool and heat (individually) but PLEG is not firing for every change.
I’ll work with the Heat side first:
All I have in the condition tab is the HeatSet variable I created on the Input tab. It seems that I have to have some other forumla in the condition to get PLEG to fire.
In the scene I have a trigger:
[ul][li]Device: Program Logic Event Generator
Type of trigger: A condition is satisfied
Name for trigger: TrigHeatSet
Condition Name: cHeatSet[/li]
[li][/li][/ul]
Hoping someone can provide that simple answer!
THanks!
PLEG Report:
Device Properties
Name Device Name Device Variable
HeatSet _Thermostat CurrentSetpoint
CoolSet _Thermostat CurrentSetpoint
Conditions
Name Expression
cHeatSet HeatSet
cCoolSet CoolSet
This is a scenario that PLEG is not well suited for.
PLEG Only triggers when a condition first becomes TRUE. It has to go false for it to retrigger.
Input: HeatSet when …
Condition:
ChangeDetected (HeatSet != OldHeatSet)
OldHeatSet HeatSet
Dummy NOW
Trigger when Condition ChangeDeteced is satisfied.
Thank you for fast reply!
That seems to be working great! Of course, a couple of other questions?
-
Why does that work? I get the idea of the (HeadSet != OldHeatSet) but what does the Dummy NOW do?
-
Can I do the cool temp set detect in the same PLEG instance?
Add: CoolChangeDetected (CoolSet != OldCoolSet)
OldCoolSet CoolSet
Thanks so much for your answers. I appreciate you taking the time!
A PL??? is only triggered when a condition goes from False to True.
The set of conditions is evaluated in two scenarios:
- The property Value changes.
- Every Minute because of the NOW variable.
When the conditions are evaluated because the property variable changes then CoolChangeDetected will be true because the new value is different from the old value.
When the condition fires because of NOW than CoolChangeDetected will be false.
And now we are ready for the next property change!
You can put as much logic as you like in the same PLEG.
What you proposed would be two separate things you can trigger on.
You can also just have:
ChangeDetected (CoolSet != OldCoolSet) or (HeatSet != OldHeatSet)
I entered separate heating and cooling. Works great! Thanks!
With your previous help I was able to create scenes which detect and notify me based on change of temperature, and change of set temperature (heat or cool).
Using the code in the PLEG, I set up PLEG inputs/properties and a scene for each with a trigger coming from the PLEG conditions: cHeatSet, cCoolSet and cCurTemp. These work great!
But for some reason I’m not getting a the thermostat’s mode change. The values should be CoolOn, HeatOn, Off and Auto. I can see the correct changes in the thermostat device properties as well as in the PLEG properties (the Current Value is always correct).
I’m not getting the trigger to the scene.
The scene works if I manually click on the “Run” button but the trigger is not picking up the PLEG trigger, even though I think I have it set up like the other triggers, which work!
I HAVE to be missing something simple? Thanks for looking and letting me know if you see something.
PLEG Report and info:
Device Properties
Name Device Name Device Variable
HeatSet _Thermostat CurrentSetpoint
CoolSet _Thermostat CurrentSetpoint
t1Mode _Thermostat ModeStatus
CurTemp _Thermostat CurrentTemperature
Conditions
Name Expression
cHeatSet (HeatSet != OldHeatSet)
OldHeatSet HeatSet
DummyHeat NOW
cCoolSet (CoolSet != OldCoolSet)
OldCoolSet CoolSet
cThermMode (t1Mode != Oldt1Mode)
Oldt1Mode t1Mode
cCurTemp (CurTemp != OldCurTemp)
OldCurTemp CurTemp
In the scene:
Trigger on PLEG, A Condition is satisfied
Name: trigThermMode
Condition Name: cThermMode
The scene has luup code which writes the status to a database. This works fine when click on the “Run” button.
Thermostat: Trane TZEMT400BB3NX
I’ve attached a portion of the log that captures the debug from PLEG when I change the status of the thermostat. It sees the change (first line) but doesn’t trigger cThermMode.
Thanks for any help!
String variables are compared with eq and ne … Not == and !=
YES!!! That works! Thanks!!!
So the Dummy was only needed because there were no other rules in the above example that contained a NOW clause?
Or does NOW by itself (not part of a time sequence) have some special significance?
How does PLEG behave on a Luup reset? Are parameter values stored across sessions, or evaluated (along with conditions) at startup?
I previously posted about conditions that fire repeatedly, and I’ve learned more. What I’m noticing is that in an action, I’m changing a property (it’s a variable in the Variable Container plugin). That variable is used to store states. I’ve effectively built a finite state machine, since that’s how my brain works.
The current state is stored in one of the Variable Container items. When changed IN ACTIONS, then PLEG doesn’t notice that the property has changed. ObjectStatus still shows the old value. If I manually change the Variable Container value via the MCV UI, then PLEG notices the change. Not sure if this is because things work differently when done thru the UI. FWIW, if I change the value thru my own Lua script, that change is also not picked up by PLEG.
So what can I do to rattle PLEG into re-evaluating all device properties? Will a NOW by itself, or paired with the property help?
Edit:
Example Condition:
loft_lights_on : ((loft_state eq ‘loft_occ’) AND is_night)
where loft_state is Variable4 in VC; loft_occ means it’s occupied, which is a complicated set of real-world conditions that are correctly being evaluated by PLEG
How does PLEG behave on a Luup reset? Are parameter values stored across sessions, or evaluated (along with conditions) at startup?
[b]YES[/b] ... that's a strength of the [b]PL[/b] plugins as opposed to using LUA code and Scenes.
The Now clause in @shicks3 earlier post is totally useless … unless debug is on and he just want’s to watch the evaluation of his conditions in the log file. But no conditions, other than DummyHeat could ever be fired during this repeated evaluation.
NOW cause conditions to be evaluated once per minute … but unless it contributes logically to a condition’s value it will NOT cause anything to trigger.
Do you have a Vera log that shows that a PL device is Missing a device property update ?
I had the NOW in there because that was part of the answer to my original post . Now that I’m understanding this more, I get that it isn’t needed and took it out.
It all works great now. I just bought this big, old house and am writing all the thermostat and temperature changes along with the outside temps to a database on my website. I’m working on graphing the results to show my “roommates” they really could’ve just opened the window instead of turning on the air.
Also have it in the luup of the temp change scene to Prowl me if it gets above 80 when someone forgets to turn the air on for the day. Don’t want to cook the dog.
Thank you Mr Schaefer for the plugin and the help!