Python Plugin: Smart Virtual Thermostat

For heating/cooling related questions in Domoticz

Moderator: leecollings

Electrocut
Posts: 22
Joined: Sunday 04 May 2014 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Electrocut »

Hi!

I have just started my heating system a few days ago.
I have 3 remarks :)
  1. Ambient temperature regulation

    For the moment, sometimes the plugin is not really accurate. I will wait a few days, and try to adjust the "Calculation cycle" value.

    Setpoint was 17.5°C (Economy)

    - Ambient temperature history
    domoticz_04.png
    domoticz_04.png (25.69 KiB) Viewed 6105 times
    - Boiler relay history
    2017-10-08 05:13:42 Off
    2017-10-08 04:13:41 Off
    2017-10-08 02:13:29 On
    2017-10-08 01:18:28 Off
    2017-10-08 01:13:28 On
    2017-10-08 00:13:27 Off
    2017-10-07 23:13:27 Off
    2017-10-07 22:13:27 Off
  2. Normal / economy switching

    When I switch from Normal to economy mode (or vice versa), the plugin seems to wait for the end of the calculation cycle, before activating / deactivating the relay. I switched to Normal mode at 08:00, but the boiler has started at 08:13. Is it the normal behavior?

    - Thermostat Mode History

    Code: Select all

    2017-10-08 08:00:03	Normal
    2017-10-07 23:30:02	Economy
    - Boiler relay

    Code: Select all

    2017-10-08 10:14:07	On
    2017-10-08 09:13:56	On
    2017-10-08 08:13:44	On
    2017-10-08 07:13:43	Off
    2017-10-08 06:13:43	Off
    2017-10-08 05:13:42	Off
  3. Bug with temperature + humidity sensors

    I have tried to use an temperature + humidity sensor (from Weather underground), as Outside Temperature Sensor.
    Raw data looks like this:
    domoticz_05.png
    domoticz_05.png (15.35 KiB) Viewed 6105 times
    -> It has broken everything ;) The plugin was not activating the boiler at all. Error log output:

    Code: Select all

    2017-10-05 04:28:09.697  Error: (Thermostat) 'onHeartbeat' failed 'TypeError':'unorderable types: float() > NoneType()'.
    2017-10-05 04:28:09.697  Error: (Thermostat) ----> Line 494 in /home/pi/domoticz/plugins/SmartVirtualThermostat/plugin.py, function onHeartbeat
    2017-10-05 04:28:09.697  Error: (Thermostat) ----> Line 282 in /home/pi/domoticz/plugins/SmartVirtualThermostat/plugin.py, function onHeartbeat
    2017-10-05 04:28:09.697  Error: (Thermostat) ----> Line 299 in /home/pi/domoticz/plugins/SmartVirtualThermostat/plugin.py, function AutoMode
    2017-10-05 04:28:09.697  Error: (Thermostat) ----> Line 353 in /home/pi/domoticz/plugins/SmartVirtualThermostat/plugin.py, function AutoCallib
    2017-10-05 05:28:10.509  Error: (Thermostat) 'onHeartbeat' failed 'TypeError':'unorderable types: float() > NoneType()'.
    2017-10-05 05:28:10.509  Error: (Thermostat) ----> Line 494 in /home/pi/domoticz/plugins/SmartVirtualThermostat/plugin.py, function onHeartbeat
    2017-10-05 05:28:10.509  Error: (Thermostat) ----> Line 282 in /home/pi/domoticz/plugins/SmartVirtualThermostat/plugin.py, function onHeartbeat
    2017-10-05 05:28:10.510  Error: (Thermostat) ----> Line 299 in /home/pi/domoticz/plugins/SmartVirtualThermostat/plugin.py, function AutoMode
    2017-10-05 05:28:10.510  Error: (Thermostat) ----> Line 353 in /home/pi/domoticz/plugins/SmartVirtualThermostat/plugin.py, function AutoCallib
    To fix this, I had to:
    - Replace my Outside Temperature Sensor with a "Temperature only" sensor
    - In Domoticz User variable, edit the variable, "Thermostat-InternalVariables":
    From: {'ConstC': 87.8, 'LastSetPoint': 20.0, 'ConstT': 1.9, 'ALStatus': 1, 'nbCC': 5, 'LastPwr': 100, 'LastOutT': None, 'nbCT': 21, 'LastInT': 17.9}
    To: {'ConstC': 87.8, 'LastSetPoint': 20.0, 'ConstT': 1.9, 'ALStatus': 1, 'nbCC': 5, 'LastPwr': 100, 'LastOutT': 10, 'nbCT': 21, 'LastInT': 17.9}
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Logread »

Electrocut wrote: Sunday 08 October 2017 11:30 I have just started my heating system a few days ago.
I have 3 remarks :)
  1. Ambient temperature regulation
    Let it settle a bit... and indeed adjust the calculation interval ? These parameters seem to be require some trial and error adjustments based on the thermal properties of your home and how the temp sensors are set up. Monitoring how the constC and constT values evolve over time can be useful (use Verbose logging in the plugin parameters to see these changes in domoticz log)... if the calculations converge over time to an optimum value you are on the right track. On the other hand if these keep jumping up and down without a pattern, you need to change some of the settings.
  2. Normal / economy switching
    Good pick... will fix that in next version
  3. Bug with temperature + humidity sensors
    This is not a bug... by design these combos (temp + hum) do not report a « temp » value in the domoticz Json API... the usual work around for any use of these for temperature monitoring purposes involves setting up a dummy temp sensor and having a lua script monitor the combo device and update the dummy temp device... it is well documented in the wiki at http://www.domoticz.com/wiki/Virtual_weather_devices
Electrocut
Posts: 22
Joined: Sunday 04 May 2014 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Electrocut »

Logread wrote: Sunday 08 October 2017 12:05Ambient temperature regulation

Let it settle a bit...
I will :)
Normal / economy switching

Good pick... will fix that in next version
Great :mrgreen:
Bug with temperature + humidity sensors

the usual work around for any use of these for temperature monitoring purposes involves setting up a dummy temp sensor and having a lua script monitor the combo device and update the dummy temp device... it is well documented in the wiki at http://www.domoticz.com/wiki/Virtual_weather_devices
Good point :) I will create a virtual temperature sensors, as explained in the wiki.

Thanks :mrgreen:
Goldwing1973
Posts: 69
Joined: Monday 08 August 2016 22:55
Target OS: Linux
Domoticz version: Stable
Location: Netherlands, Alphen aan den Rijn
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Goldwing1973 »

Question :

I have a nest (v1) and also 5 Popp Thermostat’s, (1 in each bedroom and 1 in the living room).
Can I use this project to control the nest and popp thermostats to heat each room individually?
Over 50 Z-Wave Devices (Fibaro and Neo), 4xLogitech Hub, 2xPhilips Hue Bridge+55 Lights, 1x Nest Thermostat, 2xNetatmo Weather Station, 1xSkybell v1 Doorbell, 3 Kwikset KEVO Doorlocks and Domoticz running on a Intel NUC
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Logread »

@Golwing1973,
No (and I cannot see how this would work...). This plugin aims at replacing unsatisfactory existing thermostats, typically unsophisticated hysterisis based ones like found in many electrical heaters.
Goldwing1973
Posts: 69
Joined: Monday 08 August 2016 22:55
Target OS: Linux
Domoticz version: Stable
Location: Netherlands, Alphen aan den Rijn
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Goldwing1973 »

Ok, to bad.
To be sure, the popp thermostats are radiator valves and not thermostats you fix on the wall. (https://www.amazon.fr/Popp-Thermostat-c ... 01I5N9KFY/)
Only wall mounted thermostat is the Nest.
Over 50 Z-Wave Devices (Fibaro and Neo), 4xLogitech Hub, 2xPhilips Hue Bridge+55 Lights, 1x Nest Thermostat, 2xNetatmo Weather Station, 1xSkybell v1 Doorbell, 3 Kwikset KEVO Doorlocks and Domoticz running on a Intel NUC
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Logread »

Version 0.3.4 is available from GitHub, fixing the "normal/economy" switching bug uncovered by @Electrocut (thanks to him).
Electrocut
Posts: 22
Joined: Sunday 04 May 2014 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Electrocut »

Seems working great, my heater start immediately when I switch from Economy to Normal mode 8-)
Thanks!
napo7
Posts: 20
Joined: Monday 06 February 2017 8:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by napo7 »

Hi @LogRead,

I think there is a bug in the code :

Line 316-317, there is :

Code: Select all

         if (power > 0) and (power <= self.minheattime):
                power = 0  # Seuil mini de power
I think it should be :

Code: Select all

         if (power > 0) and (power <= self.minheattime):
                         power = self.minheattime  # Seuil mini de power
Without this, the "minHeatTime" variable is never used...
Am I right ?
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Logread »

@napo7,

You are right. Thanks for pointing out. I’ll fix that and publish a new version soon.
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Logread »

Version 0.3.5 is available from GitHub for install/upgrade as per instructions at https://www.domoticz.com/wiki/Plugins/S ... ostat.html.
It fixes the bug uncovered by @napo7.
strelniece
Posts: 10
Joined: Sunday 20 December 2015 18:32
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Sweden
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by strelniece »

Hello and thanks for a great plug-in, made me (partly) use Domoticz again :)

I have some thoughts though. I might not be using it quite as intended, I have created 3 different thermostats since I have different temperatures around the house (cooler in the bedroom, for example) and no heaters in some rooms, but hope that it still will work out.

My main concern is that I also heat my house with a stove using wood. It is very manual, so only used when I am at home, awake and not in a too lazy mood :) My question is now how much this will affect the regulation. Any ideas?

Also, I would like to be able to control them from outside Domoticz (I'm using node-red to everything else in my home, only use Domoticz for my thermostats). Are there any way to control the thermostats with MQTT/JSON?

thanks

//f

EDIT: I found out how to control from node-red :) it makes me think it might not be that complicated to add one (or more) set-point-level?
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Logread »

strelniece wrote: Monday 13 November 2017 20:23 Hello and thanks for a great plug-in, made me (partly) use Domoticz again :)
You are welcome :)
Creating multiple thermostats is the way to go to control individual rooms or zones, as long as you have a decentralized heating (e.g. electric convectors, radiators with individual valve control such as the new Fibaro zwave heat controller) specific to that zone.

Mixed heating sources will certainly impact the regulation, but it is hard to predict how... for instance if your wood stove heats "more" than the source controlled by the smart virtual thermostat, the learning algorithm of the latter will skip learning...

On your comment on MQTT, definitely it is out of the box with Domoticz so no need for the plugin to address this.

On the possibility to add more setpoints, I am not sure I see the point. I actually was initially not keen to have two setpoints for the plugin - i.e. one for normal mode and one for eco mode - but settled for it as I found it more user friendly to have a "normal/eco" switch than changing a setpoint value via a script or timer.
Skippiemanz
Posts: 230
Joined: Sunday 14 July 2013 20:21
Target OS: Linux
Domoticz version: 4.10233
Location: Alkmaar, The Netherlands
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Skippiemanz »

Hi, i was just trying youre plugin. Looks realy promising.

But suddenly domoticz crashed with this in the log:

2017-11-14 20:45:59.378 Error: Domoticz received fatal signal 11 !...
2017-11-14 20:45:59.379 Error: /home/pi/domoticz/domoticz() [0x230390]
2017-11-14 20:45:59.380 Error: /home/pi/domoticz/domoticz(_Z14signal_handleri+0x4c) [0x230448]
2017-11-14 20:45:59.380 Error: /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer_v2+0) [0x76c9b180]

Is this a general python error or connected to your plugin?
napo7
Posts: 20
Joined: Monday 06 February 2017 8:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by napo7 »

Hi,

I experienced the same problem.
I was thinking at first that it was related to xiaomi-robot vacuum, but I had disabled this plugin first, and still experiencing the same error.

Experienced this on Beta version.
Skippiemanz
Posts: 230
Joined: Sunday 14 July 2013 20:21
Target OS: Linux
Domoticz version: 4.10233
Location: Alkmaar, The Netherlands
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Skippiemanz »

napo7 wrote: Tuesday 14 November 2017 21:46 Hi,

I experienced the same problem.
I was thinking at first that it was related to xiaomi-robot vacuum, but I had disabled this plugin first, and still experiencing the same error.

Experienced this on Beta version.
These steps fixed it for me:

Code: Select all

cd plugins/SVT
get reset –-hard
git pull --force
sudo chmod +x plugin.py
sudo /etc/init.d/domoticz.sh restart
napo7
Posts: 20
Joined: Monday 06 February 2017 8:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by napo7 »

Did not worked for me...Still crashing this morning after forcing update of the script.

I'll disable it to be sure it is this script that cause failing !
Electrocut
Posts: 22
Joined: Sunday 04 May 2014 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Electrocut »

I was having the problem with Domoticz v3.8153 stable version.

Fixed since I switch to the beta version (currently using V3.8450 beta).
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Logread »

Plugin works perflectly fine for me both on a production system (Raspberry Pi2 on Raspbian Jessie, domoticz beta 3.8564) and a test Raspberry Pi3 on Rasbian Stretch and domoticz beta 3.8564.
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by jake »

Being able to set a different setpoint for each virtual thermostat would be ideal to regulate bath, bed and study rooms in the house without the need of physical thermostats. The only invesment would be in a temperature sensor (if not included in the heating device/remote controlled radiator thermostat) and the remote controlled radiator thermostat itself.

I wonder how to tell the boiler to start heating through the OTGW device when multiple virtual thermostats are used with their own setpoints.

EDIT: I now see that the plugin requires a Domoticz (virtual) switch to turn the heating system on/off. I guess that will take care of multiple thermostats. However, I wonder if OTGW will allow this within Domoticz, I think you can only update the setpoint of the physical thermostat that it is connected with.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest