999LV / SmartVirtualThermostat

Smart Virtual Thermostat python plugin for Domoticz home automation system
MIT License
41 stars 31 forks source link

Weighted average of sensors #46

Closed rrozema closed 3 years ago

rrozema commented 3 years ago

I have multiple sensors in my ground floor with an almost "open kitchen" (there is a doorway but no door between the living room and the kitchen). In this one big room I have 4 sensors:

The average temperature calculated from these 4 sensors led to some problems though. Let me first explain what I noticed: The sensor below the kitchen radiator is close to the floor, so that always gives a lower reading: usually it is 1.8 degrees below the ceiling temperature. Also, the both sensors in the kitchen are influenced much by any cooking/backing activities going on in the kitchen. When cooking or backing goes on in the kitchen, often the living room part cools down a lot. Furthermore, the sensor at the radiator in the living room is a close to the radiator, a little to the side and above it, so that heats up very quickly when the heater is on, but the rest of the room won't be at the reported temperature yet if we just started heating, so the heater shuts off too soon when it was cold in the entire room, resulting in the rest of the room heating up slowly and also in applying more heat too late when the room cools down.

I can fix most of the problems by only putting the central living room sensor in the list of inside sensors. But that way the temperature in the rest of the room is not taken into consideration at all: not what I wanted. Instead what I did was to make the averaging done over all the sensor idx's listed. i.e. if a sensor is listed twice, that sensor will be counted twice in the averaging. I've now put the central living room sensor in the list 3 times, with the other sensors listed only once. This makes the average is for 50% determined by the living room sensor, but the other sensors still help in determining the average temperature, which makes for a more evenly spread temperature rise and fall in the entire ground floor and external influences like sunshine and cooking/backing far less influence the heating in areas not warmed up by those external influences: the risk on overshooting the setpoint is less, and the response to changes is quick. I will put in a pull request soon, but I first want to enter other issues too that I tried to address.

999LV commented 3 years ago

Very creative approach indeed, but too user specific for merging in master IMHO. Thanks for PR though

rrozema commented 3 years ago

Why is this user specific? Anyone who's got more than one sensor in a room now gets an average that he's got no further control over. My suggestion changes nothing for existing users who have only 1 copy of a sensor in their list. Only those who want to experiment with the averaging, will put a sensor twice in the list to influence the averaging. Putting this feature in your source set would help me a lot to not have to keep checking if this is still working correctly with every merge. I don't see what your arguments could be not to include it?