Termostat

Moderator: leecollings

Post Reply
journeyman
Posts: 23
Joined: Sunday 04 December 2016 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Poland
Contact:

Termostat

Post by journeyman »

Hello,

Im trying to create some termostat for my heating on domoticz with blockly editor (im not good at programming at all so I use blockly module).

For now is like
2016-12-18_12h22_41.png
2016-12-18_12h22_41.png (41.06 KiB) Viewed 2530 times
Its working but the problem is that I need to have some hysteresis. like 2.5degree over and below.
How can I create some variable which will take temperature from thermometer and add 2.5degree for turning on and subtract 2.5 for turning off?

Thank you
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Termostat

Post by Egregius »

Blockly can't calculate anything.
I would suggest start learning some script language like lua, shell, php,...

But, besides that, why do you want a hysteris of 2,5°C? I worked hard to get my script down to 0,1°C.
journeyman
Posts: 23
Joined: Sunday 04 December 2016 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Poland
Contact:

Re: Termostat

Post by journeyman »

So it will be more difficult :(

And what about user variables? There is no such function?


2,5 for central heating water pomp. it is typical for store thermostats and necessary to avoid too fast turning on, becouse temperature of water is going up when pomp is not working.
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Termostat

Post by Egregius »

Php isn't very difficult and has a huge userbase. Anything you can think of is already documented somewhere on the www.
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: Termostat

Post by elmortero »

Hi Journeyman,
When I started using domoticz a year ago I was very happy for Blockly, but then soon realized that it is too limited for the events I wanted. So I started to try and use LUA. Short after that I discovered dzVents and that made life a lot easier for me, as I have (or rather had) no scripting experience.
You might want to have a look at dzVents too, it makes LUA scripting really easy. Now I only have dzvents based scripts, no more regular lua and zero blocklies
And, in your case, there is a great example script for room heating on which I based all my heating scripts.
You just need to change the names of devices to match yours in the first part (the lines that start with LOCAL).
For example in the line local BOILER_DEVICE = 'Boiler' you need to replace the word Boiler by the exact name of your switch that manages your heating source (in your case I think it is called Zasilanie Pompy C.O.)
Then put the script in the right folder and your done. On a pi that is /home/pi/domoticz/scripts/lua/scripts
journeyman
Posts: 23
Joined: Sunday 04 December 2016 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Poland
Contact:

Re: Termostat

Post by journeyman »

I did something like that:

Code: Select all

 local sonde = 'Kocioł C.O.'
 
 commandArray = {}

 if (devicechanged[sonde]) then
         local temperature = devicechanged[string.format('%s_Temperature', sonde)] 
   
        
       
             commandArray['Variable:kociolup3']=tostring(temperature + 2)
             commandArray['Variable:kocioldown3']=tostring(temperature - 2)

        
         end

 return commandArray
Its giving me user variable with temperature +/- hystereza to compare in blockly. Its working great but somtimes its giving in log

2016-12-18 21:14:00.465 Error: EventSystem: in Histereza: [string "..."]:7: attempt to index global 'devicechanged' (a nil value)

Why?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest