[OBSOLETE] New Virtual Thermostat With Device

SmartThings Virtual Thermostat With Virtual Device

This smart app will create 1 or more Virtual thermostats by combining 1 or more temperature sensors and 1 or more outlet switches. A contact sensor can also be added to automagically turn off the heating if the door is left open etc.


  • Only single Temperature sensor and smart switch required
  • Google Home and Alexa Support for setting/getting Temperature and Mode
  • Manager app included to manage multiple different virtual thermostats
  • Contact sensor enabled to automagically disable heating when a door is left open etc
  • Multiple temperature sensors enabled for average temperature
  • Heating on time visible in device for today and yesterday


Github Integration:
Owner: eliotstocker
Name: SmartThings-VirtualThermostat-WithDTH
Branch: master


  • Cooling systems
  • Better F/C scale integration from hub preference

Oh my god I’d been working on a webCoRE piston to tackle this issue and it’s been a struggle to keep it working. I see you mentioned heating, but would this also work for an air conditioner? Also you mentioned it works with Alexa - can you ask Alexa for the thermostat temperature? I’m going to install this very soon to check it out, but want to thank you very much for doing this!

1 Like

Ok it looks like it’s only for heating particularly since the thermostat only goes up to 32 degrees, but suppose that’s in Celsius which I’d want changed to Fahrenheit to match the rest of my devices. That’s too bad. What’s even worse is I’d have no idea how to edit this to make it work for me. I really like the concept though.

1 Like

Just another thing to note - I’m not sure if Alexa is able to tell me the thermostat temperature or not, but every time I asked she says,”I’m not quite sure what went wrong.”

1 Like

Hi Gene,

I’m sure I could probably add in some code to switch into a Cooling mode or something, I’ll have a think about it and see what I can come up with when I find a bit more free time.

I haven’t done too much testing with Alexa, though it did seem to be giving me some info, mostly I use Google home with appears to be working exactly like my best thermostat (via NST Manager in smartthings)
I’ll do a bit of testing with Alexa later in the week and see if I can see any issues my side.

This is exactly what I’ve been looking for, Thanks!!!

Any ideas though why it won’t show the SetpointUp and SetpointDown arrows on my ActionTiles Dashboard though? @tgauchat

@eliotstocker, can I ask why you decided to set the heating threshold to 1.0 rather than zero?

From the looks of it at the moment, If you have a setpoint of 20 degrees, it will keep heating until it hits 21 degrees, and then it won’t start heating again until it goes back down to 19. If you had a more sensitive sensor, you could even start heating again at 19.9, which would save energy.

@NOITAIDAR good point, ill update the smart app to allow configuration of the threshold, for my usage my temperature sensor only outputs whole numbers, so this works for my needs, but i see how it would be better set to something like 0.1 or 0 in other scenarios :slight_smile:

ill take a look at ActionTiles and see if i can work out what command the device is missing and see whats causing the issues there.

@GRClark i had a look on my echo and you’re right, it shows up which is all i checked before, but it seems that it cant see the temperature or control the device, whats even weirder is that my nest also shows the same (using NST manager, so it could be some sort of limitation that i have inherited by copying some of their code, or some limitations with Virtual thermostat devices in general?)

hey guys, i have updated the DTH and Smart app to include a few new small tweaks etc:

  • set temperature threshold in smartapp
  • now there is differentiation between Off and Idle (off is grey and idle is green, also made emergency heating red)
  • added heatSetpointUp and heatSetpointDown functions incase they were required for ActionTiles issue, this also fixed that the heat up and down buttons didnt work
  • updated the repo structure to work with github sync

@GRClark i haven’t had time yet to add the cooling functionality, ill try and get that in soon :slight_smile: i have been looking at Echo though, not quite sure yet why it doesnt work and what i need to do to make it work, does anyone know of any device types (thermostats) that can be controlled with alexa? seems odd that it works perfectly with Google Assistant but not alexa

github repo sync settings:
Owner: eliotstocker
Name: SmartThings-VirtualThermostat-WithDTH
Branch: master

let me know if you find any issues with the new version :slight_smile:


Very nice,

thanks for your effort, it is what I needed. I would suggest a few things: setpoint to be with decimal, to integrate cooling funtion and the choice of selection of the heating / cooling / auto and actiontiles full integration(the heating working).

thank you.

Yes I’d like to thank you for at least putting in the work and effort creating this smartapp - so much other stuff is focused on physical thermostat devices that it’s hard finding stuff like you’re doing. I’ve been using webCoRE for rules and triggers, but the main reasons for wanting something like this would be Alexa integration to specify setpoints and request thermostat temperature aka inside temperature.

I’ve updated to the newest version of your smartapp and so far there’s still the aesthetic issue of not being able to go above 32 degrees on the thermostat inside the SmartThings app plus Alexa still says something went wrong when asking for temperature.

1 Like

All new features work perfectly, Thanks Eliot, and Great Job!

this is my first time on here so please be gentle, i have just purchased the hub and this smart app is exactly what i need! how do i go about putting this on the app. i have downloaded the code ect.


See this informative post by @JDRoberts who always does great technical write ups and who I have found some of the best info from. Also the forum has a pretty good search. So you can search and find most answers you need.

FAQ: An Overview of Using Custom Code in SmartThings

@GRClark my bad, i completely forgot about adding fahrenheit, ill make sure thats added in the next release.

I’m a little stuck with alexa integration right now, as we know it shows up in alexa, but alexa doesnt seem to have access to the current temperature, and cant control the device.
I’m finding it hard getting any info on what functions alexa is expecting in order to be able to achive these tasks, as i said above, NST manager thermostat also has the same issues with alexa. ill keep looking at it when i get time though, I’m sure it must be doable.

I’m also interested in this smartapp as well as I’ve been trying to do my own in webCore. Any chance you could also add the ability to select multiple temp sensors and base the current temp on their average?

Thank you for your work. Very sharp looking. Would it be possible to make the Smartapps a manager and all the virtual thermometers child devices? Maybe just me using multiple virtual thermometers but I would love to keep them under one Smartapps for neatness and easy access and configure.

I have successfully added 2 Virtual thermostats. But now I only get “An unexpected Error has occurred” after filling out all settings in Smart App.

I got this error when adding the two first thermostats as well, but it got successful when manually adding a device (It then automatically found a new Thermostat automatically and I could delete the one I manually added)

What to do…? I have three more to add as well…

I get this error in the log:
java.lang.NullPointerException: Cannot get property ‘id’ on null object

  • Fixed a couple exceptions that were breaking the code
  • Fixed Issues with Alexa support - now you can set and query the thermostat from Alexa
    Alex what is thermostat set to?
    Alexa set thermostat to 55
    Alexa what is the thermostat temperature?
  • Completed Fahrenheit handling - you will need to change the compileForC function and set retVal = false to make it work for Fahrenheit
    def compileForC() {
	    def retVal = true   // if using C mode, set this to true so that enums and colors are correct (due to ST issue of compile time evaluation)
	    return retVal
  • Removed the ‘C’ from the main tile, this was causing the whole thing to go on a second line on an iPhone 6 and look ugly.

@eliotstocker sending you a pull request on github if you want to accept these changes

1 Like

@enis Thats great, i have pulled your changes into the main repo now.
thanks so much for your fixes, that Alexa problem in particular, i just couldn’t get my head around it.

not that @enis has finished the Fahrenheit handling i have added some code to get the TemperatureScale unity from the hub, so you should automagically get C or F depending on what is set for your hub, Im in the UK so mine is set to C, can someone with a hub set to F check if its working as expected?

next on my list of tweaks:

  • multiple Temperature sensors
  • Add cooling systems
1 Like