Page 1 of 1

LUA copy SP from termostat to SP valve

Posted: Saturday 31 December 2016 18:39
by guantolento
hi,
in my house i have this configuration:

- SP room sensor A ( need command 2 SP Valve)
- SP room sensor B ( need command 2 SP Valve)
- SP room sensor C ( need command 3 SP Valve)

iam newbe, i need with LUA script every times change the SP room sensor A, change the value SP to 2 valve. with this metod i can schedulate only 3 device instead 7. i have another problem. i think must use a variables.

example SP room sensor A changed from 16 to 18
the SP of valve A must changed from 16 to 18
the SP of valve B must changed from 16.5 to 18.5 (the gap is alway +0.5 because the radiators is more high and the termostatic valve is at 1.8mt instead 1.10)

someone can help me ?

Re: LUA copy SP from termostat to SP valve

Posted: Monday 02 January 2017 16:45
by guantolento
i take some test for modify a set point with a test script:

Code: Select all

commandArray = {}
if devicechanged['Cucina Pensili - S1'] then
    if (otherdevices['Cucina Pensili - S1'] == 'On') then 
        commandArray['SetSetpoint:82']='22'
        commandArray['SetSetpoint:23']='22'
        commandArray['Cameretta Comò - S1'] = 'On'
    elseif (otherdevices['Cucina Pensili - S1'] == 'Off') then
        commandArray['SetSetpoint:82']='16'
        commandArray['SetSetpoint:23']='16'
        commandArray['Cameretta Comò - S1'] = 'Off'
    end
end
return commandArray
but the 2 setpoint don't work . why ?

Re: LUA copy SP from termostat to SP valve

Posted: Monday 02 January 2017 16:56
by Egregius
There's a function for this in my pass2php script.
Check the __verwarming.php file on my Github.
I set my valves x degrees lower/higher depending on the difference between room temperature and room setpoint.

Re: LUA copy SP from termostat to SP valve

Posted: Monday 02 January 2017 17:06
by guantolento
hi egregius,
but your script is in php not in lua, i understand ok ?

Re: LUA copy SP from termostat to SP valve

Posted: Monday 02 January 2017 19:50
by Egregius
Yep, of course :)

Re: LUA copy SP from termostat to SP valve

Posted: Monday 02 January 2017 20:07
by guantolento
Sigh i don't know this language. ....

Inviato dal mio GT-I9301I utilizzando Tapatalk

Re: LUA copy SP from termostat to SP valve

Posted: Sunday 08 January 2017 15:37
by guantolento
Hi at all,
actually i use this LUA script to copy the value of SP Camere (Virtual SP beacuse the fisic SP Danfoss Room don't work) to 2 fisic SP Valves Danfoss.

Code: Select all

sp2Name    = 'SP Camere'     --nome del set point virtuale zona camere
spR3       = 25                      --nome valvola fisica 3
spR4       = 30                      --nome valvola fisica 4
T2         = otherdevices[sp2Name]   --lettura temperatura set point virtuale zona camere
VT2      = tonumber(otherdevices['SP Camere']) --valore del set point virtuale zona camere

pfx      = '>>> [Temperatura] >>>' --prefisso log Temperatura

commandArray = {}
   
if devicechanged[sp2Name] then
      commandArray[#commandArray + 1] = {['UpdateDevice']=spR3..'|0|'..tostring(T2)}
      commandArray[#commandArray + 1] = {['UpdateDevice']=spR4..'|0|'..tostring(tonumber(T2)+1.5)}
      print (pfx..' SetPoint Modificato / Valore Attuale '..sp2Name..' : '..VT2..'')
   end
return commandArray
the first valve has the same SP, the second has SP + 1.5. i use this from 1 week and work ok.