Python Plugin: Smart Virtual Thermostat

For heating/cooling related questions in Domoticz

Moderator: leecollings

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 »

Thanks. I suppose the 0.2 delta temperature is what is triggering the adaption of ConstC.
I will check the code and increase that number over there to 0,3 or 0.4 and go from there.
Thanks for porting, overall it works really well!
Bazooka
Posts: 3
Joined: Saturday 22 December 2018 10:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Bazooka »

jake wrote: Wednesday 13 February 2019 21:47 What is it that you can't get to work? Splitting the temperature to a separate device, or using the correctly splitted temp. sensor in the SVT plugin.

If splitting is the issue, there is a wiki on how to do this in LUA. There is an example in dzVents LUA as well. The dzVents LUA version is much easier to understand.
Sorry for the confusion. I got the split of a temp/hum sensor to work perfectly fine. Data transferred and displays on a dummy.

However, I can't get SVT till recognize the the dummy as a thermometer:
"2019-02-14 17:46:36.582 Error: (SVT) No Inside Temperature found... Switching Thermostat Off".

I can't find any obvious errors. Checked IDx multiple times to avail.

Any suggestions?
Bazooka
Posts: 3
Joined: Saturday 22 December 2018 10:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Bazooka »

Bazooka wrote: Thursday 14 February 2019 17:50 ...

Any suggestions?
Never mind, I got it working, Must have been a typo somewhere. :roll:
wjarka
Posts: 3
Joined: Friday 15 February 2019 20:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by wjarka »

Hey,
I have encountered a problem. After I installed the plugin and added the hardware, when I try to go to the list of devices I get this error: "Problem retrieving devices!". After that, domoticz crashes. The only way to get it back up is to remove the plugin, restart domoticz, delete the SVT hardware. After that, I can restore the plugin and it does not crash. However, adding hardware again does the same thing.

Also, no Devices are created by this. I tried with both Temp + Hum as well as just Temp. The result is the same.

Anyone experienced that?
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 »

I know the code is ported from the Vera, so we don't have the actual creater of the code around. Still I was checking out the 'self learning method' from the plugin.

When applicable the ConstC calcuation is like: ConstC x a factor ( (Setpoint - TlastIN) / (room T - TlastIN) X a time factor leveler. )
This makes sense to me. The new value is added to 50x the old value and afterwards divided by 51, so small impact.

However, on line 445 the ConstT is recalcuated like Const + a factor

Since that factor is made up from very different parameters and even ConstC (a big number) is included. the outcome is so small that it doesn't do anything in a calcuation. (setpoint - room T) / (setpoint - TlastOUT) x ConstC)

Code: Select all

# learning ConstC (line 433)
            ConstC = (self.Internals['ConstC'] * ((self.Internals['LastSetPoint'] - self.Internals['LastInT']) /
                                                  (self.intemp - self.Internals['LastInT']) *
                                                  (timedelta.total_seconds(now - self.lastcalc) /
                                                   (self.calculate_period * 60))))
            self.WriteLog("New calc for ConstC = {}".format(ConstC), "Verbose")
            self.Internals['ConstC'] = round((self.Internals['ConstC'] * self.Internals['nbCC'] + ConstC) /
                                             (self.Internals['nbCC'] + 1), 1)
            self.Internals['nbCC'] = min(self.Internals['nbCC'] + 1, 50)
            self.WriteLog("ConstC updated to {}".format(self.Internals['ConstC']), "Verbose")
        elif self.outtemp is not None and self.Internals['LastSetPoint'] > self.Internals['LastOutT']:
            # learning ConstT (line 444)
            ConstT = (self.Internals['ConstT'] + ((self.Internals['LastSetPoint'] - self.intemp) /
                                                  (self.Internals['LastSetPoint'] - self.Internals['LastOutT']) *
                                                  self.Internals['ConstC'] *
                                                  (timedelta.total_seconds(now - self.lastcalc) /
                                                   (self.calculate_period * 60))))
            self.WriteLog("New calc for ConstT = {}".format(ConstT), "Verbose")
            self.Internals['ConstT'] = round((self.Internals['ConstT'] * self.Internals['nbCT'] + ConstT) /
                                             (self.Internals['nbCT'] + 1), 1)
            self.Internals['nbCT'] = min(self.Internals['nbCT'] + 1, 50)
            self.WriteLog("ConstT updated to {}".format(self.Internals['ConstT']), "Verbose")
I would say that an equivalent approach should be taken both for ConstC and ConstT:
ConstT = ConstT x ( (setpoint - TlastOut) / (room T - TlastOut x a time factor leveler)
wjarka
Posts: 3
Joined: Friday 15 February 2019 20:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by wjarka »

wjarka wrote: Friday 15 February 2019 20:10 Hey,
I have encountered a problem. After I installed the plugin and added the hardware, when I try to go to the list of devices I get this error: "Problem retrieving devices!". After that, domoticz crashes. The only way to get it back up is to remove the plugin, restart domoticz, delete the SVT hardware. After that, I can restore the plugin and it does not crash. However, adding hardware again does the same thing.

Also, no Devices are created by this. I tried with both Temp + Hum as well as just Temp. The result is the same.

Anyone experienced that?
I fixed this with http://domoticz.com/forum/viewtopic.php ... 20#p178279

However, another question. Any floor heating users here? Any advice on what calculating interval and minimum heating time I should start with? And / or what should I look at to make adjustments later?

I started with 60 minutes cycles with 10% minimum heating time.

Also, I set logs to Verbose, but I only see ConstT being logged, not ConstC. Is it only logging the one that has changed? Or should both be there?

P.S. Sorry if any of this was asked before. Still reading through this thread.
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 »

wjarka wrote: Monday 18 February 2019 20:09 However, another question. Any floor heating users here? Any advice on what calculating interval and minimum heating time I should start with? And / or what should I look at to make adjustments later?

I started with 60 minutes cycles with 10% minimum heating time.
I have floor heating. I went from 60 minutes to 75. That is still to short too prevent overshoot when the setpoint is higher then the room temperature. Currently I have it at 90 minutes, but too short to see what the result is.
Minimum time I try to keep at 15 minutes, but with the 90 minute window, I put it at 15%.
wjarka
Posts: 3
Joined: Friday 15 February 2019 20:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by wjarka »

jake wrote: Monday 18 February 2019 21:08
wjarka wrote: Monday 18 February 2019 20:09 However, another question. Any floor heating users here? Any advice on what calculating interval and minimum heating time I should start with? And / or what should I look at to make adjustments later?

I started with 60 minutes cycles with 10% minimum heating time.
I have floor heating. I went from 60 minutes to 75. That is still to short too prevent overshoot when the setpoint is higher then the room temperature. Currently I have it at 90 minutes, but too short to see what the result is.
Minimum time I try to keep at 15 minutes, but with the 90 minute window, I put it at 15%.
What kind of floor material you have? Ceramic tiles? PVC?

It's been fairly sunny today, so the temperature never dropped enough, but I will keep it at 60 minutes and 10% for a bit. Let me know how your new settings worked for you. That might be my next stop if mine don't work ;)
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 »

wjarka wrote: Monday 18 February 2019 21:16
jake wrote: Monday 18 February 2019 21:08
wjarka wrote: Monday 18 February 2019 20:09 However, another question. Any floor heating users here? Any advice on what calculating interval and minimum heating time I should start with? And / or what should I look at to make adjustments later?

I started with 60 minutes cycles with 10% minimum heating time.
I have floor heating. I went from 60 minutes to 75. That is still to short too prevent overshoot when the setpoint is higher then the room temperature. Currently I have it at 90 minutes, but too short to see what the result is.
Minimum time I try to keep at 15 minutes, but with the 90 minute window, I put it at 15%.
What kind of floor material you have? Ceramic tiles? PVC?

It's been fairly sunny today, so the temperature never dropped enough, but I will keep it at 60 minutes and 10% for a bit. Let me know how your new settings worked for you. That might be my next stop if mine don't work ;)
Ceramic tiles on a 5-6cm sand-cement base. below that a wooden floor which is insulated on the bottom side with 13cm Rockwool (Rc 3.5)

Be careful with the 'short' time of 60 minutes. The autolearn function will think that you don't have enough power to reach setpoint within that time frame and will therefore keep increasing the ConstC value (see for calculation some posts above). This will result in overshoot, because the response time of the floor is so long, that you pump way too much heat into the floor. This will be released by the floor for a long time after reaching the setpoint.
I therefore increased the time frame to 90 minutes, decreased the ConstC from 74 to 54, while also changing the nbCC value from 50 to 25 for more quick learning. Let's see what it does. This can take a while, since I set the setpoint to 18'C. This will only activate the SVT in the morning, because we usually heat the house during the day with the wood stove, or with the sun lately.
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 »

To improve accuracy of the necessary energy for heating, I thought about applying a more accurate outside temperature: because I use a 90 minute window, the temperature can be quite different at that point in time.
With my Openweathermap ID I pulled in the weather forcast and used the next and next + 3hr forecasted temperature. I used a dzVents script to be able to update a virtual outside forecasted temperature sensor. This sensor will hold the average temperature in the SVT window of calculations and I want to use it as my outside temperature sensor within SVT.

My issue now is, I would like to update the forecasted temperature right at the point of decision for the heating length calculation. I guess this is not possible. Can I play with the uservariable of SVT? Will this uservariable been looked at during the heating period, especially the 'LastPwr' value as an input of when to switch off the heater?

If so, I can manipulate that value by redoing the calculation with my LUA script and modified outside temperature. Afterwards I can update the SVT uservariable for LastPwr.
EmKaRo
Posts: 8
Joined: Tuesday 11 December 2018 19:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by EmKaRo »

Hello,

Could you please help me with below error:


2019-04-16 10:34:34.244 Error: (Termostat-gora 2) 'onHeartbeat' failed 'TypeError':'unorderable types: float() > NoneType()'.
2019-04-16 10:34:34.244 Error: (Termostat-gora 2) ----> Line 632 in /usr/local/domoticz/var/plugins/SVT/plugin.py, function onHeartbeat
2019-04-16 10:34:34.244 Error: (Termostat-gora 2) ----> Line 351 in /usr/local/domoticz/var/plugins/SVT/plugin.py, function onHeartbeat
2019-04-16 10:34:34.244 Error: (Termostat-gora 2) ----> Line 377 in /usr/local/domoticz/var/plugins/SVT/plugin.py, function AutoMode
2019-04-16 10:34:34.244 Error: (Termostat-gora 2) ----> Line 441 in /usr/local/domoticz/var/plugins/SVT/plugin.py, function AutoCallib
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 »

Looks like something is wrong with the thermostat device. Is your temperature device a correct type, not including humidity, for instance. Correct idx number?
EmKaRo
Posts: 8
Joined: Tuesday 11 December 2018 19:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by EmKaRo »

jake wrote: Tuesday 16 April 2019 12:00 Looks like something is wrong with the thermostat device. Is your temperature device a correct type, not including humidity, for instance. Correct idx number?
All is correct, temp sensor is DS18B20 and it was working fine for more than 5 months untill this error occured.
pipiche
Posts: 2005
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by pipiche »

What is the best approach when we have a setup which doesn't have any Switch. In fact my setup is only based on Thermostatic Valves (where I can put SetPoint).

Should I create a Virtual Switch which would be then give to SVT for managing the heating ?
In such case what is/are the suggestion for SetPoint value on the Thermostatic Valves ?
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 »

pipiche wrote: Wednesday 17 April 2019 17:33 What is the best approach when we have a setup which doesn't have any Switch. In fact my setup is only based on Thermostatic Valves (where I can put SetPoint).

Should I create a Virtual Switch which would be then give to SVT for managing the heating ?
In such case what is/are the suggestion for SetPoint value on the Thermostatic Valves ?
I think the plugin is not for you... driving thermostats with another thermostat seems a bit far fetched if I may.
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 »


pipiche wrote:What is the best approach when we have a setup which doesn't have any Switch. In fact my setup is only based on Thermostatic Valves (where I can put SetPoint).

Should I create a Virtual Switch which would be then give to SVT for managing the heating ?
In such case what is/are the suggestion for SetPoint value on the Thermostatic Valves ?
I think it depends what level of setpoint you want to set. If you only choose between 0 and 100%, you can use the virtual switch to drive the valve setpoint with dzvents or blockly.
HvdW
Posts: 591
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by HvdW »

Hi,
I have setup and connected SVT since 2 hours.
Everything went smooth.
No problems.
A big compliment for the creators.

I'll have to wait a few days before the system settles.
Does it have to settle in normal and in ECO mode?
Or does normal mode set eco as well.

Are the default times the optimum for room heating with radiators?
I have read something about minimum time of 5 minutes.
Does that apply to all 5 settings?
Bugs bug me.
mcmikev
Posts: 146
Joined: Tuesday 26 May 2015 8:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: right here
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by mcmikev »

Hi Logread,

I thought I had seen a post about my question but cannot seem to find it in the topice, so sorry for asking (if it was, I cannot find it).

Here is my question.

I have created a blocky , and use bluetooth presence detection to see if someone is downstairs or upstairs.
When downstairs the thermostat should be in mode Normal, when upstairs the thermostat should go into Economy mode.

I think I have that part right , but it never changes the status.

So when downstairs, a dummy switch is flipped. That flipped switch is used in blocky to set thermostat mode into Normal , but it does not trigger.
Is this because of the python framework created devices?
I try to change the Thermostat to level 10 or level 20 with blocky. level 0 = off but not used in thermostat mode, level 10 = normal and level 20=eco.

Can you shed a light on this? I seem to hit a dead end myself right now.
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 »

mcmikev wrote: Friday 25 October 2019 19:51 So when downstairs, a dummy switch is flipped. That flipped switch is used in blocky to set thermostat mode into Normal , but it does not trigger.
Is this because of the python framework created devices?
I try to change the Thermostat to level 10 or level 20 with blocky. level 0 = off but not used in thermostat mode, level 10 = normal and level 20=eco.
I am afraid I cannot help you as I do not use blockly and do not know how it handles Selector switches... but a simple search leads me to believe that you should find some meterial such as this: https://www.domoticz.com/forum/viewtop ... &start=500
rirethy
Posts: 8
Joined: Friday 26 September 2014 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by rirethy »

Hello,

I'm trying to setup a domoticz configuration with Smart Virtual Thermostat.

I got the plugin through a git clone and set the plugin.py file as executable.

My configuration :
  • Raspberry PI B+
    Domoticz on current beta version : Domoticz V4.11474
    Python 3.4.2
    SVT plugin version 0.4.8
Here are the libpython installed :
  • libpython-stdlib:armhf install
    libpython2.7:armhf install
    libpython2.7-minimal:armhf install
    libpython2.7-stdlib:armhf install
    libpython3-dev:armhf install
    libpython3-stdlib:armhf install
    libpython3.4:armhf install
    libpython3.4-dev:armhf install
    libpython3.4-minimal:armhf install
    libpython3.4-stdlib:armhf install
the internal temperature and external temperature sensor are a Netatmo weather station. The heater switch is a Qubino (Goap) ZMNHJD1 Flush Dimmer Pilot Wire+

When I restart domoticz after installation of SVT, under configuration/hardware, I can setup a new Smart Virtual Thermostat. I enter all the needed parameters, and validate the hardware.
At this point, I have a small popup saying that the corresponding devices have been created.
But, then, Domoticz is crashed.

I tried to set the log feature of SVT to "all" to have some information in a log file, but I never got any information in domoticz log. I maybee missed something concerning the log.....

I tried many different configurations concerning the IP of domoticz, and the login/password : 127.0.0.1 or the "real" ip address on the LAN, and with or without login/password.

if I restart Domoticz, it runs some seconds, and then hang.

To have a running Domoticz, I have to rename the plugin.py, so that it is no more recognize as a plugin. After running Domoticz that way, I have a SVT hardwre setup, but absolutely no SVT devices.

If anyone may help....
I can make any needed tries or configuration changes.

Thanks in advance.
2 Raspberry Pi (xbian + Domoticz)
Synology NAS 214 Play
NAS and Raspberrys monitoring
Sigma design Zwave+ USB controler
1 Aeon MiniMote
1 Qubino ZMNHAA2 (Flush 1 relay)
1 Qubino ZMNHCA2 (Flush shutter)
4 1-Wire Temp Sensor DS18B20
1 relay GPIO controled
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest