Python Plugin: Smart Virtual Thermostat

For heating/cooling related questions in Domoticz

Moderator: leecollings

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 »

Here are logs I have when setting up a SVT hardware device in inactive mode, and then after, activate the SVT hardware . Till the SVT hardware is not activate, domotics run fine.
As soon as I Active it, I ave no more anything in the logs, and Domotics is hang.
logs done with SVT in "debug-ALL"

INIT :
2019-11-09 15:29:38.058 Status: Domoticz V4.11474 (c)2012-2019 GizMoCuz
2019-11-09 15:29:38.063 Status: Build Hash: 12feb06f1, Date: 2019-11-08 16:33:53
2019-11-09 15:29:38.064 Status: Startup Path: /home/pi/domoticz/
2019-11-09 15:29:38.897 Status: PluginSystem: Started, Python version '3.4.2'.
2019-11-09 15:29:38.902 Status: Using 1-Wire support (kernel W1 module)...
2019-11-09 15:29:38.965 Status: WebServer(HTTP) started on address: :: with port 8080
2019-11-09 15:29:38.995 Status: WebServer(SSL) started on address: :: with port 443
2019-11-09 15:29:39.039 Status: TCPServer: shared server started...
2019-11-09 15:29:39.039 Status: RxQueue: queue worker started...
2019-11-09 15:29:41.053 Status: Hardware Monitor: Started
2019-11-09 15:29:41.072 Status: 1Wire: Added Device: 28-000005b62d2f
2019-11-09 15:29:41.972 Status: (Teleinfo) Teleinfo device uses serial port: /dev/ttyAMA0 at 1200 bauds
2019-11-09 15:29:41.973 Status: Darksky: Started...
2019-11-09 15:29:41.984 Status: (Teleinfo) CRC checks will be performed on incoming data
2019-11-09 15:29:41.985 Status: GPIO: This hardware is deprecated. Please transfer to the new SysFS hardware type!
2019-11-09 15:29:41.991 Status: Kodi: Started
2019-11-09 15:29:41.993 Status: Wunderground: Worker started...
2019-11-09 15:29:41.994 Status: Netatmo: Worker started...
2019-11-09 15:29:41.997 Status: (Linky) Started.
2019-11-09 15:29:42.003 Status: Pinger: Worker started...
2019-11-09 15:29:42.045 Status: Sysfs GPIO: Startup - polling:no interrupts:no debounce:50msec inputs:0 outputs:1
2019-11-09 15:29:42.046 Status: (Ampli) Started.
2019-11-09 15:29:42.048 Status: EventSystem: reset all events...
2019-11-09 15:29:42.051 Status: EventSystem: reset all device statuses...
2019-11-09 15:29:42.353 Status: (Teleinfo) Teleinfo CRC check mode set to 1
2019-11-09 15:29:42.404 Status: PluginSystem: Entering work loop.
2019-11-09 15:29:42.503 Status: OpenZWave: using config in: /home/pi/domoticz/Config/
2019-11-09 15:29:43.104 Status: OpenZWave: Starting...
2019-11-09 15:29:43.104 Status: OpenZWave: Version: 1.6-943-gacce060e-dirty
2019-11-09 15:29:45.030 Status: (Linky) Entering work loop.
2019-11-09 15:29:45.032 Status: (Linky) Initialized version 1.2.0, author 'Barberousse'
2019-11-09 15:29:45.968 Status: Python EventSystem: Initalizing event module.
2019-11-09 15:29:45.993 Status: EventSystem: Started
2019-11-09 15:29:45.994 Status: EventSystem: Queue thread started...
2019-11-09 15:29:46.902 Status: (Ampli) Initialized version 2.0.2, author 'thomasvillagers'
2019-11-09 15:29:46.913 Status: (Ampli) Entering work loop.
2019-11-09 15:29:54.875 Status: OpenZWave: User Alert - Manufacturer_specific.xml out of Date
2019-11-09 15:29:54.876 Status: OpenZWave: Received unhandled notification type (30) from HomeID: 0, NodeID: 0 (0x00)
2019-11-09 15:29:54.876 Status: OpenZWave: User Alert - Manufacturer_specific.xml out of Date
2019-11-09 15:29:54.876 Status: OpenZWave: ManufacturerSpecificDB Ready
2019-11-09 15:29:55.271 Status: OpenZWave: Driver Ready
2019-11-09 15:29:55.282 Status: SendSwitchIfNotExists: Device '3.instance.1.index.0.commandClasses.38' (Level) with DeviceID '00000301' matches '3.instance.1.index.0.commandClasses.37' (Switch). Domoticz will use the Dimmer (and hide the Switch).
2019-11-09 15:29:55.365 Status: SendSwitchIfNotExists: Device '7.instance.1.index.0.commandClasses.38' (Level) with DeviceID '00000701' matches '7.instance.1.index.0.commandClasses.37' (Switch). Domoticz will use the Dimmer (and hide the Switch).
2019-11-09 15:29:59.300 Status: OpenZWave: Received timeout notification from HomeID: 3623020742, NodeID: 3 (0x03)
2019-11-09 15:30:03.195 Status: Incoming connection from: 192.168.165.211
2019-11-09 15:30:03.746 Status: Incoming connection from: 192.168.165.200
2019-11-09 15:30:04.045 Status: OpenZWave: Received timeout notification from HomeID: 3623020742, NodeID: 3 (0x03)
2019-11-09 15:30:07.839 Status: OpenZWave: Received timeout notification from HomeID: 3623020742, NodeID: 4 (0x04)
2019-11-09 15:30:11.598 Status: OpenZWave: Received timeout notification from HomeID: 3623020742, NodeID: 7 (0x07)
2019-11-09 15:30:11.891 Status: Incoming connection from: 192.168.165.210
2019-11-09 15:30:12.014 GPIO: Optional connected Master Domoticz now updates its status
2019-11-09 15:30:12.403 Status: Sysfs GPIO: Update master devices
2019-11-09 15:30:14.735 Status: OpenZWave: Received timeout notification from HomeID: 3623020742, NodeID: 7 (0x07)
2019-11-09 15:30:17.871 Status: OpenZWave: Received timeout notification from HomeID: 3623020742, NodeID: 7 (0x07)
2019-11-09 15:30:20.875 Status: OpenZWave: Received timeout notification from HomeID: 3623020742, NodeID: 7 (0x07)
2019-11-09 15:30:23.879 Status: OpenZWave: Received timeout notification from HomeID: 3623020742, NodeID: 7 (0x07)
2019-11-09 15:30:26.882 Status: OpenZWave: Received timeout notification from HomeID: 3623020742, NodeID: 7 (0x07)
2019-11-09 15:30:29.890 Status: OpenZWave: Received timeout notification from HomeID: 3623020742, NodeID: 7 (0x07)
2019-11-09 15:30:30.575 Status: OpenZWave: Awake Nodes queried

...
...
When I activate, the SVT hardware, The Only line I get in the log is :
2019-11-09 15:31:22.724 Status: (SVT) Started.
And then notinig, everithing is crashed
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
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 »

Me again :-)

I try sevral things :
using other temperature sensors, using other switch, ....

I never get any created switch on creating a SVT hardware, and always domoticz crashed.
Usually, I ain't got any log befor crash, but once, I got that :
2019-11-17 13:55:50.301 Error: Linky xxxx hardware (20) thread seems to have ended unexpectedly
2019-11-17 13:55:50.301 Error: Ampli hardware (24) thread seems to have ended unexpectedly
2019-11-17 13:55:50.302 Error: SVT hardware (26) thread seems to have ended unexpectedly
2019-11-17 13:56:04.307 Error: Linky xxxx hardware (20) thread seems to have ended unexpectedly
2019-11-17 13:56:04.308 Error: Ampli hardware (24) thread seems to have ended unexpectedly
2019-11-17 13:56:04.308 Error: TV hardware (25) thread seems to have ended unexpectedly
2019-11-17 13:56:04.309 Error: SVT hardware (26) thread seems to have ended unexpectedly
2019-11-17 13:56:18.313 Error: Motherboard hardware (1) thread seems to have ended unexpectedly
2019-11-17 13:56:18.314 Error: Linky xxxx hardware (20) thread seems to have ended unexpectedly
And absolutely no log from any other sensor

I am on raspberry, under raspbian Jessie, and tried with python 3.4 and 3.5

I'll try now to debug the plugin. I'll learn how to do it, as I never develop a plugin for domoticz.

If any one may help.....
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
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 »

rirethy wrote: Sunday 17 November 2019 14:08 If any one may help.....
I am the plugin’s author, but no way I can help you with such logs... we can take it offline by pm to avoid painful adds to the forum thread, but a few suggestions:
- enable new devices creation in domoticZ
- enable debug logging in domoticz (your logs are useless for now)
- check your SSL settings... often an issue (Google is your friend)

be aware the plugin is used by many many users and your issue seems more related to your setup than to the plugin itself...
uzturre
Posts: 14
Joined: Wednesday 13 June 2018 10:41
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Basque Country
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by uzturre »

Works fine!!!


2019-11-17 13:38:20.789 Status: (TRMSTATO INT) Next calculation time will be : 2019-11-17 14:23:20.788687
2019-11-17 13:38:20.937 Status: (TRMSTATO INT) Temperatures: Inside = 17.5 / Outside = 11.8
2019-11-17 13:38:20.938 Status: (TRMSTATO INT) Calculation: Power = 100 -> heat duration = 45 minutes
2019-11-17 14:23:36.702 Status: (TRMSTATO INT) Next calculation time will be : 2019-11-17 15:08:36.701334
2019-11-17 14:23:36.822 Status: (TRMSTATO INT) Temperatures: Inside = 18.7 / Outside = 12.2
2019-11-17 14:23:36.823 Status: (TRMSTATO INT) Calculation: Power = 100 -> heat duration = 45 minutes
2019-11-17 14:30:01.491 Status: Schedule item started! Name: TERMOSTATO MODO, Type: On Time, DevID: 10, Time: 2019-11-17 14:30:01
2019-11-17 14:30:01.558 Status: (TRMSTATO INT) Next calculation time will be : 2019-11-17 15:15:01.557832
2019-11-17 14:30:01.660 Status: (TRMSTATO INT) Temperatures: Inside = 18.9 / Outside = 12.6
2019-11-17 14:30:01.660 Status: (TRMSTATO INT) Calculation: Power = 100 -> heat duration = 45 minutes
2019-11-17 15:15:17.786 Status: (TRMSTATO INT) Next calculation time will be : 2019-11-17 16:00:17.785448
2019-11-17 15:15:17.912 Status: (TRMSTATO INT) Temperatures: Inside = 19.3 / Outside = 12.9
2019-11-17 15:15:17.913 Status: (TRMSTATO INT) Calculation: Power = 100 -> heat duration = 45 minutes
2019-11-17 15:53:17.076 Status: Incoming connection from: 192.xxxxxxxxx
2019-11-17 16:00:28.854 Status: (TRMSTATO INT) Next calculation time will be : 2019-11-17 16:45:28.853709
2019-11-17 16:00:29.199 Status: (TRMSTATO INT) previously timed out temperature sensor 'TEMPERATURA SALA' is back online
2019-11-17 16:00:29.224 Status: (TRMSTATO INT) Temperatures: Inside = 20.9 / Outside = 13.2
2019-11-17 16:00:29.225 Status: (TRMSTATO INT) Temperature exceeds setpoint
2019-11-17 16:00:29.225 Status: (TRMSTATO INT) Calculation: Power = 0 -> heat duration = 0 minutes
2019-11-17 16:45:30.190 Status: (TRMSTATO INT) Next calculation time will be : 2019-11-17 17:30:30.190170
2019-11-17 16:45:30.297 Status: (TRMSTATO INT) Temperatures: Inside = 19.9 / Outside = 12.2
2019-11-17 16:45:30.297 Status: (TRMSTATO INT) Calculation: Power = 69.4 -> heat duration = 31 minutes
2019-11-17 17:30:30.153 Status: Incoming connection from: 192.xxxxxxxx
2019-11-17 17:30:31.127 Status: (TRMSTATO INT) Next calculation time will be : 2019-11-17 18:15:31.126720
2019-11-17 17:30:31.315 Status: (TRMSTATO INT) Temperatures: Inside = 20.7 / Outside = 12.6
2019-11-17 17:30:31.315 Status: (TRMSTATO INT) Temperature exceeds setpoint
2019-11-17 17:30:31.315 Status: (TRMSTATO INT) Calculation: Power = 0 -> heat duration = 0 minutes
2019-11-17 18:15:32.019 Status: (TRMSTATO INT) Next calculation time will be : 2019-11-17 19:00:32.018193
2019-11-17 18:15:32.142 Status: (TRMSTATO INT) Temperatures: Inside = 20.1 / Outside = 11.1
2019-11-17 18:15:32.150 Status: (TRMSTATO INT) New calc for ConstC = 38.90829448851852
2019-11-17 18:15:32.151 Status: (TRMSTATO INT) ConstC updated to 75.5
2019-11-17 18:15:32.152 Status: (TRMSTATO INT) Calculation: Power = 62.8 -> heat duration = 28 minutes
2019-11-17 18:16:21.732 Status: Incoming connection from: 192.xxxxxxxx


Thx!!!!
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 »

Logread wrote: Sunday 17 November 2019 14:53
I am the plugin’s author, but no way I can help you with such logs... we can take it offline by pm to avoid painful adds to the forum thread, but a few suggestions:
- enable new devices creation in domoticZ
- enable debug logging in domoticz (your logs are useless for now)
- check your SSL settings... often an issue (Google is your friend)

be aware the plugin is used by many many users and your issue seems more related to your setup than to the plugin itself...
After many tests and tries, I had issues with my python. I was on raspbian Jessie, and Jessie come with python 3.4. As I need, At least Python 3.5, I tried to compile python a python 3.5 and then 3.6. Everything was working well except Smart Virtual Thermostat.
I've upgraded my system to raspbian Buster (that is from version 8 to version 10). Buster comes with Python 3.7.3.

Now Smart Virtual Thermostat works perfect, as well as other plugins.

So, was an issue with my setup, and after halt a day of use, Smart Virtual Thermostat seems to work pretty good.

Thanks for the work on this plugin
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
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 everyone,

Could you please help me with a problem, with termostat strange behavior. It trigers heating for 5 seconds, even if it's not needed.
I set minimum heat per cycle for 5 minutes. Here below is the log:
2019-12-12 10:15:36.154 Status: (Termostat-gora) Initialized version 0.4.4, author 'logread'
2019-12-12 10:15:36.154 Status: (Termostat-gora) Entering work loop.
2019-12-12 10:15:45.908 (Termostat-gora) Inside Temperature = 20.8
2019-12-12 10:15:45.908 (Termostat-gora) Outside Temperature = -0.7
2019-12-12 10:15:45.908 (Termostat-gora) Calculation: Power = 0 -> heat duration = 0 minutes
2019-12-12 10:16:01.048 Status: User: Admin initiated a switch command (38/Piec gora/On)
2019-12-12 10:16:06.374 (Piec 2) Light/Switch (Piec gora)
2019-12-12 10:16:06.367 Status: User: Admin initiated a switch command (38/Piec gora/Off)
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 »


EmKaRo wrote:Hello everyone,

Could you please help me with a problem, with termostat strange behavior. It trigers heating for 5 seconds, even if it's not needed.
I set minimum heat per cycle for 5 minutes. Here below is the log:
2019-12-12 10:15:36.154 Status: (Termostat-gora) Initialized version 0.4.4, author 'logread'
2019-12-12 10:15:36.154 Status: (Termostat-gora) Entering work loop.
2019-12-12 10:15:45.908 (Termostat-gora) Inside Temperature = 20.8
2019-12-12 10:15:45.908 (Termostat-gora) Outside Temperature = -0.7
2019-12-12 10:15:45.908 (Termostat-gora) Calculation: Power = 0 -> heat duration = 0 minutes
2019-12-12 10:16:01.048 Status: User: Admin initiated a switch command (38/Piec gora/On)
2019-12-12 10:16:06.374 (Piec 2) Light/Switch (Piec gora)
2019-12-12 10:16:06.367 Status: User: Admin initiated a switch command (38/Piec gora/Off)
First of all, I would update to the latest version, 0.4.8 and see if the problem is still there (although I my domoticz log it still initializes as a version 0.4.7. No clue how that happens. The plugin.py file definitely shows 0.4.8.
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 keep having the following log lines (and resultings heater burns) which are not correct:

Code: Select all

2019-12-23 07:17:45.175  Status: (SVT) Next calculation time will be : 2019-12-23 09:17:45.174763
2019-12-23 07:17:45.251  Status: (SVT) Temperatures: Inside = 18.8 / Outside = 7.7
2019-12-23 07:17:45.256  Status: (SVT) Calculated power is 0, applying minimum power of 10
2019-12-23 07:17:45.258  Status: (SVT) Calculation: Power = 10 -> heat duration = 12 minutes
2019-12-23 07:17:45.359  Status: User: Admin initiated a switch command (296/SVT Heater/On)
while plowing through the plugin.py, I come across the following section which defines the results as shown here above:

Code: Select all

        if self.intemp > self.setpoint + self.deltamax:
            self.WriteLog("Temperature exceeds setpoint", "Verbose")
            overshoot = True
            power = 0
        else:
            overshoot = False
            if self.learn:
                self.AutoCallib()
            else:
                self.learn = True
            if self.outtemp is None:
                power = round((self.setpoint - self.intemp) * self.Internals["ConstC"], 1)
            else:
                power = round((self.setpoint - self.intemp) * self.Internals["ConstC"] +
                              (self.setpoint - self.outtemp) * self.Internals["ConstT"], 1)
            self.WriteLog(
                
        if power < 0:
            power = 0  # lower limit
        elif power > 100:
            power = 100  # upper limit

        # apply minimum power as required
        if power <= self.minheatpower and (Parameters["Mode4"] == "Forced" or not overshoot):
            self.WriteLog(
                "Calculated power is {}, applying minimum power of {}".format(power, self.minheatpower), "Verbose")
            power = self.minheatpower

        heatduration = round(power * self.calculate_period / 100)
        self.WriteLog("Calculation: Power = {} -> heat duration = {} minutes".format(power, heatduration), "Verbose")

        if power == 0:
            self.switchHeat(False)
            Domoticz.Debug("No heating requested !")
        else:
            self.endheat = datetime.now() + timedelta(minutes=heatduration)
In my case (constc=51.1 and constt =1.3) the calculation results in -18.8. This will be 'upgraded' to 0 power.

The trouble start below the comment line #apply minimum power as requested
Since the first IF checks first whether the calculated power < minimum power, this is always true in this case! The code never reaches the IF where is checked for a power being 0 itself.

My conclusion as a 'non programmer': the IF statements have to be turned around:
1: IF power is 0
2: IF power < minimum power
3: Else ...

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 »

jake wrote: Monday 23 December 2019 20:25 I keep having the following log lines (and resultings heater burns) which are not correct:

Code: Select all

2019-12-23 07:17:45.175  Status: (SVT) Next calculation time will be : 2019-12-23 09:17:45.174763
2019-12-23 07:17:45.251  Status: (SVT) Temperatures: Inside = 18.8 / Outside = 7.7
2019-12-23 07:17:45.256  Status: (SVT) Calculated power is 0, applying minimum power of 10
2019-12-23 07:17:45.258  Status: (SVT) Calculation: Power = 10 -> heat duration = 12 minutes
2019-12-23 07:17:45.359  Status: User: Admin initiated a switch command (296/SVT Heater/On)
I do not get your point... the log shows a perfectly logic sequence where you have a minimum power set at 10%... in which case when power is less than this, then such minimum is applied.

With respect to your comments on the « if then » sequence, these are not nested. Hence each if is tested in sequence.

Hope this helps. Enjoy the holidays.
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 »


Logread wrote:
jake wrote: Monday 23 December 2019 20:25 I keep having the following log lines (and resultings heater burns) which are not correct:

Code: Select all

2019-12-23 07:17:45.175  Status: (SVT) Next calculation time will be : 2019-12-23 09:17:45.174763
2019-12-23 07:17:45.251  Status: (SVT) Temperatures: Inside = 18.8 / Outside = 7.7
2019-12-23 07:17:45.256  Status: (SVT) Calculated power is 0, applying minimum power of 10
2019-12-23 07:17:45.258  Status: (SVT) Calculation: Power = 10 -> heat duration = 12 minutes
2019-12-23 07:17:45.359  Status: User: Admin initiated a switch command (296/SVT Heater/On)
I do not get your point... the log shows a perfectly logic sequence where you have a minimum power set at 10%... in which case when power is less than this, then such minimum is applied.

With respect to your comments on the « if then » sequence, these are not nested. Hence each if is tested in sequence.

Hope this helps. Enjoy the holidays.
For myself I added the output of power to the logfile, right after it is calculated:
2019-12-24 13:35:54.388 Status: (SVT) Temperatures: Inside = 18.5 / Outside = 10.2
2019-12-24 13:35:54.389 Status: (SVT) New calc for ConstT = 1.2346362826661055
2019-12-24 13:35:54.389 Status: (SVT) ConstT updated to 1.3
2019-12-24 13:35:54.389 Status: (SVT) Calculated power is -15.4
2019-12-24 13:35:54.389 Status: (SVT) Calculated power is 0, applying minimum power of 10
2019-12-24 13:35:54.390 Status: (SVT) Calculation: Power = 10 -> heat duration = 12 minutes
2019-12-24 13:35:54.468 Status: User: Admin initiated a switch command (296/SVT Heater/On)

As you can see the calculated value is negative. I understand that this is increased to 0 (if < 0 then 0). However, I do NOT have the parameter Mode4 on 'forced', therefore 0 should skip the heating , not letting it burn for the set minimum 10%

I see your point in the not nested IF statements, in this case it doesn't matter in which order they are, right? If so, why is the first IF executed? It should only execute the second IF where power = 0. Should 'overshoot' be set to TRUE in the case that power < 0? Because this first IF is only skipped when both Mode4 is not 'forced' AND overhoot is FALSE.

EDIT: I think I come across this issue since (for floor heating reason) I inclreased the 'deltamax parameter from 0.2 to 0.7. When this would be 0.2, there is only little chance that the room temperature < setpoint +0.2 and if so, there is little chance that power < 0. In my case with deltamax = 0.7, the power result can easily < 0 (-0.7 x 51 = -35)
alarm_guy1
Posts: 132
Joined: Tuesday 14 January 2014 0:03
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by alarm_guy1 »

Hi guys,
been using SVT for quite a while now, just wondered how you are all using it?
do you just leave it to run, or do you use timers?

Currently I use timers to make it switch to economy mode whilst we are at work, but find if say the wife is off on any given day, it is difficult for her to swap it back or increase the temperature.

any pointers on how you all use it

Cheers
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 »

@Logread I added my proposal to add 'Overshoot = True' to manage the case were 'power' < 0. It is my first ever addition to code on github, so I hoped I did it correctly. If not, please advise how to do better next time.
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 »

alarm_guy1 wrote:Hi guys,
been using SVT for quite a while now, just wondered how you are all using it?
do you just leave it to run, or do you use timers?

Currently I use timers to make it switch to economy mode whilst we are at work, but find if say the wife is off on any given day, it is difficult for her to swap it back or increase the temperature.

any pointers on how you all use it

Cheers
I use SVT in conjunction with an opentherm thermostat on the wall. With help of dzvents I manipulate the setpoint ot the thermostat, based on the SVT thermostat setpoint (when the SVT heating goes on, I increase the wall thermostat setpoint, I will lower it as soon as the SVT heater goes off.
It goes both ways, when I update the SVT thermostat, the opentherm thermostat will be updated and vice versa. So, anybody can lower or raise the thermotat on the wall, updating SVT with it.
joyride1176
Posts: 9
Joined: Tuesday 14 May 2019 23:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by joyride1176 »

renerene wrote: Sunday 16 December 2018 9:05 Hello developers,

This is my second year my house is heated with SVT and I really like it. Just one thing....

At the moment I have to manually calculate my switch-on time in the morning, between 4 and 6 am to have the house warm at 7.
It would be great to have some kind of dummy device, that represents a warm-up time, or even better, the time in the future in which the temp is 'normal', if you switch from economy to normal now. The last option saves me the trouble of time calculations. If targetTime >= '7:00 am' then switch to normal

I guess the current software has better knowledge and algorithms to calculate these times, compared to my self made script.
+1

:)
alarm_guy1
Posts: 132
Joined: Tuesday 14 January 2014 0:03
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by alarm_guy1 »

Cheers Jak, I will look into this
brommetje
Posts: 67
Joined: Sunday 16 February 2014 17:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by brommetje »

Hi @Jake is it possible to share your complete script how you change the setpoint of your opentherm gateway on the wall?
I also want to try SVT in combination with my floor heating.
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 »

brommetje wrote:Hi @Jake is it possible to share your complete script how you change the setpoint of your opentherm gateway on the wall?
I also want to try SVT in combination with my floor heating.
yes, no problem. First of all, with floor heating, to get it working properly: Increase the calculation time. I ended up with 120 minutes. The floor heating is so slow that with a shorter period I constantly had an overshoot. We were on Dec 26 not in the house and for 20 hours, there was only +/-0.1C variation of the setpoint! SVT is doing an excellent job.
Regarding the dzvents script. I will share it later, because I had some issues with it lately, it made wrong decisions in updating either one or both setpoints (SVT and the OT physical one). I assume this is due to the OTgateway updating only every 30 seconds, where this may interfere with the script execution. I will have to put more effort on this behaviour to not let it manipulate my script results. You might use my script as an idea to improve it already for yourself.

Before I knew about SVT I already had a script that stored the actual OT setpoint in a dzvents variable and than increased/decreased the setpoint to manipulate the OT thermostat to both earlier fire the boiler on, but also to earlier stop the boiler as well. That already reduced the variation in room temperature a lot.
With SVT, I decided to make a multiswitch in Domoticz for heating, like 'off', 'auto' and "SVT'. The script will check which one is actual and will either NOT do anything at all, or use the first or second part of the script.

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 »

My script to manipulate the OT thermostat to only use it as communication device to the boiler for turning on/off:

Code: Select all

--4-2-2018 SetpointInfluence.lua
--script to have a more accurate heating in the living room. Normally the heater is turned on at Setpoint -0,3'C and turned off at +0,3'C. This is too slow
--for floor heating.


return {
    active = true,
    on = {
		devices = {
			'SVT Heater',
			'SVT - Setpoint Normal'
				},
		timer = {'every minute'}}, --{
--        devices = {
--        'Woonkamer Temperature Setpoint',
--        'Woonkamer Temperature iSense'
--        }
--    },
	logging = {
    level = domoticz.LOG_ERROR, --domoticz.LOG_INFO, domoticz.LOG_MODULE_EXEC_INFO, domoticz.LOG_DEBUG or domoticz.LOG_ERROR
    marker = "Hey you"
    },
	data = {
    setPointOrg = {initial=nil},
    setPointMod = {initial=nil},
    setPointUpdated = {initial= 'no'}--,
    --livingTemperatureRound = {initial=nil}
	},

    execute = function(domoticz, device)
	local CH_Control		= domoticz.devices('CH_Control').level -- monitoring script checks if this script is behaving. Only when level is '10' this script may run
	local livingSetpoint 	= domoticz.devices('Woonkamer Temperature Setpoint')
	local CHactive			= domoticz.devices('CH_active')
	local livingTemperature = domoticz.utils.round(domoticz.devices('Woonkamer Temperature iSense').temperature,2)
	local svtHeater			= domoticz.devices('SVT Heater').state
	local svtSetPoint		= domoticz.devices('SVT - Setpoint Normal')
	local svtMode			= domoticz.devices('SVT - Thermostat Mode')
 	local deltaLow 			= 0.1 -- delta temperature below setpoint until switching on heating
 	local deltaHigh 		= 0.1 -- delta temperature above setpoint until switching off heating
	local heatingControlAuto= 10 -- Selectorswitch level of the heatingControl script to allow this script to run
	local heatingControlSVT	= 20 --	Selectorswitch level of the heatingControl script to allow S Virtual Thermostat script to control this script
	local OTGWheartbeat = 30	-- interval of updates from the OpenTherm Gateway in seconds (default 30 seconds)

	if (CH_Control ~= heatingControlAuto and CH_Control ~= heatingControlSVT) then goto skipScript end -- CH Controls script either detected malfunction (level 30) or switch selector was manually set to 'Off' (level 0)
	
	if domoticz.data.setPointOrg == nil then domoticz.data.setPointOrg = livingSetpoint.setPoint end
	if domoticz.data.setPointMod == nil then domoticz.data.setPointMod = livingSetpoint.setPoint end
	
	-- Set parameters of iSense thermostat and other variables when the SVT Thermostat is updated
	if (svtSetPoint.changed and domoticz.data.setPointOrg ~= svtSetPoint.setPoint) then
		if livingTemperature >= (svtSetPoint.setPoint + deltaHigh) then
			domoticz.data.setPointMod = tonumber(svtSetPoint.setPoint - 0.5)
		else
			domoticz.data.setPointMod = tonumber(svtSetPoint.setPoint + 1)
		end
		domoticz.data.setPointOrg = svtSetPoint.setPoint
		if livingSetpoint.setpoint ~= domoticz.data.setPointMod then livingSetpoint.updateSetPoint(domoticz.data.setPointMod).afterSec(1) end
	end
	
	-- Check if the physical thermostat setpoint differs from the SVT checkpoint
	-- adjust SVT setpoint device when the user updated the physical thermostat in the room
	-- first check if the room thermostat setpoint value equals the modified setpoint (the plus or minus 0.5 from desired setpoint)
	if (svtSetPoint.changed == false and tonumber(livingSetpoint.setPoint) ~= tonumber(domoticz.data.setPointMod) ) then
    -- the stored data needs to be updated with the new given setpoint to keep the original required setpoint
		domoticz.data.setPointOrg = tonumber(livingSetpoint.setPoint)
		svtSetPoint.updateSetPoint(tonumber(livingSetpoint.setPoint))
		--The setpoint is manually updated --> eco-mode needs to be changed to 'normal' if necessary
		if svtMode.level ~= 10 then svtMode.switchSelector(10) end-- set the SVT heater mode back to 'normal', which is level 10
		-- change the manual given setpoint to modified value variable to correctly trigger the OpenTherm heater. Update of actual setpoint is done in a diffferent 'if statement'
		if livingTemperature >= (domoticz.data.setPointOrg + deltaHigh) then
			domoticz.data.setPointMod = tonumber(domoticz.data.setPointOrg - 0.5)
		else
			domoticz.data.setPointMod = tonumber(domoticz.data.setPointOrg + 1)
		end
		domoticz.log ('Setpoint manually updated to ' .. livingSetpoint.setPoint)
		domoticz.log ('OTGW 3 '..domoticz.data.setPointOrg..' - '.. domoticz.data.setPointMod ..' - '.. livingSetpoint.setPoint..' - '.. domoticz.data.setPointUpdated)
	end

      	domoticz.log('OTGW '.. livingTemperature..' - ' ..domoticz.data.setPointOrg.. ' - ' ..  domoticz.data.setPointMod.. ' - ' .. deltaLow .. ' - ' ..  domoticz.data.setPointUpdated)
      	
  --if CH_Control is set to heatingControlAuto, it means that SVT is not used, but a simple tweak is done to more quickly trigger the OpenTherm heater.
	if CH_Control == heatingControlAuto then
		if livingTemperature <= (domoticz.data.setPointOrg - deltaLow) then
			domoticz.log ('livingTemperature < (domoticz.data.setPointOrg - deltaLow)')
			if (domoticz.data.setPointMod) ~= ((domoticz.data.setPointOrg) + 1) then
				domoticz.data.setPointMod = (domoticz.data.setPointOrg + 1)
			end
			if tonumber(livingSetpoint.setPoint) ~= tonumber(domoticz.data.setPointMod) then
				livingSetpoint.updateSetPoint(domoticz.data.setPointMod).silent()
				domoticz.data.setPointUpdated ='yes'
				domoticz.log ('Setpoint increased to '.. domoticz.data.setPointMod .. ' while livingroom temperature is '.. livingTemperature)
			elseif domoticz.data.setPointUpdated ~='no' then domoticz.data.setPointUpdated = 'no'
			end
		elseif livingTemperature >= (domoticz.data.setPointOrg + deltaHigh) then
			domoticz.log ('livingTemperature > (domoticz.data.setPointOrg + deltaHigh). domoticz.data.setPointMod = '..domoticz.data.setPointMod)
			if (domoticz.data.setPointMod) ~= ((domoticz.data.setPointOrg) - 0.5) then
				domoticz.data.setPointMod = ((domoticz.data.setPointOrg) - 0.5)
			end
			if tonumber(livingSetpoint.setPoint) ~= tonumber(domoticz.data.setPointMod) then
				domoticz.log ('setpoint = '..livingSetpoint.setPoint..' while domoticz.data.setPointMod = '..domoticz.data.setPointMod..' and domoticz.data.setPointUpdated = '..domoticz.data.setPointUpdated)
				--domoticz.data.setPointMod = (domoticz.data.setPointMod)
				livingSetpoint.updateSetPoint(domoticz.data.setPointMod).silent()
				domoticz.data.setPointUpdated = 'yes'
				domoticz.log ('Setpoint decreased to '.. domoticz.data.setPointMod .. ' while livingroom temperature is ' .. livingTemperature)
				domoticz.log ('OTGW 1 '..domoticz.data.setPointOrg..' - '.. domoticz.data.setPointMod ..' - '.. livingSetpoint.setPoint)
			elseif domoticz.data.setPointUpdated ~='no' then domoticz.data.setPointUpdated = 'no'
			end
		elseif (livingTemperature == (domoticz.data.setPointOrg) and CHactive.state == 'On') then
			domoticz.log ('(livingTemperature == (domoticz.data.setPointOrg + CHactive)')
			if domoticz.data.setPointMod ~= (domoticz.data.setPointOrg - 0.5) then
				domoticz.data.setPointMod = (domoticz.data.setPointOrg - 0.5)
			end
			if tonumber(livingSetpoint.setPoint) ~= tonumber(domoticz.data.setPointMod) then
				--domoticz.data.setPointMod = (domoticz.data.setPointOrg - 0.5)
				livingSetpoint.updateSetPoint(domoticz.data.setPointMod).silent()
				domoticz.data.setPointUpdated = 'yes'
				domoticz.log ('Setpoint decreased to '.. domoticz.data.setPointMod .. ' while CH is on and livingroom temperature is ' .. livingTemperature)
				domoticz.log ('OTGW 2 '..domoticz.data.setPointOrg..' - '.. domoticz.data.setPointMod ..' - '.. livingSetpoint.setPoint)
			elseif domoticz.data.setPointUpdated ~='no' then domoticz.data.setPointUpdated = 'no'
			end
	
		end
		
	--Here below the setpoint of the physical thermostat is controlled by the SVT heating switch
	elseif (CH_Control == heatingControlSVT and svtSetPoint.lastUpdate.secondsAgo > 6) then
		if svtHeater == 'On' then
			if (domoticz.data.setPointMod) ~= ((domoticz.data.setPointOrg) + 1) then
				domoticz.data.setPointMod = (domoticz.data.setPointOrg + 1)
			end
			if tonumber(livingSetpoint.setPoint) ~= tonumber(domoticz.data.setPointMod) then
				livingSetpoint.updateSetPoint(domoticz.data.setPointMod).silent()
				domoticz.data.setPointUpdated ='yes'
				domoticz.log ('Setpoint increased to '.. domoticz.data.setPointMod .. ' while livingroom temperature is '.. livingTemperature)
			elseif domoticz.data.setPointUpdated ~='no' then domoticz.data.setPointUpdated = 'no'
			end
		elseif svtHeater == 'Off' then
			if (domoticz.data.setPointMod) ~= ((domoticz.data.setPointOrg) - 0.5) then
				domoticz.data.setPointMod = ((domoticz.data.setPointOrg) - 0.5)
			end
			if tonumber(livingSetpoint.setPoint) ~= tonumber(domoticz.data.setPointMod) then
				domoticz.log ('setpoint = '..livingSetpoint.setPoint..' while domoticz.data.setPointMod = '..domoticz.data.setPointMod..' and domoticz.data.setPointUpdated = '..domoticz.data.setPointUpdated)
				livingSetpoint.updateSetPoint(domoticz.data.setPointMod).silent()
				domoticz.data.setPointUpdated = 'yes'
				domoticz.log ('Setpoint decreased to '.. domoticz.data.setPointMod .. ' while livingroom temperature is ' .. livingTemperature)
				domoticz.log ('OTGW 1 '..domoticz.data.setPointOrg..' - '.. domoticz.data.setPointMod ..' - '.. livingSetpoint.setPoint)
			elseif domoticz.data.setPointUpdated ~='no' then domoticz.data.setPointUpdated = 'no'
			end
		end
	end
		
			
::skipScript:: -- script was not allowed to be executed by monitoring script CH Control
end
}
joyride1176
Posts: 9
Joined: Tuesday 14 May 2019 23:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by joyride1176 »

Hi All!

I'm using SVT to warm up seven rooms using two instances of domoticz and seven HW components, one for every room
I've read all pages in this thread but I din't found and to below behavior

In practice SVT swtich on the heat for 10 sec which is not in line with the configuration:20,2,2,1,60 ( I expect 2 minutes of minimum heat per cycle)
Below the logs, anyone has a suggestion on what's going on?
in this way valves may go out of sync....

Swtich on:

Code: Select all

2020-01-01 17:07:55.160 (Cucina-SVT) End Heat time = 2020-01-01 17:07:55.160021
2020-01-01 17:07:55.161 (Cucina-SVT) Calling domoticz API: http://127.0.0.1:8080/json.htm?type=devices&filter=light&used=true&order=Name
2020-01-01 17:07:55.162 (Cucina-SVT) Add authentification for user Termostato
2020-01-01 17:07:55.265 (Cucina-SVT) Heater switch 32 currently is 'Off'
2020-01-01 17:07:55.266 (Cucina-SVT) Heating 'On'
2020-01-01 17:07:55.266 (Cucina-SVT) Calling domoticz API: http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=32&switchcmd=On
2020-01-01 17:07:55.267 (Cucina-SVT) Add authentification for user Termostato
2020-01-01 17:07:55.301 (Sonoff) Light/Switch (Cucina-P)
2020-01-01 17:07:55.316 (Cucina-SVT) End Heat time = 2020-01-01 17:07:55.160021 
Switch off:

Code: Select all

2020-01-01 17:08:05.081 (Cucina-SVT) Calling domoticz API: http://127.0.0.1:8080/json.htm?type=devices&filter=light&used=true&order=Name
2020-01-01 17:08:05.083 (Cucina-SVT) Add authentification for user Termostato
2020-01-01 17:08:05.199 (Cucina-SVT) Heater switch 32 currently is 'On'
2020-01-01 17:08:05.200 (Cucina-SVT) Heating 'Off'
Thanks

Stefano
brommetje
Posts: 67
Joined: Sunday 16 February 2014 17:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by brommetje »

Thanks @Jake I will try your script but I think I have to modify it for Toon also otgw.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests