Page 1 of 1

Clock thermostat

Posted: Thursday 06 April 2017 13:27
by PDP8
Hi All,

Is there a simple software/scrypt Clock thermostat for Domoticz where
someone can easily set several temperatures at several times?

I want to use the DS18B20 temperature sensor on my Pi. Then just simply
turn on or off a relay on a GPIO port if the temperature is higher of lower
then the set point within a small hysteresis..

There are so many projects but I can't find my way trough them at the moment...

Thanks in advance! Roland

Re: Clock thermostat

Posted: Monday 10 April 2017 11:31
by PDP8
To test my cooling cycle I've made two fixed events.
When the room temperature is over 4.5 degrees the refrigerator compressor turns on.
When the room temperature is below 3.5 degrees the refrigerator compressor turns off.
In this way I made a 1 degree hysteresis. This runs fine for a few days now.
Events.jpg
Events.jpg (39.18 KiB) Viewed 2972 times
What I would like to do is a little calculation in the Events. I want to set
one user variable Temperature and let the system calculate the on and
off temperatures by adding or subtracting 0.5 degrees.
user variable.jpg
user variable.jpg (52.12 KiB) Viewed 2972 times
And for the user variable temperature I would like to have a easy timer.
Something like:

At 10:00 set 15 degrees
At 12:00 set 10 degrees
At 15:00 set 5 degrees
At 17:00 set 1 degree
etc...

How can I arrange this in Domoticz? I would guess that this is a quite common setup?

Regards, Roland

Re: Clock thermostat

Posted: Friday 14 April 2017 11:30
by PDP8
Any suggestions?

I would like to have a flexible timer for lights also :D

Just a simple home screen to simply set values at user divined times...

Re: Clock thermostat

Posted: Thursday 20 April 2017 6:54
by strixx
You can easily do this with a virtual (dummy) thermostat.

To create it you by going to Settings - Hardware, and if you not allredy have one, you have to add Dummy from the dropp down list.
Then on the same page, on under the Dummy hardware you click Create a virtual sensor and choose Thermostat.

You will find the new dummy sensor under Utility, and there you find the timersettings. You can then use this thermostat in your script.

Re: Clock thermostat

Posted: Tuesday 09 May 2017 13:21
by PDP8
Great! I have the thermostat working now.

Now I'm trying to figure out how I can make the hysteresis in the system...
because the compressor will turn off and on if I use the system like this:
no hysteresis.jpg
no hysteresis.jpg (47.12 KiB) Viewed 2740 times
I need to add or subtract a value from the desired temperature like this:
hysteresis 1.jpg
hysteresis 1.jpg (55.63 KiB) Viewed 2740 times
But this seems not to be possible within the event system.

Is there a way you can make a user variable which is made like:
"low value = Temperature setpoint - 0,5 degree"
"high value = Temperature setpoint + 0,5 degree"

In this way I could use these variables in the events to switch the
compressor with a hysteresis of 1 degree...

Thanks in advance!
Roland

Re: Clock thermostat

Posted: Tuesday 09 May 2017 15:04
by PDP8
I made a little lua script to test: The "Desired temperature" is a fixed value at the moment.
How can I get the selected temperature from the virtual thermostat in the lua scrypt?
Where can I find this value? Or what's its name?

Code: Select all

commandArray = {}

commandArray['DesiredTempHighHysteresis']= tostring(uservariables['Desired temperature'] + uservariables['Hysteresis'])
commandArray['DesiredTempLowHysteresis']= tostring(uservariables['Desired temperature'] - uservariables['Hysteresis'])

print (commandArray['DesiredTempHighHysteresis']);
print (commandArray['DesiredTempLowHysteresis']);

return commandArray
Thanks! Roland

Re: Clock thermostat

Posted: Tuesday 09 May 2017 15:24
by PDP8

Code: Select all

commandArray = {}

commandArray["DesiredTempHighHysteresis"]= tostring(otherdevices["Temperature setpoint"] + uservariables["Hysteresis"])
commandArray["DesiredTempLowHysteresis"]= tostring(otherdevices["Temperature setpoint"] - uservariables["Hysteresis"])

print (commandArray["DesiredTempHighHysteresis"]);
print (commandArray["DesiredTempLowHysteresis"]);

return commandArray
pff a lot of searching in examples. But this seems to read my thermostat. BUT!!!
The "DesiredTempHighHysteresis" and "DesiredTempLowHysteresis" do output the correct value in the lua scrypt
but the values are not updated in the graphic environment. The 3.5 and 7 degree are also seen by the blockly scripts.
no update.jpg
no update.jpg (221.88 KiB) Viewed 2719 times
So I seem to have a little error in my code... Any ideas?

Regards, Roland

Re: Clock thermostat

Posted: Tuesday 09 May 2017 21:10
by PDP8
It seems I have forgotten the part: Variable:
Now the variables are getting synchronized...

Code: Select all

commandArray = {}

commandArray["Variable:DesiredTempHighHysteresis"]= tostring(otherdevices["Temperature setpoint"] + uservariables["Hysteresis"])
commandArray["Variable:DesiredTempLowHysteresis"]= tostring(otherdevices["Temperature setpoint"] - uservariables["Hysteresis"])

print (commandArray["Variable:DesiredTempHighHysteresis"]);
print (commandArray["Variable:DesiredTempLowHysteresis"]);

return commandArray