[RELEASE] Advanced vThermostat - Virtual Thermostat HVAC control

Is there a way to change the temperature set point of the child app without having to delete it and recreate it?

Yes but through a thermostat scheduler like the built in one. Think of this app as the virtual embodiment of a traditional thermostat in its physical form, that is the wires connected to a circuit of some sort and a basic screen (if using a dashboard) without scheduling. The scheduling that sends signals to control the thermostat is hosted elsewhere, this is simply an interface. Now if you want to manually change the setpoint, add the thermostat to a dashboard and you have easier control versus the device page.

This morning, my vThermostat operating state changed from heating to idle in response to the temperature changing from 70.87 to 71. 20 when the heating setpoint was 72.0. I would have expected it to continue in heating until the temperature increased to the setpoint. Does this behavior indicate a bug in the code or is some feature active that I am unaware of?

This is not the way it should work, can you post me a snapshot of the logs and snapshot of the settings in the device page. I'll look into it tonight.


Thanks, I'll check the code tonight and let you know what I find. Just to be 100% sure, you are using a single temp sensor?

Yes, a single temp sensor.

1 Like

That is something I noticed as well. Once the temp gets within the range of the set point +/- 1 degree it shuts off heat, it does not have to cross the heat set point. Never said anything just took it as that is the way it is. I figured I would increase setpoint by 1 degree if I wanted it to go above a temp.

1 Like

Thanks for the info, I'll give it a look tonight!

ok, took a look at the code, and yes there is a small error, by 1/2 a degree, usually the way I wanted it to be is always try to stay within 1/2 the threshold value each side of the set point. But for some reason I forgot the 1/2 threshold value in my calculations. It will be fixed in the next version (in about a week).

So basically if you set the thermostat at 72°F, whenever the sensor reports anything between 71.5° and 72.5°, it will stop heating, when it goes under 71.5° it will start heating again. Right now it will stop heating whenever the sensor reports between 71° and 72°.

Not sure I follow what you are saying here. I would expect some hysteresis, so it goes from heat to idle when the temperature increases to >= 72.5 and goes from idle to heat when the temperature decreases to <= 71.5. When the temperature is between 71.5 and 72.5, it should keep doing whatever it is doing.

Exactly what I was trying to explain (in my brain at least), but for some reason I messed that part up a bit, or more like I did not analyze that part of the old code enough to be sure it worked as I was expecting.

Hi nclark - this app is awesome. I'm a newbie - my first time trying to automate anything in my home. But I find my a/c is turning on and off in very small intervals. Could you explain how I could widen the threshold in code please?

0.5c seems to be way to narrow and at some times of the day the a/c is kicking on and off once every three minutes.

Thanks again so much for your work on this.

There is a known issue that might resolve part of this in the next update (probably this weekend or somewhere in the middle of next week because I've been swamped at work). But switching on/off this fast is probably more about sensor placement more than anything unless your room is like 5' x 5' and you have a 12000 BTU A/C in there. I would start by moving the sensor around the room and see what that does.

I was using this exact same code for a dumb 5000 BTU A/C unit in a mini house (15' x 15' house), and it would cycle on/off every 15-30 minutes max. Sensor is on same wall as the A/C unit so that it's not in the stream of cold air ever.

But if you really want to play with the threshold, once installed, there is no easy way to change it directly, the easiest way right now is to either...

  • Remove the vThermostat you already have and make a new one selecting the threshold you want when first install screen.

OR

  • In the child app code, comment out line 58 and 86 (this bypasses startup options once it's been installed), but this will also revert setpoints to it's base settings.

BTW what are you using for temp sensors that are reporting so often?

Was looking at my thermostat on off times this morning, as it's the first time it's really been used recently. I have a space heater in my shop office and I am using the vThemostat to keep the temp at 50F. It hardly ever comes on as it usually doesn't get cold enough here. My shop is fairly well insulated, but we have had some cold days lately and this morning the heater needed to come on to keep the temp above the 50 setpoint. The thing is, there were times when it would only be on for a maybe 15 seconds.

From looking at the driver code. I haven't done any groovy coding in awhile, but it looks like you use the formula below and turn the heat on and off if that threshold is crossed.

if ( (heatingSetpoint - temp) >= threshold) callFor = "heating"

I have 5 sensors in my office and I use the temp avg app to create the sensor I use for the VThemostst. So it updates quite often. This can jump back and forth over this threshold, thus turning the heater on and off quickly.

I replaced the line above in the driver code with this:

if (current = "heating" && temp <= (heatingSetpoint + (threshold) /2) callFor = "heating"
 if (current = "idle" && temp <= (heatingSetpoint - (threshold) /2) callFor = "heating"

If I am reading it right when it updates it sets the variable "callFor" to the default of idle. You then check your mode and setpoints to determine if it should be heating or cooling. if "callFor" is not changed the thermostat goes idle.

This seems to be working. If idle I want it to start heating when it drops .5 degree below the setpoint. If it is currently heating I want to shut off once it is .5 degree above the setpoint. This is using the 1 degree threshold currently set in the code.

Just FYi. Maybe you can use this, otherwise it will hold me over until you can do an official update. I also use two other instances of the thermostat on another hub and they work fine as is since the temp doesn't update very often.

thanks, it works good but i noticed a small issue that was not present in smartthings, not sure if bug or intentional.
Since the threshold is 0.5 it means that if i set my temperature cu 20C degrees, it should keep the heater on until it reaches 20.6C then turn it back on when it goes below 19.5C
Well, it doesn't work like that, i see that when it reaches 19.6C it's already turning it off.
Does anyone now what needs to be changed in the code to fix this? This is making my heater turn on/off too often.
Please not that i have only used a heater while creating the thermostat, don't need anything for cooling if that makes any difference.
take a look at the logs below
image
edit:
i think i found the line with the problem
if ( (heatingSetpoint - temp) >= threshold) callFor = "heating"
this needs to be tweaked a bit, i ll try to mess a bit with it with my basic programming skills to see if i can make it right
testing now this new code so see if it works

changing this line

if ( (heatingSetpoint - temp) >= threshold) callFor = "heating"

to these lines

if ((current == "idle" && (heatingSetpoint - temp) >= threshold) || (current == "heating" && (temp - heatingSetpoint ) <= threshold) ){
callFor = "heating"
}

I'll be re-doing that part of code this week (will have a few hours to myself finally). As pointed above by reid.a.baldwin above, there is a small bug in the way it was coded. I'll look at the code you wrote and if it's the way I was thinking of implementing it, I'll just copy/paste it and let you know (and give credit :slight_smile:).

i finished doing 2 tests and seems to be working fine now and didin't even had to rebuild the thermostats , thanks
also you might want to increase the timeout for emergency mode.
Currently is set to 1 hour and my sensors report the temp only when is changing and sometimes they take even 2-3 hours . Might be wise to increase the timeout to at least 6 hours. Cheers

Thanks for the feedback.

Emergency mode over 65 minutes makes no sense at all, the emergency mode only kicks in if you are heating, if everything is idle, and they report only every 3-4, no problem and no emergency mode.

If you are heating and it takes more than 1 hour (or 3-4 hours like you stated) until they report a change in temperature you should either change the heater (it's not large enough for what you need) or change the sensors with something that reports more often.

I have a 5500W garage heater that heats a large garage (24'x40'), in normal mode set at 5°C it will work for about 10 minutes every 1/2 hour when the outside temps are -20°C. I use 2 ST multi-sensors on the garage doors for temp reporting. If I try to get the temps to 15°C it will struggle to get there but the sensors keep reporting approximately a heat increase every so often and usually within 10-20 minutes max each.

If you want to take the chance and change the max, go ahead, but don't come and ask me what went wrong when it happens, this is a safety feature and I will not be changing anything to it. Sorry.

is floor heating and nobody lives in the house yet. So if the floor is like really cold (off for days), it takes time until it gets hot enough to start heating the room and even when it does get to heating temperature, the floor is less than 30 C so obviously it won't heat up as fast as traditional systems but it will also keep the room heated many hours after is stopped too.
When i 1st used the app the thermostat went right away in emergency mode because there was no report for more than 1 hour so the heather didin't even got to start .
I've set my temp sensors to only report when is a temp change and not less than 1 hour to reduce traffic as i have over 20 sensors but it would probably be a good idea to set them to 15-20 mins reporting since after analyzing temp jumped more than 1.3 C from 1 report to another which is too much. This is a new setup i'm still experimenting .
anyway it was just a suggestion , i can edit it for myself , thanks