Ecobee, don't resume until presence for a while


1) Give a description of the problem
I have a piston that works well to identify when no one if upstairs puts the Ecobee (we have 2 HVAC units) into a custom comfort setting approximating smart away. When someone triggers motion again, it resumes the normal schedule.

2) What is the expected behaviour?
The piston is behaving as designed currently.

3) What is happening/not happening?
I would like to adjust it so that not just any motion would resume the schedule. There is a lot of running up stairs to get one thing and coming immediately back down and its a waste to heat the upstairs back up due to that. I can’t think of a way without using some complex loop/variable solution (I have never attempted, can’t quite understand how) to make it so that a certain number of motion sensor triggers have to happen in a set period of time (e.g. 3 times in 10 min) or a sensor stays active for a prolonged period of time (e.g. 5 min straight)

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full
No issues running so no log needed I don’t think


You could set the if to if active for 5 minutes, or whatever amount of time you see fit. Not sure that would do it, I guess it would depend on how your sensors are located and what kind of activity.

Another method, is to use on Event. I use this for a Piston that counts events on my outdoor cameras. I often forget when I am home to shut off the cameras when I go outside to work in the yard. I use Arlo cameras that are all battery powered and I don’t want a bunch of videos of me riding around on the mower. If you just want to count events over a certain amount of time that shouldn’t be too hard.

It would start off with something like this.


Is that variable permanent? If not, wouldn’t it reset every time there is an event and always be zero or 1? I assumed local variables would be reinitialized with each trigger of the piston. If not, how does it get reset?

Also, how do you know all the events happened in some limited window and it just wasn’t 4 events from your cameras say over a few hours?


A variable, once set, will remain until another command writes to it again.
(Although, if you force it up top in the define section, it is over written each time the piston executes)

The basic structure that @Terminal suggested works well to add a new count (+1) to each event. You will have to add more logic to ‘reset’ the variable back to zero at the appropriate time.


So the way the example was written, the variable is up top and would be re initialized each time right? How/where would I put it so that it would not be over written? Do I just stick that integer line somewhere down lower in the execute section?


In the piston nhsqh, the name of the variable is defined up top, but the actual data is not set.

This popup:


… creates this code:


If the value was “set” up top, then that number would be displayed on the right of line 17.

This method means that the variable will never change unless code in the execute section instructs it to.


WCmore answered it all, but as he said this is just a basic starting point. You would need to add the logic you feel would best handle your situation. How many events over how long a time period.

If the piston looked like below then it would be reset to 0 every time the piston triggered. Notice Num_Events =0 . Basically it would be useless for it’s purpose.


Ah, I see what you guys mean now. Let me play with it and see what I can come up with. Thinking maybe I have a counter variable and a last trigger time variable. I could have a check at the beginning that says if the trigger time is > X minutes old then reset the counter, and then if the counter ever gets greater than Y OR if any sensor stays active for >Z duration, resume the thermostat.