Python Plugin: Smart Virtual Thermostat

For heating/cooling related questions in Domoticz

Moderator: leecollings

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 »

marcin wrote: Thursday 30 November 2017 11:16 I'm impressed with your thermostat.
In my house is the floor heating, or will the thermostat work with it?
Floor heating has high thermal inertia.
Do you intend to drive (i.e. switch on/off) the floor heating with the plugin ? If so you will indeed need to use fairly long calculation periods... I cannot give you guidance, but you need to monitor how the heating parameters best beheave (look at how constT and ConstC evolve over time in the uservariable used by the plugin) over a few days.

My mountain vacation place also has floor heating, but it is self regulated to only provide the minimum base heating required to maintain 10 degrees C of ambiant temperature when no one is there... all heating above that level is with electric convectors that are driven by the plugin, and I am pretty happy with that combination.

I found out after this plugin was released that no one has the same setup and needs in terms of heating. Hopefully the plugin is flexible enough to help as many users as possible, but clearly it is all case by case.
etampes
Posts: 4
Joined: Wednesday 29 November 2017 17:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by etampes »

Hi

The below errors happen after one or two calculation cycles of logread's thermostat plugin. Can someone help me? I'm not sure if it's bug with how outside temp. gets set to "none" (line 332 in plugin.py) in the internals or a problem with my system.

System: raspberry pi model B, raspian jessie lite, python 3.4.2, Domoticz beta Version: 3.8755

Log:

Code: Select all

2017-11-29 19:18:31.937 1Wire: Added Device: 28-041661aae7ff
2017-11-29 19:18:32.858 Sysfs GPIO: Startup - polling:no interrupts:no debounce:50msec inputs:0 outputs:2
2017-11-29 19:18:32.859 (Thermostat) Started.
2017-11-29 19:18:32.860 EventSystem: reset all events...
2017-11-29 19:18:32.862 EventSystem: reset all device statuses...
2017-11-29 19:18:33.216 PluginSystem: Entering work loop.
2017-11-29 19:18:33.285 Python EventSystem: Initalizing event module.
2017-11-29 19:18:33.296 EventSystem: Queue thread started...
2017-11-29 19:18:33.296 EventSystem: Started
2017-11-29 19:18:33.838 (Dallas) Temp (Living room)
2017-11-29 19:18:33.848 (Dallas) Temp (Living room)
2017-11-29 19:18:35.370 (Thermostat) Initialized version 0.3.5, author 'logread'
2017-11-29 19:18:35.370 (Thermostat) Entering work loop.
2017-11-29 19:18:35.437 (Thermostat) Debug log level set to: 'true'.
2017-11-29 19:18:35.437 (Thermostat) 'Port':'8080'
2017-11-29 19:18:35.438 (Thermostat) 'Mode6':'Debug'
2017-11-29 19:18:35.438 (Thermostat) 'Mode3':'16'
2017-11-29 19:18:35.438 (Thermostat) 'Name':'Thermostat'
2017-11-29 19:18:35.438 (Thermostat) 'Version':'0.3.5'
2017-11-29 19:18:35.438 (Thermostat) 'Mode1':'13'
2017-11-29 19:18:35.439 (Thermostat) 'Author':'logread'
2017-11-29 19:18:35.439 (Thermostat) 'Mode5':'15,0,2,1,60'
2017-11-29 19:18:35.439 (Thermostat) 'HomeFolder':'/home/pi/domoticz/plugins/SVT/'
2017-11-29 19:18:35.439 (Thermostat) 'HardwareID':'10'
2017-11-29 19:18:35.439 (Thermostat) 'Address':'127.0.0.1'
2017-11-29 19:18:35.440 (Thermostat) 'Key':'SVT'
2017-11-29 19:18:35.440 (Thermostat) Device count: 6
2017-11-29 19:18:35.440 (Thermostat) Device: 1 - ID: 17, Name: 'Thermostat - Thermostat Control', nValue: 1, sValue: '10'
2017-11-29 19:18:35.440 (Thermostat) Device ID: '17'
2017-11-29 19:18:35.440 (Thermostat) Device Name: 'Thermostat - Thermostat Control'
2017-11-29 19:18:35.441 (Thermostat) Device nValue: 1
2017-11-29 19:18:35.441 (Thermostat) Device sValue: '10'
2017-11-29 19:18:35.441 (Thermostat) Device LastLevel: 10
2017-11-29 19:18:35.441 (Thermostat) Device: 2 - ID: 18, Name: 'Thermostat - Thermostat Mode', nValue: 0, sValue: '10'
2017-11-29 19:18:35.441 (Thermostat) Device ID: '18'
2017-11-29 19:18:35.442 (Thermostat) Device Name: 'Thermostat - Thermostat Mode'
2017-11-29 19:18:35.442 (Thermostat) Device nValue: 0
2017-11-29 19:18:35.442 (Thermostat) Device sValue: '10'
2017-11-29 19:18:35.442 (Thermostat) Device LastLevel: 0
2017-11-29 19:18:35.443 (Thermostat) Device: 3 - ID: 19, Name: 'Thermostat - Thermostat Pause', nValue: 0, sValue: ''
2017-11-29 19:18:35.443 (Thermostat) Device ID: '19'
2017-11-29 19:18:35.443 (Thermostat) Device Name: 'Thermostat - Thermostat Pause'
2017-11-29 19:18:35.443 (Thermostat) Device nValue: 0
2017-11-29 19:18:35.443 (Thermostat) Device sValue: ''
2017-11-29 19:18:35.444 (Thermostat) Device LastLevel: 0
2017-11-29 19:18:35.444 (Thermostat) Device: 4 - ID: 20, Name: 'Thermostat - Setpoint Normal', nValue: 0, sValue: '18.700000762939453'
2017-11-29 19:18:35.444 (Thermostat) Device ID: '20'
2017-11-29 19:18:35.444 (Thermostat) Device Name: 'Thermostat - Setpoint Normal'
2017-11-29 19:18:35.444 (Thermostat) Device nValue: 0
2017-11-29 19:18:35.445 (Thermostat) Device sValue: '18.700000762939453'
2017-11-29 19:18:35.445 (Thermostat) Device LastLevel: 0
2017-11-29 19:18:35.445 (Thermostat) Device: 5 - ID: 21, Name: 'Thermostat - Setpoint Economy', nValue: 0, sValue: '20'
2017-11-29 19:18:35.445 (Thermostat) Device ID: '21'
2017-11-29 19:18:35.445 (Thermostat) Device Name: 'Thermostat - Setpoint Economy'
2017-11-29 19:18:35.446 (Thermostat) Device nValue: 0
2017-11-29 19:18:35.446 (Thermostat) Device sValue: '20'
2017-11-29 19:18:35.446 (Thermostat) Device LastLevel: 0
2017-11-29 19:18:35.446 (Thermostat) Device: 6 - ID: 22, Name: 'Thermostat - Thermostat temp', nValue: 0, sValue: '18.2'
2017-11-29 19:18:35.446 (Thermostat) Device ID: '22'
2017-11-29 19:18:35.447 (Thermostat) Device Name: 'Thermostat - Thermostat temp'
2017-11-29 19:18:35.447 (Thermostat) Device nValue: 0
2017-11-29 19:18:35.447 (Thermostat) Device sValue: '18.2'
2017-11-29 19:18:35.447 (Thermostat) Device LastLevel: 0
2017-11-29 19:18:35.448 (Thermostat) Inside Temperature sensors = [13]
2017-11-29 19:18:35.448 (Thermostat) Outside Temperature sensors = []
2017-11-29 19:18:35.449 (Thermostat) Heaters = [16]
2017-11-29 19:18:35.555 Incoming connection from: 127.0.0.1
2017-11-29 19:18:44.896 (Thermostat) Calling message handler 'onHeartbeat'.
2017-11-29 19:18:44.897 (Thermostat) Thermostat temperature update called
2017-11-29 19:18:44.897 (Thermostat) Next calculation time will be : 2017-11-29 19:33:44.896876
2017-11-29 19:18:44.937 (Thermostat) device: 13-Living room = 18.1
2017-11-29 19:18:45.036 (Thermostat - Thermostat temp) Updating device from 0:'18.2' to have values 0:'18.1'.
2017-11-29 19:18:45.040 (Thermostat) No Outside Temperature found...
2017-11-29 19:18:45.040 (Thermostat) Inside Temperature = 18.1
2017-11-29 19:18:45.040 (Thermostat) Outside Temperature = None
2017-11-29 19:18:45.041 Error: (Thermostat) 'onHeartbeat' failed 'TypeError':'unorderable types: float() > NoneType()'.
2017-11-29 19:18:45.041 Error: (Thermostat) ----> Line 503 in /home/pi/domoticz/plugins/SVT/plugin.py, function onHeartbeat
2017-11-29 19:18:45.041 Error: (Thermostat) ----> Line 288 in /home/pi/domoticz/plugins/SVT/plugin.py, function onHeartbeat
2017-11-29 19:18:45.042 Error: (Thermostat) ----> Line 306 in /home/pi/domoticz/plugins/SVT/plugin.py, function AutoMode
2017-11-29 19:18:45.042 Error: (Thermostat) ----> Line 362 in /home/pi/domoticz/plugins/SVT/plugin.py, function AutoCallib
2017-11-29 19:18:54.917 (Thermostat) Calling message handler 'onHeartbeat'.
2017-11-29 19:18:54.918 (Thermostat - Setpoint Normal) Updating device from 0:'18.700000762939453' to have values 0:'18.700000762939453'.
2017-11-29 19:18:54.924 (Thermostat - Setpoint Economy) Updating device from 0:'20' to have values 0:'20'.
2017-11-29 19:19:04.904 (Thermostat) Calling message handler 'onHeartbeat'.
2017-11-29 19:19:14.930 (Thermostat) Calling message handler 'onHeartbeat'.
2017-11-29 19:19:24.905 (Thermostat) Calling message handler 'onHeartbeat'.
2017-11-29 19:19:32.299 Incoming connection from: 192.168.2.2
2017-11-29 19:19:33.840 (Dallas) Temp (Living room)
2017-11-29 19:19:34.935 (Thermostat) Calling message handler 'onHeartbeat'.
2017-11-29 19:19:44.911 (Thermostat) Calling message handler 'onHeartbeat'.
2017-11-29 19:19:54.937 (Thermostat) Calling message handler 'onHeartbeat'.
2017-11-29 19:20:04.913 (Thermostat) Calling message handler 'onHeartbeat'.
2017-11-29 19:20:14.939 (Thermostat) Calling message handler 'onHeartbeat'.
2017-11-29 19:20:24.916 (Thermostat) Calling message handler 'onHeartbeat'.
2017-11-29 19:20:33.848 (Dallas) Temp (Living room)
2017-11-29 19:20:34.942 (Thermostat) Calling message handler 'onHeartbeat'.
stored internals:

Code: Select all

{'ConstC': 60, 'LastPwr': 12.0, 'ConstT': 1, 'LastInT': 18.5, 'nbCC': 0, 'LastSetPoint': 18.700000762939453, 'LastOutT': None, 'nbCT': 0, 'ALStatus': 1}
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 »

@etampes,

Thznks for posting the log... I’ll look into this... bear with me pls

EDIT: @etampes,
I just pushed a new version that should fix the bug you uncovered. I indeed think it is related to the fact you have no outside temperature sensor in your setup. Can you please update to version 0.3.6 (use update instructions from the wiki) and report if this has fixed the bug ?
Thanks
etampes
Posts: 4
Joined: Wednesday 29 November 2017 17:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by etampes »

Thanks for this, I'll update it. :)
Logread wrote: Thursday 30 November 2017 18:51 @etampes,

Thznks for posting the log... I’ll look into this... bear with me pls

EDIT: @etampes,
I just pushed a new version that should fix the bug you uncovered. I indeed think it is related to the fact you have no outside temperature sensor in your setup. Can you please update to version 0.3.6 (use update instructions from the wiki) and report if this has fixed the bug ?
Thanks
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.8 is available from GitHub for install/upgrade as per instructions at https://www.domoticz.com/wiki/Plugins/S ... ostat.html.
It fixes a logic flaw uncovered by @napo7 for the minimum heating level (v 0.3.7) and includes some minor improvements in the code (v 0.3.8).

Please keep reporting possible bugs and suggestions.
garethhowell
Posts: 115
Joined: Tuesday 17 November 2015 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9317
Location: St Neots, UK
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by garethhowell »

I've just installed this plugin onto a running Domoticz (latest beta) using the instructions on the wiki page. As soon as I enable the new hardware device, domoticz crashes. No debug messages or anything that i can see.

The only remedy is to rollback the database to the previously hourly backup.

Any clues on where to start?
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 »

garethhowell wrote: Thursday 14 December 2017 22:39 I've just installed this plugin onto a running Domoticz (latest beta) using the instructions on the wiki page. As soon as I enable the new hardware device, domoticz crashes. No debug messages or anything that i can see.
It seems many people, but not all, have experienced crashes related to the python plugins framework, that is still a beta feature. If you do a search on the forum for « python crash » or « plugin crash », you will see many cases and this does not seem to be associated to a particular plugin. The following post might be relevant it seems for an issue with the latest beta: viewtopic.php?f=6&t=20899#p161669

You may try to downgrade to a prior beta (or the latest stable) or try some of the fixes others have found (like compiling domoticz yourselves rather than downloading the stock binaries).
garethhowell
Posts: 115
Joined: Tuesday 17 November 2015 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9317
Location: St Neots, UK
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by garethhowell »

Logread wrote:
...

You may try to downgrade to a prior beta (or the latest stable) or try some of the fixes others have found (like compiling domoticz yourselves rather than downloading the stock binaries).
Thanks for the support.

I read through the thread and knew there had been a problem with the Python framework, however I assumed it had been fixed. I’ll do some digging and report back.

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

Yes, it's a know feature of the latest beta ;)
Every python plugins makes it crashing...
Devs are still searching the cause... Wait a moment ;)

I can also confirm that the stable release doesn't have the problem.
garethhowell
Posts: 115
Joined: Tuesday 17 November 2015 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9317
Location: St Neots, UK
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by garethhowell »

napo7 wrote:Yes, it's a know feature of the latest beta ;)
Every python plugins makes it crashing...
Devs are still searching the cause... Wait a moment ;)

I can also confirm that the stable release doesn't have the problem.
Yes, I reverted to the latest stable release and it works now.

I want to use it to control the temp in my wooden office/man cave at the bottom of the garden. It’s reasonably well insulated but I may have to play with the tuning parameters.
garethhowell
Posts: 115
Joined: Tuesday 17 November 2015 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9317
Location: St Neots, UK
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by garethhowell »

After a reboot, SVT started crashing domoticz again. I’ve removed it for now until the python framework is stable.
tullsta
Posts: 2
Joined: Monday 01 January 2018 15:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by tullsta »

Hello,
I'm getting errors like below:

Code: Select all

SVT) Error calling 'http://127.0.0.1:8080/json.htm?type=command¶m=getuservariables'
2018-01-01 14:31:50.533 Error: (SVT) Cannot read the uservariable holding the persistent variables
2018-01-01 14:31:50.538 Error: (SVT) Error calling 'http://127.0.0.1:8080/json.htm?type=command¶m=switchlight&idx=7&switchcmd=Off'
2018-01-01 14:31:59.965 Error: (SVT) Error calling 'http://127.0.0.1:8080/json.htm?type=devices&filter=temp&used=true&order=Name'
2018-01-01 14:31:59.966 Error: (SVT) No Inside Temperature found... Switching Thermostat Off
018-01-01 15:00:48.027 Error: (SVT) Error calling 'http://127.0.0.1:8080/json.htm?type=devices&filter=temp&used=true&order=Name'
Can you help me with that?


Domoticz version: 3.8153, works on Armbian
PluginSystem: Started, Python version '3.5.2'
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 »

tullsta wrote: Monday 01 January 2018 15:16 Can you help me with that?
Did you allow password free access to domoticz for IP 127.0.0.1 ? Is domoticz reachable on port 8080 ? Is there a firewall rule that could interfere ?
tullsta
Posts: 2
Joined: Monday 01 January 2018 15:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by tullsta »

Logread wrote: Monday 01 January 2018 15:34 Did you allow password free access to domoticz for IP 127.0.0.1 ?
That was it :) Thank you so much :)
Quax1507
Posts: 101
Joined: Tuesday 07 April 2015 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Quax1507 »

I tred Your plugin today on Beta 3.8771 (which should work).

Unfortunatelly Domoticz is crashing with

Code: Select all

2018-01-14 12:35:57.324  Error: Domoticz received fatal signal 11 !...
2018-01-14 12:35:57.329  Error:   /home/pi/domoticz/domoticz() [0x236254]
2018-01-14 12:35:57.330  Error:   /home/pi/domoticz/domoticz(_Z14signal_handleri+0x4c) [0x23630c]
2018-01-14 12:35:57.330  Error:   /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer+0) [0x76bfa6b0]
After restart I get the following error (and Domoticz crashed again)

Code: Select all

2018-01-14 12:36:49.318  Error: (SVT) failed to load 'plugin.py', Python Path used was ':/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-01-14 12:36:49.319  Error: (SVT_Room) Module Import failed, exception: 'ImportError'
2018-01-14 12:36:49.319  Error: (SVT_Room) Module Import failed: ' Name: plugin'
2018-01-14 12:36:49.319  Error: (SVT_Room) Error Line details not available.
Any idea?

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

Quax1507 wrote: Sunday 14 January 2018 13:08 Any idea?

Quaxx
Frankly no... besides making sure all steps for installing were followed. Did you try other python plugins to understand if this is generic rather than related to this particular plugin ?
Quax1507
Posts: 101
Joined: Tuesday 07 April 2015 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Quax1507 »

Hmmm, seems to be a python problem!

I just tried Sonos plugin which crashes, too!

What could be the reson for that?
blauwebuis
Posts: 331
Joined: Wednesday 21 December 2016 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by blauwebuis »

There seems to be a python issue in the current beta:
https://www.domoticz.com/forum/viewtopi ... 65&t=21379
garethhowell
Posts: 115
Joined: Tuesday 17 November 2015 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9317
Location: St Neots, UK
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by garethhowell »

I've just built domoticz from source and re-enabled SVT. So far, so good.
Quax1507
Posts: 101
Joined: Tuesday 07 April 2015 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Quax1507 »

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest