SmartThings Community

New Virtual Thermostat With Device

thermostat
smartapp_hvac
dth_hvac

(Eliot Stocker) #9

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:


(Florian Robert Hits) #10

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.


(Gene Clark) #11

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.


(Adam Davidson) #12

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


(davidleejones1969@outlook.com) #13

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.

ta


(Brent ) #14

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


(Eliot Stocker) #15

@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.


(David R) #16

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?


(Ray) #17

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.


(Prj84) #18

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


(Enis Hoca) #19
  • 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


(Eliot Stocker) #20

@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

(Eliot Stocker) #21

just another small tweak my end, to fix the update that added new labels in the device handlers, should look nicer and the labels should make a bit of sense now :slight_smile:


(Enis Hoca) #22

Thanks a lot Eliot. I am in US and have checked out the Fahrenheit handlling (the fix was for selfish reasons :)). Appreciate you taking the time to the the original work and putting it all together, I am so glad I stumbled on to this thread, I was going to embark on doing something very similar. Mind if we collaborate and take it further? I would like to 2 things -

  1. Divvy up the responsibilities a little and have all the child thermostats under one manager, as @Navat604 is asking for - look at my X-10 node-red code, I am doing something similar.
  2. Have multiple types of child managers - my secondary thermostats are going to ESP8266 other wierd things. so no need have 2 levels of virtuals, if the main app can load different type of children

(Eliot Stocker) #23

@enis sounds good to me, I don’t have a lot of time to spend in this, I’m happy for the project to encapsulate more developers etc :slight_smile:


(Eliot Stocker) #24

Hi again,

I have pushed a few more fixes and tweaks to get things working 100% correctly.

New Feature:
Average temperature across multiple temperature sensors is now included

Enjoy


(Enis Hoca) #25

Couple of things not working now:
Shows Centigrade range for me my default range is Fahrenheit.
Alex can tell setpoint and current temperature but not set the temperature any more


(Eliot Stocker) #26

@enis
Damnit, I had a feeling that would happen, I read somewhere that there are problems getting the temperature scale.

If you switch the centigrade function to return false at the top i assume it works correctly after that?


(Enis Hoca) #27

yes - I did 2 things to make it work; one just returned false at top, second put parenthesis around the range () - the docs show parans, I don’t know if that had an effect. was thinking that C/F doesn’t change at all, so no need to be dynamic. the eval can be in initialize() or update() and can set a state var, then the function can just return the state.
That would be faster than calling an external function anyway.

Alexa is a lot of trial and error, I didn’t have time to play with it yet, last time it took all evening to find the sweet spot. They seem to be reading the specs in their own way, and that integration seems to be stateful.


(Eliot Stocker) #28

I see the Alexa issue, and I’ll get it resolved this afternoon :slight_smile:

update: alexa fixes now live on my github