Feedback on Elk Rule

slowmo

Member
I’d like to get feedback on the Elk Rules below. The intent is to increase the thermostat setting when there is movement in the house and then to decrease the thermostat setting after an hour of no movement. The motion sensor is in the family room/kitchen area thus it is high traffic area which should represent whether or not someone is in the house. At night the temperature should be reduced when everyone is in bed.

RULE 1
WHENEVER Motion Family Room BECOMES NOT SECURE
AND TEMP SET ON MOTN (Out 53) STATE IS OFF
THEN SET RCS TR40 (Tstat 1) HEATING DESIRED TEMP TO 64 DEG. F.
THEN TURN TEMP SET ON MOTN (Out 53) ON FOR 1 HR

RULE 2
WHENEVER TEMP SET ON MOTN (Out 53) STATE IS OFF
THEN SET RCS TR40 (Tstat 1) HEATING DESIRED TEMP TO 62 DEG. F


Thanks,
Scott
 
I don't have mine up to be able to test right now or get the exact syntax, but here's what I'd recommend:

Rule 1 -
Whenever Motion Family Room becomes Not Secure
Turn Out53 on for 60 minutes (restart timer if running)

Rule 2
Whenever Out53 turns on
THEN set TSTAT1 Heating Desired Temp to 64 Deg.

Rule 3
Whenever Out53 Turns Off
Then Set tSTAT1 Heating Desired Temp to 62 Deg

I found I got the best results when I kept the rules very simple, and let the actions of the output timer turning on/off do the real work.

This method will keep the timer on and keep resetting it every time it detects movement. Once no movement has been detected, it'll finally turn off the output after an hour. The action will trigger as the output turns off to set the temperature down.
 
I added a few rows of code.

-- AND Outside Temp… because there is a point where the outside temp is not low enough to turn on heat.
-- AND RCS TR40… this line allows someone to set the temperature higher than the temp set by motion detection. This way motion detection does not override a manually set higher temperature.


RULE 1
WHENEVER Motion Family Room BECOMES NOT SECURE
AND Outside Temp ACTUAL TERMERATUR IS LESS THE 60 DEG
AND RCS TR40 ACTUAL TEMPERTURE IS LESS THAT 65 DEG
THEN TURN TEMP SET ON MOTN (Out 53) ON FOR 1 HR, RESTART TIMER IF RUNNING
THEN SET RCS TR40 (Tstat 1) HEATING DESIRED TEMP TO 65 DEG. F.

RULE 2
WHENEVER TEMP SET ON MOTN (Out 53) STATE IS OFF
THEN SET RCS TR40 (Tstat 1) HEATING DESIRED TEMP TO 63 DEG. F
 
Personally I would've left all the validation on the rule that actually makes the change...

Rule 1 -
Whenever Motion Family Room becomes Not Secure
THEN turn Out53 on for 1hr, restart timer if running.

Rule 2 -
Whenever Out53 Turns on
AND RCS TR40 Actual Temperature is less than 65 deg
AND outside temp actual temp is less than 60 deg.
THEN set RCS TR40 Heating Desred Temp to 65 Deg F

Rule 3
Whenever Out 53 Turns Off
Then Set TStat 1 Heating Desired Temp to 63 Deg. F

Then again, thinking as I type - your way would cause it to work even as the temperature outside or in the room changes, so maybe it's a better way.

If it works - run with it!
 
Work2 Play
Thanks again for the feedback.

At various times of the day I’m checking Thermostat settings. I’ll report back when I’m comfortable the rules are working as expected.

Just so I understand your thinking in your second to last line.

Using your rules, Rule 1 Out53 starts for an hour. Even if Actual or Outside temperature changes after Out53 Turns on for the first time; Rule 2 doesn’t play in and check Actual or Outside temp again for at least one hour. Under circumstances where Motion in Family Room occurs multiple times over the course of the evening, it’s possible Out 53 never turns off therefore Rule 2 doesn’t become activated and doesn't adjust to the environment.

Does that make sense… cuz it should be clear as mud.

Thanks,
Scott
 
Your understanding is correct... My original rules wouldn't have responded to changed in environmental conditions. The change you made does - but, every time motion is detected, the M1 is sending the temperature setting to the thermostat... this may not hurt, but it's sure a lot of unnecessary traffic. So - best of both worlds - your additional validation; with an extra rule to only send the temperature change when needed.

One note - IIRC, each additional AND or THEN takes up an additional rule space anyways, so you're not wasting any rule space breaking them into separate rules.

Another note - with this setup, it's possible the temperature change can be triggered by the motion - then you walk by and manually change the temperature. That temperature will now hold until the 60 minute timer expires, then it'll be set back to 63. On the other hand, the way you had it last would've actually overridden the manual setting the very next time motion was detected. If you want a way to completely override this automation, you'd need a way to manually set another flag and include that check in your criteria as well.

RULE 1
WHENEVER Motion Family Room BECOMES NOT SECURE
AND Outside Temp ACTUAL TERMERATUR IS LESS THE 60 DEG
AND RCS TR40 ACTUAL TEMPERTURE IS LESS THAT 65 DEG
THEN TURN TEMP SET ON MOTN (Out 53) ON FOR 1 HR, RESTART TIMER IF RUNNING
THEN SET RCS TR40 (Tstat 1) HEATING DESIRED TEMP TO 65 DEG. F.

RULE 2
WHENEVER TEMP SET ON MOTN (Out 53) STATE IS OFF
THEN SET RCS TR40 (Tstat 1) HEATING DESIRED TEMP TO 63 DEG. F

RULE 3
WHENEVER TEMP SET ON MOTN (Out 53) STATE IS ON
THEN SET RCS TR40 (Tstat 1) HEATING DESIRED TEMP TO 65 DEG. F.
 
Cocoontech Forum is awesome, Work2Play ditto.
I’ve learned more about Elk rule writing through our exchange than 6 months worth of reading on my own. OK you can take that one of two ways; either I’m slow or you have been very helpful.

I will ponder this a little more when I have time this weekend.
 
Well you're obviously already getting the hang of it on your own too!

The more you work with it the more you'll pick up patterns... some things just fire off in a weird way. I also read just about every programming example available on Elk's web-site before I started (I just searched their new site so I could link them, but can't find it anywhere).
 
Back
Top