Use temp sensor to set virtual thermostat (current) temp

I'm remote from my Hub and can't see the exact rules I'm using*, but in general terms:

Create a Rule Machine rule like:

    Trigger (Temperature Changed) /* where the Temperature device can be the virtual "Average Temperature" device */
    send %value% to VirtualThermostat(CurrentTemp) 

For a better explanation, see: Simple Virtual Thermostat Temp updater
and Average All Device Driver

Also, the forum search interface does return lots of useful hits:
Search results for 'virtual thermostat current temperature' - Hubitat

I ended up putting together a modified virtual thermostat device handler coupled with an app (actually parent/child, parent just allows you to add new instances of the vThermostat App). The app lets you select one or more sensors (will use average temp if more than 1), and 1 or more outlets for heating and/or cooling. Once setup, it allows the virtual thermostat device to be used just as a normal thermostat would be.

You can find the virtual device handler, parent, and child apps here:

3 Likes

Can’t wait to give this a go. I’ve searched everywhere for a good Hubitat stat. I’ll let you know how I get on. Thanks very much for sharing this Josh. :+1:t3::+1:t3::+1:t3::+1:t3::+1:t3::+1:t3::+1:t3:

1 Like

Thanks for this @josh208 , I was using a couple of rules with a Virtual Thermostat and everything was working fine, but since this new app can use more than 1 sensor and also have several outlets/switches. This might be good for future expansion.

Really cool, one suggestion if you are willing... I have a Deadman function in my heater control, so if the temp sensor does not report for x minutes, turn off the heater. That way a busted sensor or dead battery does not cause the heater to go into runaway.

2 Likes

Nice idea, wish I had thought about that one, but this is a real possible problem. Having two sensors would most likely make this problem almost impossible but in a single sensor setup, this is a must now that you mention it.

1 Like

In rule machine, it was simple to setup. I'd have to look into josh's code, or see if a virtual switch could be added as a disable mechanism.

@napalmcsr Good call regarding deadman function. As I primarily use this at my part-time cabin an hour from home, I can certainly appreciate the concern.

I just added this and pushed to github. It is implemented in the device handler. No app change was required. Just update the device code. For devices that are already configured you will need to go into the device and set the maxUpdateInterval or it will just use the hardcoded limit of 3 hours.

If no temperature update is received in "maxUpdateInterval" minutes then it sets mode to "emergencyStop" which will cause the operatingState to always be "idle" and so the app will shutoff all heating/cooling outlets. There is an auto recover feature which will return to the previous mode if an update is later received while in emergencyStop mode. maxUpdateInterval is configurable, defaults to 65 minutes, and has a hard-coded sanity limit of 3 hours.

I have only done only limited testing, so please provide feedback if you see any issues.

For anyone that tried pulling code shortly after this post... apologies, but I had pushed the device code into the child app. That is fixed, and I also just updated the device code about 15 minutes ago to do some general cleanup, as well as to fix the logic for handling 'Auto' mode.

I have tried to tweak it all to use degreesC and only use heating stat (deleting the cooling stat). I have it working to some extent but would love it if you could sort a version like that....
Would you have the time?

Cheers Josh

I will look into adding degreesC in the near future. As for heating only, you can simply leave the mode as 'heat'. Stripping out the other modes could make it incompatible with certain other integrations (ie. Alexa) as many services expect to see specific attributes.

Cheers Josh really appreciate that :+1:t3:

Hi Josh, any updates for Celsius degrees ?

2 Likes

So lost dont k kw how to right rule to make my sensor temp send its temp info to my virtual thermostat just new to this and cant figure it out not sure how to write the string

Got it working but really need the celcius 2

I tweaked Josh’s driver and app. Let me know if you want it and I’ll try to share :+1:

How do you just make a virtual thermostat equal to a temperature sensor? Which rule machine option do u use? Basically google can read thermostats but not temperature sensors. So ya