Creating a learning thermostat

The concept: There are some thermostats on the market that are learning thermostats, in that, if you program a schedule the thermostat will create an offset to that schedule in order to achieve the target set-point at the scheduled time. To clarify further, if I have a Morning schedule of temperature set-point 70F at 6am, most regular thermostats will simply raise the set-point to 70F at 6am. In reality, it might take 1 hour to raise the indoor temperature to 70F from the previous 62F it was overnight. The learning algorithm continually observes that and starts the heating function earlier in order to be 70F at 6am.

Even if you have a thermostat with this function built in, once you add it to Vera, Vera takes over and is setting the set-points for the thermostat on its schedule now.

I’ve searched the forums and found the Smart Virtual Thermostat plugin, but numerous problems and lack of further development have ruled it out for me.

At a high level, in order to emulate the learning function, one would need:
a) Persistent variables or arrays - ones that would survive Vera reboots and power cycles
b) Simple math functions to calculate averages and differences, and write the results to the persistent variables.
c) Schedules whose start times could be modified by the persistent variables.

Does this sound like something that could be done in a PLEG? Or is it something that needs to be done in LUA code within a scene? Or something else?

Insights, thoughts, alternative ideas appreciated.

Thanks,
-TC

This would need to be a plugin.
The correct way to do this is to build a heat transfer function for your house/furnace.
This gets a little complicated since it’s not likely to be linear.
It’s a function of (Outdoor Temp, Indoor Temp, #Stages of Heating requested, Delta Indoor Temp Requested)

A simple running approximation of Delta Deg in Delta Time … would probably learn as the season changes … but would not work very well if you have rapid variations in external weather.

To heat a house from 64F to 68F is done in a different time when the outdoor temp is 0F vs 60F.

Instead of allowing vera to blindly set an HVAC schedule, I use a series of luup functions triggered from the gcal plugin. This way I orchestrate a few discrete events such as adjusting climate control, turning on the coffee pot and turning on lights. And all of those events adjust according to whether or not it’s a work day for me/wife or if we’re going to the gym in the morning, etc.

In my case I (currently) simply adjust the heat or air conditioning 30 minutes before it’s time to wake up. I haven’t taken the time to account for how long it actually takes the house to come to temperature, but it’s on my to-do list. The biggest factor as RTS mentioned is the outside weather.

To heat a house from 64F to 68F is done in a different time when the outdoor temp is 0F vs 60F.

Agreed, and I can get around that since my new heating unit (on-demand boiler and DHW) has an outdoor reset capability. Hopefully in practice it will deal with the variations of the outdoor temp on its own. So then I basically have to just deal with the transfer function of the room. But in reality it shouldn’t be too hard to build outdoor and indoor temperature coefficient variables to deal with the outdoor temperature fluctuations.

Now that i know it has to be a plugin, this gives me some food for thought. I’m actually accomplishing this manually now by examining the trends I see in Datamine graphs of my measured indoor temp, setpoint times, heat on times, and outdoor temperature.

Thanks for the ideas.

-TC

Agreed, and I can get around that since my new heating unit (on-demand boiler and DHW) has an outdoor reset capability. Hopefully in practice it will deal with the variations of the outdoor temp on its own.

That does not eliminate it, it just adds more variables to the heat transfer model.
The boiler is probably designed to optimize energy savings … and that introduces more factors into the model.
As I said … a moving average of Delta-Temp/Delta-Time will be the simplest algorithm for prediction. It just will not be very accurate with High outside temperature swings.

If you had an outdoor temperature sensor you could use the temperature value as an input to start the heat ramp up earlier if it is colder outside and then just have several options.

For example:

< 20 outside start 1 hour early
< 30 outside and not already on start 50 min early
< 40 outside and not already on start 30 min early
< 50 outside and not already on start 15 min early

You would need to play with the times but could probably get pretty close to a working static model without needing a plugin.

PD

PD, while a possible idea, I’m still not sure how to make a variable start time schedule in PLEG (or vera). I don’t believe PLEG accepts variables for the start time parameter. So that leaves me with having to create 4 to 5 different morning schedules, with different start times, and condition evaluation logic based on the outside temperature reading (Weather Plugin). I’m pretty sure that would work, but it would fall short of a true learning algorithm. Still, an interesting idea.

You would not need 4-5 schedules, just 4-5 condition statements in PLEG. You could then use a logical statement that if any of them are true and the heat is not already on then perform an action to set the target temperature to 70 degrees.