Working Thermostat Piston



I searched all over for a virtual thermostat routine to control a portable heater, plugged into a switch. I found a few, but none really worked completely. I wanted it to:

  • use a virtual thermostat device (familiar interface for my wife when controlling other Smartthings thermostats or through ActionTIles).:family_man_woman_boy_boy:

  • It had to have a manual override that would reset on schedule, so my 1500W heater would not be left on high for 24 hours. :dollar:

  • It needed to be frustration free, so the heater would not be unplugged from the switch and bypassed because it wouldn’t stay on when she needed it to.:sweat:

This started as the Temp Thing Piston, also found here, and I modified it significantly for my needs.


  • Virtual Thermostat Device using SmartThings Simulated Thermostat device handler (others should work too). One for each instance
  • One Temperature Sensor
  • One switch
  • [The monitored doors and windows are not doing anythign at the moment, but I will be updating in the near future]


  • Current reference temperature and setpoint are shown in the virtual thermostat Thing.
  • Controls are based on times and Location Modes
  • To manually override a temperature, adjust the virtual thermostat in SmartThings. Overrides are reset whenever a Mode change occurs.
  • To disable the switch, set the Thermostat to Off.
  • Use any temperature sensor
  • Everything is set by variables. No hardcoded devices, so this is very easily modified.

Please post any comments or suggestions

Still to do:

  • re-enable logic to determine heating vs cooling based on weather or outside temp
  • control a window AC (cooling) the same way - needs second set of temperatures
  • re-enable the delay feature (currently checks and adjusts every minute), should be every 5 or 10.
  • re-enable the window/door monitoring - to shut the switch off if a window is open
  • add “Time to Temperature” logic, so you set the time you want the room to be warm, and the Piston offsets the start time depending on the Delta T


Wondering if you could highlight some of the features included in this very detailed piston? I’ve been looking for something similar but for use with a window air conditioner that uses external temperature sensor and virtual thermostat so as to allow voice control for setpoints.


I’ve been lurking around for a while and thought you would be interested in this…

I updated the original post to include a bit more detail.

There is no reason I can think of, that you would not be able to use voice to control this. It is no different than just telling Google to set a Nest thermostat or any non-virtual T-Stat. As long as the voice control handler is set up properly. But it will reset from manual to auto every time the Location Mode changes.

“Hey Google, set Bedroom temperature to 65”


Yeah here was my thread for what I’d tried doing. It works fine but is a bit clunky. External temperature sensors can’t seem to keep thermostat temperature updated consistently. That and I hoped using a thermostat with Alexa that I’d be able to Aeon alwxa what thermostat temperature was and she would respond but she won’t.


I hate to be a pain but what did you use the contact sensors for in the piston? I’m wondering which ones I should select when importing your piston code.


Contact Sensor 5 is a temperature sensor - so any temp sensor will work there.

The other 2 are to check if Windows & Doors are open, but that logic is not implemented yet - It came from the initial import of Temp Thing and I’ve since had to simplify my code to troubleshoot.
I learned a lot about coding pistons through this program


Looks like I’ve commented on this thread before so I know I’ve seen it, but let me ask you will this work for a window air-conditioner as well? I’m looking for a basic set up where I can use a virtual thermostat so I can tell Alexa the temperature to set it at and have that control when the air conditioning comes on and off.


Yes, it does work for an air conditioner.

I’ve since switched all of my heaters to this Smartthings Virtual Thermostat (, but I don’t think it works for AC yet… So I will likely need to use this Piston for the summertime…

Here is the latest working version:


@essavant May I ask which handler you’re using for thermostat? Just the one already in IDE? I’ve got a piston now that doesn’t work for crap - not reporting correct operating state or anything so I’m wondering if the handler may be an issue.


I’m using a generic DH called “Simulated Thermostat”. I think its the Smartthings generic one.