TempThing: An intelligent thermostat controller



Piston: TempThing
Purpose: Adjust thermostat(s) to heat/cool and setpoint based on an outside/near outside temperature sensor and the locations current mode. Allow temporary manual adjustment.
Reason: I was tired of my thermostat (CT100) not handling auto temp very well. This piston takes over the auto functions by setting the proper mode (Heat/Cool) and temp to keep the home comfortable. 69 in the Summer is different than 69 in the Winter so we’ll use the outside/near outside thermostat to find out if we need to be heating/cooling. I also want others to be able to adjust the temperature temporarily to knock off the chill/heat but get back to proper temp/mode on a set interval.

Configure the components in the “define” section as commented:
TempMonitor: Typically, Window/Outside temp monitor, only 1 device expected. Use an outside or near outside (window) temperature sensor to determine if we need to be heating/cooling inside the home/location.
TempMode: Don’t adjust. Used to hold current thermostat mode desired (Heat/Cool) based on TempMonitor and location mode.
DesiredHeatDay: Temperature to set during Home mode, when heating is needed
DesiredHeatNight: Temperature to set during Night mode, when heating is needed
DesiredHeatAway: Temperature to set during Away mode, when heating is needed
DesiredCoolDay: Temperature to set during Home mode, when cooling is needed
DesiredCoolNight: Temperature to set during Night mode, when cooling is needed
DesiredCoolAway: Temperature to set during Away mode, when cooling is needed
Thermostat: Thermostat(s) to adjust
CheckIntervalMinutes: Tolerance to allow manual override. Thermostat(s) is/are checked at this interval for compliance
counter: Don’t adjust. Used to determine if CheckIntervalMinutes has been reached
lastmode: Don’t adjust. Used to determine if location’s mode has changed (from home to night, etc)

(Released at Build 18)


Update. Build #25.
Some logic corrections.
Detect if a contact sensor is open (door/window) for a nice day outside and turn off the thermostat(s) accordingly.
Import Code: 0kbd2

Working Thermostat Piston

Getting the dreaded message it will never run on its own


Did you change TempMonitor to your thermostat instead of “Contact Sensor 3”?
Did you change “Thermostat” from “Thermostat 1” and “Thermostat 2” to the thermostat(s) that you have?
Did you change “MonitoredDoors” from “Contact Sensor x” to your window/door contacts
Prior to saving?


Yes checked all the above. Here is the log message I get

How to Clear Out a Boolean Variable

This is awesome.
I have a Nest Thermostat, and have the following questions:

  • Besides the door being open, I dont see why the tstat would turn “off”. Yet it does when the temp exceeds the setpoint. It should stay in “Heat” Mode

  • How do I implement Eco instead of Off.

  • I would like “off” to be soemthign I set manually and it means this piston does no actions at all (over ride of sorts)


Even though I use Webcore to make some temp adjustments, and even control my SmartVents, I use NST Manager to control my Nest. I have three of them. It seems to do the job pretty well except for one thing and that is not it’s fault. It can utilize other temp sensors in the house to control you Nests. We all know that the temp at the nest is not the temp at your favorite chair watching football with a beer in your hand. So it allows you to control them with other sensors. The one problem with that is that the sensor does not constantly report the temp so your nest can go into heating, and get really hot, before the reported temp gets to the Nest. So I have had to create a bunch of routines using WebCore to make sure that does not happen. I have also created simulated temp sensors which uses those sensors, during different times of the day, as the primary sensor for multiple sensors. Now I can say the boss, the wife, no longer says “It is too hot or too cold in here what is happening with your system”.


It turns off when a door/window (contact) is left open. The monitored door(s)/window(s) are an indicator that it’s a nice day outside, enough to leave the door/window open, and I don’t want to run the Heat/Air conditioner and waste gas/electricity by trying to heat/cool the house while a door/window is open wasting energy. If the door/window is closed the thermostat goes back into heat/cool mode as needed.


Feature Suggestion -
Instead of using a temperature sensor that is near the outside - why dont you replace it or give an option to use the built in NOA weather information from this expression: $weather.conditions.current_observation.temp_f


I don’t think it’s NOA it pulls info from. It is digital weather underground Just an fyi


I added the Accuweather device handler and chose to controll from the data off of Accuweather.


Hey… Thanks a lot! This is way cool. I automated my ceiling fan control based on my NEST thermostat setting. I now control my NEST thermostat setting based on your piston. Way cool and I’m impressed by the logic.



This thing is awesome! I made a very basic one that worked but this is really what I was looking for, thanks!


So I am trying to make this script work using only on sensor the thermostat itself. I am using a CT101 thermostat with this script I would like it to reset the temp every 15mins back to what I have programmed in the script as well as no more the a 5 degree adjustment 70-75. Is there a different script to use or will this one work


Just a place holder, a link back to tell me I posted in this thread and therefore to return to it…

I’m doing an ecobee piston to attempt to account for both radiant heat loss and wind draft issues in heating my home this winter. As I get it honed, i’ll Include it in this thread.


Could someone show me where the ‘every’ timer is? I’ve looked (it seems to me) everywhere in the editor.
I’m hoping this will finish my central heating timer, which doesn’t quite work as I need.
Also, if there’s no timer (or every) and it runs synchronously, what triggers it to run? This is my problem.

Many thanks, Duncan


Ok, so my piston is working on my ecobee… except I’ve not yet included a mechanism for allowing manual overrides. Consequently while I was out last night my wife got frustrated that she was setting the thermostat at 72, and it would immediately kick itself back down to 69.

So I have to build logic in that says “if setpoint is changed, override all other piston logic and leave it set at that point”.