[RELEASE] New Virtual Thermostat With Device

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:

https://github.com/enishoca/SmartThings-VirtualThermostat-WithDTH/pull/1/commits/68961e42290800d834feccd7751fb9d31c4c7fab?file-filters%5B%5D=#diff-6b85cfbc4777d3b542e32b39fecd82ab

And here’s the device handler fork:
https://github.com/dantor19/SmartThings-VirtualThermostat-WithDTH/commit/9fd313aa120bf9a8298f51f5ce61ffab7dbadd3f

2 Likes

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"
thermostat.setEmergencyMode(true)
} 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”
outlets.on()
log.debug(“Outlets on 1”)
thermostat.setCoolingStatus(true)
} else {
coolingOff(true)
log.debug(“cooling off 6”)
}
}

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

https://github.com/dantor19/SmartThingsPublic/blob/97ec91463338917f37ee74dcb4c68aa838c254d6/smartapps/piratemedia/smartthings/virtual-thermostat-with-device.src/virtual-thermostat-with-device.groovy

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.

I’ve had a quick look (and I’m knew to Smartthings) but it appears all you need to do is modify the device handler code:

Modify line 27: command “setVirtualTemperature”, [“number”]
To be: command “setVirtualTemperature”, [“string”]

Modify line 243: if(hsp + 1.0 > highRange()) return;
To be: if(hsp + 0.5 > highRange()) return;

Modify line 244: setHeatingSetpoint(hsp + 1.0)
To be: setHeatingSetpoint(hsp + 0.5)

Modify line: 249: if(hsp - 1.0 < lowRange()) return;
To be: if(hsp - 0.5 < lowRange()) return;

Modify line 250: setHeatingSetpoint(hsp - 1.0)
To be: setHeatingSetpoint(hsp - 0.5)

Modify line 255: if(hsp + 1.0 > highRange()) return;
To be: if(hsp + 0.5 > highRange()) return;

Modify line 256: setHeatingSetpoint(hsp + 1.0)
To be: setHeatingSetpoint(hsp + 0.5)

Modify line 261: if(hsp - 1.0 < lowRange()) return;
To be: if(hsp - 0.5 < lowRange()) return;

Modify line 262: setHeatingSetpoint(hsp - 1.0)
To be: setHeatingSetpoint(hsp - 0.5)

Hope this helps :slight_smile:

J.

Hi there,
I just installed the DH and device. Seem great! But…how the hell can i link my ACs and temp sensors to this thermostat? Thanks!

I’m trying to get my AC to work with this too, without the need for a outlet on/off.

Is there a way perhaps with a piston to do something like.

If thermostat heating setpoint is 21c
then
send ifttt (applet that sends 21c to my AC)

If thermostat heating setpoint is 22c
then
send ifttt (applet that sends 22c to my AC)

Thing I want is manual control and time control.

If I slide the temp in the VT up to 23C I want the AC to be set to 23C and be able to set away / night temperature and timed ones!

I’m just not able to figure out how. Thanks!

New to Smartthings, came from Vera and trying to figure all of this out. I installed the 2 apps and the dth and made the change to false to get Fahrenheit. Works perfectly in the classic app. Im really trying to do everything in the new app so I don’t have to look in two different places. In the new app the thermo displays correctly and it shows in Fahrenheit. The problem is that the slider to set them temperature shows 0 - 40 degrees. This is also the only option when I try to create a automation or scene. I’ve looked at the code extensively and just cant figure out how to change this value from 0 to 40 to 40 to 90. I temporarily got around this by creating an automation in the classic app to change the temperature at certain times. Like I said, I don’t want to maintain automation’s in both the new and classic app. Any help with this code to make it work in the new app would be appreciated. Im used to programming everything in Lua for Vera and just started trying to work with Groovy.

@eliotstocker Thanks for the work done on this awesome DTH / app. I’m to control my boiler, which is controlled by a “SSR302 Boiler two channel receiver” This uses a modified “Fibaro FGS-222 Double Relay Switch” dth.
The virtual thermostat switches the boiler on & 15 minutes it switches it’s self off. Virtual thermostat thinks it is still on of course. This may be because the SSR302 needs to receive regular a heartbeat. The SSR321 thermostat dth polls the boiler controller every 5 minutes & boiler will go on indefinately.

Anyone have any ideas on how to get the virtual thermostat to poll the boiler controller ??

Hi guys,

is it possible to set the temperature by 0.5°C? Few comments back asked this one guy, but the sollution (changing code of DH) didnt work for me.

Thanks!

the app works great except that in the new smartthings app , only on main dashboard the thrmostat is stuck on “checking status” instead of showing the temp as in the classic app.
since the developer hasn`t been active for awhile, does anyone know how to fix this?

Same here. Even tried to remove and add new thermostat.

Can’t get Heating set point to go above 40 deg F in the new app. Works in the old app. But we’re all going to need to use the new one before too long. Currently are reading Deg F.

edit see below

edit: see below

OK implementing cooling is above my pay grade. Here is my version with the temperature displays fixed, plus the correct vid for this to work in the new app. This version displays in C. If you need it to display F you will have to edit one false/true line in the code, see other posts in this thread about that.

https://github.com/Matvei27/SmartThings-VirtualThermostat-WithDTH

2 Likes