[RELEASE] New Virtual Thermostat With Device

If time happens at x
Then with therm set temp

Repeat steps.

It’s that easy

@Modrica You can create a virtual swich to be controlled by this app. After that you can setup some rules in WebCore or in the Automation in new version of Smartthings phone app. This rules are to mirror the state of virtual switch to a real switch device. In this way, you can control multiple real switches or contact sensors.

any way to add a basic schedule to this?

I have a Virtual Thermostat set to turn on a heater in our TV room in the basement but I only want it to monitor from like 3pm till midnight Mon-Fri. 9am till Midnight on Sat and Sun. Nobody is down there the rest of the time so no need to heat. but the door at the top of the stairs is always open so the cats can get to there food and bathrooms…

I have another VT setup to monitor the sunroom and I am using the door open sensor and this works great. but that door open is different than the basement so I cant use it as a heating switch. No other switch at the moment that I could use that would only be open during certain hours.

nevermind, I setup a routine and setup when to auto adjust the temp up and down at specified times of the day.
Works perfect without having to add any additional code to this smart app.

the app works great on classic version but on latest version of smartthings it just reads the temps but you can’t modify the thermostat value. Is this still developed?any change to make it fully compatibile with new smartthings app or does anyone knows an alternative for the new app?

Is there a way to get this to run locally. I’ve been running this all winter and it works great.I Have multi able IR heating panels and a main heater, but lost internet last night without losing power and the heaters stayed on all night( was a little toasty in the house when i got up) usually i lose power and the internet at the same time

P.S great work on this

At the present time, no custom code can run locally. It all runs in the smartthings cloud.

The only things that can run locally are the official smart lighting feature as long as all the devices included are eligible to run like locally and a few parts of smart home monitor.

(And if you have the ADT model panel, its alerts can also run locally.)

But that’s it.

Hi guys

I would appreciate your assistance if possible. I tried to install the two parts but I ended up with a device named ‘Tiles Missing’ which cannot be removed from my home screen. I know it is a kind of stupid i did with the device handler but I don’t know how to remove it.

Any help/guidance appreciated

Thank you,

First off, great work! I’ve been monitoring this thread for a while, and am now beginning to implement these thermostats. I’ve successfully set up and built a piston in WebCore that mimics this functionality, but it is cumbersome and awkward https://community.webcore.co/t/working-thermostat-piston/5035. It requires feeding data into the setpoint and current temps of the Smartthings Simulated Thermostat. Another issue is the tendency for that device to automatically increase “current” temp values, requiring me to feed it readings every minute or so…

I wish to abandon that method and move all my thermostats to use this… however, I have two issues:

  1. I cannot get the Thermostat to show the set temperature in Fahrenheit - the “current temp” seems to use the hub preference, but the “set temp” still shows in Celsius

  2. Next is that this thermostat seems to turn the appliance switch off as required, but does not switch it on. I’m thinking that if item 1 is fixed (both readings are in °F versus a mix of °C & °F), this may fix itself.

Thanks very much for all the hard work!

I believe I found the answer to my problems! I missed the part about modifying the Thermostat Device Handler, and was trying to modify the Smart App to fix my Issues… Once I changed the “true” to “false”, my device operates as expected…


First bug i have encouncterrd since i got SmartThings. I have all thermostats showing ok, with the correct temp. But they don’t turn on the heaters. What can be wrong. The sensor values is correct. For example

Sensor value reads 20, heater set to 23. Wall plug doesn’t turn on.

I use fibaro wall plugs. I have 4 virtual thermostats with 4 wall plugs and 4 sensors. None of them are working. Or it shows that it’s heatinf to 23 degrees but none of the wall plugs are on.

Any tips?

@eliotstocker you still working with this?

1 Like

Hello all. I have attempted to modify this for cooling instead of heating, using some of the contributions above, and some of my own(my contributions were mainly just for modifying the GUI, and changing the word heat to cool throughout), but am now having some trouble.
When the desired temperature is set to a value lower than the temperature sensor reading, then the virtual switch turns on as expected. When, however, the desired temperature is set above the current temperature sensor reading, the virtual switch also gets a turn on command.
For some reason, no matter what I do, I cant get the virtual switch to turn off via this smart app. Any help here would be greatly appreciated.

Here’s the smart app fork:


And here’s the device handler fork:


I followed your code very quickly as I did not have the time to delve further and I observed something that could point to the issue you described with the turn-off command. See below – rows 193 to 197 in the Smart App fork.

log.debug "Heating in Emergency Mode Now"
outlet.on()  //HERE -- "outlet"
} else {
	log.debug "Heating off Now"
	outlets.off() //HERE -- "outletS"

Could it be related to outlet vs outletS (in case the user has specified multiple outlets to be handled) that’s causing the issue? Again, not sure of the code structure and logic, so this is just an observation that could point to the right direction.

Thank you for the effort! I hope I can take your work and modify the code at some point to support both heating and cooling via the GUI (with some sort of selection that would dictate the rest of the code to use the coresponding functions.

Yes! That seemed to do it! It seems like the rest of the program was getting hung up on this error. After changing outlet.on(), to outlets.on(), almost everything seems to work as it should. The only exception is that the emergency temp must be set to some value, otherwise the smart app always commands the outlets on for some reason. I suppose decent workaround for those who don’t wish to use this feature would be to just set the emergency temp to a very high setting. Annoying, but the best I can figure for now…

1 Like

I’m glad this helped solve the issue. Also, which version of the Smartthings app are you using – classic or new? When I’m using the new app, almost all thermostat controls (up/down etc) are not showing when clicking on the virtual thermo device (not automation).

I’m using the classic app. When I open the device/smartapp in the new app, I have the same lack of controls. I’ve been told that the new app isn’t really fully functional yet, and many smartapp/device features simply haven’t been implemented thus far, so this isn’t entirely surprising to me.

On an unrelated note, I’m trying to figure out a way to get a separate group of outlets to be excluded from the logic of this smartapp when a virtual switch is turned off. I’m thinking that the easiest way to do this would be to have two groups of outlets, lets say “outlets” and “excluded_outlets”, and a switch, say “exclude_switch”. I’m thinking I would then just modify the definitions for “coolingOn” and “coolingOff” to each include an if-then statement that references the state of “exclude_switch”. The problem is, that for the life of me, I can’t figure out to implement this into the code, or, for some reason, find any examples of similar implementations with virtual switches.
Also, do I have to modify the device handler as part of this process? Below is the excerpt mentioned above. Below that is a link to the full code.
Any help here would be extremely appreciated.

def coolingOn() {
if(thermostat.currentValue(‘thermostatMode’) == ‘cool’ || force) {
log.debug “Heating on Now”
log.debug(“Outlets on 1”)
} else {
log.debug(“cooling off 6”)

def coolingOff(coolingOff) {
def thisTemp = getAverageTemperature()
if (thisTemp >= emergencySetpoint) {
log.debug “Heating in Emergency Mode Now”
log.debug(“Outlets on 2”)
} else {
log.debug “Heating off Now”
log.debug(“outlets off 1”)
if(coolingOff) {
} else {


Ive managed to add a motion sensor to this. The heating only works if there has been motion within a present period, i use 10 mins. Not sure if I’ve done it the best way but it works a treat. Thanks for this its excellent

Recently installed this and love it…

I was wondering if anyone can guide me in changing the code to allow me to increase and decrease the target temp in 0.5 degree increments instead of 1.0 please? I’ve already managed to change the threshold to 0.3 in the app, but I would like finer control of the actual target.

I’ve had a look, but I’m struggling.

Recently installed this and love it…

I was wondering if anyone can guide me in changing the code to allow me to increase and decrease the target temp in 0.5 degree increments please?

I’ve had a look, but I’m struggling.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.