Python Plugin: Smart Virtual Thermostat

For heating/cooling related questions in Domoticz

Moderator: leecollings

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 »

joyride1176 wrote: Wednesday 01 January 2020 17:44 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....
Fixed....

two issues
first there was a delay off in the swtich config
second Minimum Heating time per cycle is a % and not minutes like I supposed

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

All the best in 2020.
Please tell me how often thermostat temperature is refreshed?
Is it one per cycle?
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 »

EmKaRo wrote: Sunday 05 January 2020 20:29 All the best in 2020.
Please tell me how often thermostat temperature is refreshed?
Is it one per cycle?
Happy new year !
Every 5 minutes.
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by deennoo »

Great plugin, i have an issue : my boiler have an external temp sensor, this made heating water goes from 43 to 72 degrés.

Of course depending of external temp + inside temp + heating water temp heating Time have to be adapted.

I have a sensor who allow me to have temp of heating departure water temp (the one who goes outside from thé boiler)

Any advice to deal with this ?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
Remicade
Posts: 26
Joined: Friday 15 September 2017 21:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Remicade »

Hello,

For two rooms i prepared a Sonoff TH10 with a 230V actuator from Honeywell.
I setup two hardware devices "SmartVirtual Thermostat" named Lars and Bart.
So far so good.
Besides the device that is used to switch the actuator I also put the central heating switch (IDX 17) in "heating switches" so for Lars : 15,17 and for Bart: 13,17
The thermostat function itself works very well but I am running in to one problem.
When Bart reaches setpoint, Domoticz switches both IDX 13 and 17 to off.
This is a problem when Lars is also switched on.
The result is that Lars IDX 15 is still switched on but as mentioned earlier, Bart did swich off IDX 17......
So the actuator opens the valve but there is no heat because of the fact that the central heating is no longer switched on.

Is it a suggestion to check in the script that the heating switches are on?

Or should I make a Dzvents or LUA script to check this out? (Help is needed in this case :oops: )

I hope that some one can help me with this one.

Thanks Paul
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 »

@Remicade,

My suggestion would be to remove 17 from the plugins switches lists and run a script that sets 17 « On » if 13 or 15 are on, and switches 17 « Off » if 13 and 15 are « Off ».

Hope this helps
Remicade
Posts: 26
Joined: Friday 15 September 2017 21:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Remicade »

Logread wrote: Sunday 26 January 2020 11:49 @Remicade,

My suggestion would be to remove 17 from the plugins switches lists and run a script that sets 17 « On » if 13 or 15 are on, and switches 17 « Off » if 13 and 15 are « Off ».

Hope this helps
Thanks for your quick reaction Logread,
What do you suggest? DzVents?
And how to wriye such a function?
using devicechanged funtion?
Any help is welcome!

Thanks Paul
JonyBCN
Posts: 39
Joined: Tuesday 24 May 2016 22:39
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by JonyBCN »

Great idea. For work reasons I use PIDs and apply it to software heating I thought it was great.
I have been testing the plugin and for some reason I have an unexpected problem.
My installation for this case consists of a temperature sensor in the room to be heated, another outside and to heat the room an electric radiator controlled by a Fibaro plug.
Mole seems to be fine, but there are problems with the plug control. The first night he stayed on (Domoticz "saw it" off) constantly raising the temperature.
The reverse also happened during the day, Domoticz believed that the plug was on when it was actually turned off.

Checking the plug logs I see what the problem may be: the plugin sends the orders too fast: at the same exact time it sends the On and Off signal, and I think the plug is not able to respond properly. Can be? If so, it shouldn't be complicated to fix it.
IMG_6224.jpg
IMG_6224.jpg (24.97 KiB) Viewed 2765 times
peerkersezuuker
Posts: 70
Joined: Monday 14 December 2015 22:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Mierlo
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by peerkersezuuker »

Hello,
@logread, I am trying to get the SVT to work within domoticz.
But I bumped in to a problem with the update of the user variabele from within the plugin.
When it is getting updated from within the plugin an api cal is send out

Code: Select all

Virtual Thermostat) Calling domoticz API: http://192.168.0.31:8880/json.htm?type=command&param=updateuservariable&vname=Virtual%20Thermostat-InternalVariables&vtype=2&vvalue=%7B%27ConstC%27%3A%200.9%2C%20%27ConstT%27%3A%201.0%2C%20%27nbCC%27%3A%203%2C%20%27nbCT%27%3A%205%2C%20%27LastPwr%27%3A%2017.6%2C%20%27LastInT%27%3A%2019.6%2C%20%27LastOutT%27%3A%203.7%2C%20%27LastSetPoint%27%3A%2020.5%2C%20%27ALStatus%27%3A%201%7D
And this is causing my domoticz to crash.

See https://www.domoticz.com/forum/viewtopi ... =6&t=31238

Is this something you ever came across ?

Regards
Peer
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by rrozema »

peerkersezuuker wrote: Thursday 06 February 2020 19:11 Hello,
@logread, I am trying to get the SVT to work within domoticz.
But I bumped in to a problem with the update of the user variabele from within the plugin.
When it is getting updated from within the plugin an api cal is send out

Code: Select all

Virtual Thermostat) Calling domoticz API: http://192.168.0.31:8880/json.htm?type=command&param=updateuservariable&vname=Virtual%20Thermostat-InternalVariables&vtype=2&vvalue=%7B%27ConstC%27%3A%200.9%2C%20%27ConstT%27%3A%201.0%2C%20%27nbCC%27%3A%203%2C%20%27nbCT%27%3A%205%2C%20%27LastPwr%27%3A%2017.6%2C%20%27LastInT%27%3A%2019.6%2C%20%27LastOutT%27%3A%203.7%2C%20%27LastSetPoint%27%3A%2020.5%2C%20%27ALStatus%27%3A%201%7D
And this is causing my domoticz to crash.

See https://www.domoticz.com/forum/viewtopi ... =6&t=31238

Is this something you ever came across ?

Regards
Peer
I'm guessing you're on raspbian jessie. If so, check your python version. This has been reported before in this thread, also the solution is there: upgrade your python or upgrade your entire os (which upgrades python too).
peerkersezuuker
Posts: 70
Joined: Monday 14 December 2015 22:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Mierlo
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by peerkersezuuker »

Hello rrozema,
Thanks for the heads up, but I am on buster for a while now.
And buster comes with python 3.7.3
I even tried an fresh install of domoticz on another pi (also with buster) but there I have the same problem.
I know it is a python thingy, because when I update an uservariabele from my python script_device_change.py I get the same behavior.

But what the cause is, I can not get clear.

Regards
Peer
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,

Just a question to simplify the management of seven room and seven SVT instances and lot of switches
I want to modify the configuration as follow, the question at the end will the plugin work properly?

- press normal button and hide thermostat control buttons (normal, economy) vi settings/devices and press blu arrow
- hide economy set point

The plugin will work properly at the normal set point?
In case I will decrease the normal set point will I have any issue?

Thanks

Stefano
Remicade
Posts: 26
Joined: Friday 15 September 2017 21:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Remicade »

Hi all,

I have tried several things but I am not getting it done....Can someone please check this for me.
Thanks in advance.
Remicade wrote: Tuesday 28 January 2020 19:33
Logread wrote: Sunday 26 January 2020 11:49 @Remicade,

My suggestion would be to remove 17 from the plugins switches lists and run a script that sets 17 « On » if 13 or 15 are on, and switches 17 « Off » if 13 and 15 are « Off ».

Hope this helps
Thanks for your quick reaction Logread,
What do you suggest? DzVents?
And how to wriye such a function?
using devicechanged funtion?
Any help is welcome!

Thanks Paul
Remicade
Posts: 26
Joined: Friday 15 September 2017 21:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Remicade »

Hi,

return {
active = true,
on = {
'Bart Switch'
},
execute = function(domoticz, switch)
if (switch.state == 'On') then
domoticz.devices['CV'].switchOn()
end
end
}

Tried the code above....I do not get it? LUA...dZvents??? Not clear for me..


All I want is : If Lars is on, then CV is on. If Bart is on, the CV is on.

Thanks
step by step help is needed I think...
Cheers Paul
Remicade
Posts: 26
Joined: Friday 15 September 2017 21:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Remicade »

Thanks Logread!
Your suggestion was what I had in mind.
Solved now with LUA.
Maybe to much, I wrote 4 scripts:


local bart_switch = 'Bart Switch'
local cv_switch = 'CV Schakelaar'
local lars_switch = 'Lars Switch'

commandArray = {}

if devicechanged[bart_switch] then
if otherdevices[bart_switch] == 'On' then
commandArray[cv_switch]='On'
end
end
return commandArray

And :


local bart_switch = 'Bart Switch'
local cv_switch = 'CV Schakelaar'
local lars_switch = 'Lars Switch'

commandArray = {}

if devicechanged[bart_switch] then
if otherdevices[bart_switch] == 'Off' and otherdevices[lars_switch] == 'Off' then
commandArray[cv_switch]='Off'
end
end
return commandArray

Did the same for another room.

Thanks for now.

(Can these scripts be combined?)
Logread wrote: Sunday 26 January 2020 11:49 @Remicade,

My suggestion would be to remove 17 from the plugins switches lists and run a script that sets 17 « On » if 13 or 15 are on, and switches 17 « Off » if 13 and 15 are « Off ».

Hope this helps
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 »

Remicade wrote:Hi,

return {
active = true,
on = {
'Bart Switch'
},
execute = function(domoticz, switch)
if (switch.state == 'On') then
domoticz.devices['CV'].switchOn()
end
end
}

Tried the code above....I do not get it? LUA...dZvents??? Not clear for me..


All I want is : If Lars is on, then CV is on. If Bart is on, the CV is on.

Thanks
step by step help is needed I think...
Cheers Paul
Yes, this is a dzvents script that you need to put in the domoticz\scripts\dzVents\scripts folder. the example here above only one SVT heater is shown, but this can be multiplied by other svt switches:

Code: Select all

return {
	active = true,
	on = {
		'Bart Switch',
		'Piet Switch',
		'Jan Switch'
	},
	execute = function(domoticz, switch)
		local Bart = domoticz.devices('Bart Switch')
		local PIet = domoticz.devices('Piet Switch')
		local Jan = domoticz.devices('Jan Switch')
		if (switch.state == 'On') then
			domoticz.devices['CV'].switchOn().checkfirst() --only switch when necessary, avoid multiple entries in the log
		elseif (Bart.state =='Off' and Piet.state =='Off' and Jan.state =='Off') then --no heat required anymore by any of the SVT switches
			domoticz.devices['CV'].switchOff().checkfirst() --only switch when necessary, avoid multiple entries in the log
		end
	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 »

Is this a bug?

Hi All

I've seven instances (seven hardware configurations) of SVT running over two rasperry with jessie.
On the raspeberry placed on the first floor are running for instances, here I'm having issues at least once per week randomly on each instances
The behavior is always the same during normal operations the switch in charge to control the boiler start to flip on/off quickly:
Starting at: 16/03/2020 06:31:0 each second the switch receive on/off commands
After few seconds the normal behavior is restored but the rele goes out of sync and I have to fix it manually

This is is the configuration:
Apply minimum heating per cycle: only when heating is required
Calculation cycle...: 15,5,2,1,60
Variables: 'LastOutT': 12.0, 'ConstC': 362.5, 'LastInT': 20.7, 'LastPwr': 100, 'LastSetPoint': 23.5, 'nbCT': 50, 'ALStatus': 1, 'nbCC': 50, 'ConstT': -9.6}

Any idea on what's going on? or troubleshoot the issue?

Thanks

Stefano

Code: Select all

16/03/2020 08:53:20	On
16/03/2020 08:53:20	On
16/03/2020 06:31:33	Off
16/03/2020 06:31:32	On
16/03/2020 06:31:31	Off
16/03/2020 06:31:30	On
16/03/2020 06:31:28	Off
16/03/2020 06:31:27	On
16/03/2020 06:31:26	Off
16/03/2020 06:31:25	On
16/03/2020 06:31:24	Off
16/03/2020 06:31:23	On
16/03/2020 06:31:22	Off
16/03/2020 06:31:21	On
16/03/2020 06:31:20	Off
16/03/2020 06:31:19	On
16/03/2020 06:31:17	Off
16/03/2020 06:31:16	On
16/03/2020 06:31:15	Off
16/03/2020 06:31:14	On
16/03/2020 06:31:13	Off
16/03/2020 06:31:12	On
16/03/2020 06:31:11	Off
16/03/2020 06:31:10	On
16/03/2020 06:31:09	Off
16/03/2020 06:31:08	On
16/03/2020 06:31:06	Off
16/03/2020 06:31:05	On
16/03/2020 06:31:04	Off
16/03/2020 06:31:03	On
16/03/2020 06:31:02	Off
16/03/2020 06:31:01	On
16/03/2020 06:31:00	On
16/03/2020 06:17:10	Off
16/03/2020 06:17:09	Off
16/03/2020 06:16:00	On
16/03/2020 06:15:59	On
16/03/2020 06:02:09	Off
16/03/2020 06:02:08	Off
16/03/2020 06:00:59	On
16/03/2020 06:00:58	On
16/03/2020 05:47:08	Off
16/03/2020 05:47:07	Off
16/03/2020 05:45:58	On
16/03/2020 05:45:57	On
Remicade
Posts: 26
Joined: Friday 15 September 2017 21:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by Remicade »

Thans for that!

I Will check this.

Chefs Paul
jake wrote: Friday 13 March 2020 21:31
Remicade wrote:Hi,

return {
active = true,
on = {
'Bart Switch'
},
execute = function(domoticz, switch)
if (switch.state == 'On') then
domoticz.devices['CV'].switchOn()
end
end
}

Tried the code above....I do not get it? LUA...dZvents??? Not clear for me..


All I want is : If Lars is on, then CV is on. If Bart is on, the CV is on.

Thanks
step by step help is needed I think...
Cheers Paul
Yes, this is a dzvents script that you need to put in the domoticz\scripts\dzVents\scripts folder. the example here above only one SVT heater is shown, but this can be multiplied by other svt switches:

Code: Select all

return {
	active = true,
	on = {
		'Bart Switch',
		'Piet Switch',
		'Jan Switch'
	},
	execute = function(domoticz, switch)
		local Bart = domoticz.devices('Bart Switch')
		local PIet = domoticz.devices('Piet Switch')
		local Jan = domoticz.devices('Jan Switch')
		if (switch.state == 'On') then
			domoticz.devices['CV'].switchOn().checkfirst() --only switch when necessary, avoid multiple entries in the log
		elseif (Bart.state =='Off' and Piet.state =='Off' and Jan.state =='Off') then --no heat required anymore by any of the SVT switches
			domoticz.devices['CV'].switchOff().checkfirst() --only switch when necessary, avoid multiple entries in the log
		end
	end
}
TokTias
Posts: 7
Joined: Wednesday 07 September 2016 2:58
Target OS: Linux
Domoticz version: Beta
Location: A Swede in Santiago
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by TokTias »

Hi !
New user here (but I've been using domoticz with a lot of different sensors like Hue, MySensors Roborock S5 Max, etc since 2015).
I have installed the plugin and configured it in the Hardware settings, but it always causes an exception on all URL's called (for example "Error calling 'http://localhost:8090/json.htm?type=dev ... order=Name'") like "response = request.urlopen(req)" in DomoticzAPI().

I can copy the failed URL and run it with curl without any problems so what's failing here ?

Cheers !
/T
____________________________________________
domoticz hooked up with :
Philips Hue (v2 Hub + 14 lamps)
MySensors (~15 nodes)
Roborock S5 Max
Broadlink RM2
Chromecast Audio & Video
TokTias
Posts: 7
Joined: Wednesday 07 September 2016 2:58
Target OS: Linux
Domoticz version: Beta
Location: A Swede in Santiago
Contact:

Re: Python Plugin: Smart Virtual Thermostat

Post by TokTias »

Right, I solved it now.
I had to change the domoticz address from localhost to the IP address of my domotics server (localhost should work, but didn't in this case for some unknown reason).
I also realized I had to click the "Add Device" arrow in Devices to make it discoverable by this plugin since it filters on "used" sensors.
All good now, keep up the good work :D

Cheers !
/T
____________________________________________
domoticz hooked up with :
Philips Hue (v2 Hub + 14 lamps)
MySensors (~15 nodes)
Roborock S5 Max
Broadlink RM2
Chromecast Audio & Video
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests