Page 1 of 1
setpoint +
Posted: Sunday 03 April 2022 18:13
by jacobsentertainment
Hi all,
I'm trying in a script to change the setpoint but not getting what I'm expecting. I have a script running for my stove and if the temperature reaches 89° I want to dump some heat in one of the radiators in my house by increasing the temperature.
Code: Select all
elseif
Temp_Hal >= 89 then
Hal_setpoint.updateSetPoint(20)
Currently I'm using this and when the temperature is below 89° then the script sets it back to 13° the issue is that this script runs every minute and updates also this temperature. My idea was to use a script like
Code: Select all
elseif
Temp_H >= 89 then
Hal_setpoint.updateSetPoint(+ 8)
So it increases current setpoint with 8° and when done it lowers it with 8°
But it seems DzVents does not allow me to use the + to add some to the setpoint. Is there a other way to do this? How can I store current setpoint value and then later use this again? Can some point me to a good topic where i can find some info on storing a setpoint value?
Re: setpoint +
Posted: Sunday 03 April 2022 18:17
by waltervl
You first have to read the setpoint
So something like
Hal_setpoint.updateSetPoint(Hal_setpoint.setPoint+ 8)
Re: setpoint +
Posted: Sunday 03 April 2022 19:25
by jacobsentertainment
Thanks ill give this a try tonight see if I can make this work.
Re: setpoint +
Posted: Sunday 03 April 2022 20:30
by jacobsentertainment
Well nice try this won't work
- Spoiler: show
- return {
active = true,
on = {
devices = {18,
},
timer = {
'every 1 minute'
},
},
logging = {
level = domoticz.LOG_INFO,
marker = "setpoint test"
},
execute = function(domoticz, device)
local Setpoint_l = domoticz.devices(206) --logeerkamer setpoint
local systeem_temp = domoticz.devices(18)
local temp_s = systeem_temp.temperature
if
temp_s >= 60 then
Setpoint_l.updateSetPoint(Setpoint_l.setPoint+ 8)
elseif
temp_s <= 60 then
Setpoint_l.updateSetPoint(Setpoint_l.setPoint- 8)
end
end
}
This is not working as planned, now if the temperature is below an value it will constantly lower the setpoint as the script is triggered, I could have known this before, so back to the drawingboard

Re: setpoint +
Posted: Monday 04 April 2022 20:08
by madpatrick
Try something like this
Code: Select all
local new_setpoint = Hal_setpoint.updateSetPoint +8
elseif
Temp_H >= 89 then
Hal_setpoint.updateSetPoint(new_setpoint)
Re: setpoint +
Posted: Monday 04 April 2022 23:45
by jacobsentertainment
madpatrick wrote: Monday 04 April 2022 20:08
Try something like this
Code: Select all
local new_setpoint = Hal_setpoint.updateSetPoint +8
elseif
Temp_H >= 89 then
Hal_setpoint.updateSetPoint(new_setpoint)
Tried it in a script for the "logeerkamer" and doesn't work
Code: Select all
Logeerkamer: ...z/scripts/dzVents/generated_scripts/Logeerkamer temp.lua:22: attempt to perform arithmetic on a function value (field 'updateSetPoint')
anyway, what I think won't work is that I simply create a trigger to add a couple of degrees and after that the temperature dropped I want to subtract that same amount, but if I do it like mentioned above everytime that trigger will subtract another 8° from the last setpoint. That way I will end up whit a setpoint way below me desired setpoint.
I think that I need a way to store current setpoint and when the temperature is back to normal it sets this value back and the script stops till the temperature is to high again and does the same trick.

Re: setpoint +
Posted: Tuesday 05 April 2022 10:02
by madpatrick
Checkout this post.
viewtopic.php?p=257729#p257729
Within this script the setpoint is stored and the recalled again
Maybe it helps
Re: setpoint +
Posted: Tuesday 05 April 2022 21:09
by jacobsentertainment
That's indeed a nice topic to study and test.