LUA copy SP from termostat to SP valve

Moderator: leecollings

Post Reply
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

LUA copy SP from termostat to SP valve

Post 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 ?
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: LUA copy SP from termostat to SP valve

Post 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 ?
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: LUA copy SP from termostat to SP valve

Post 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.
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: LUA copy SP from termostat to SP valve

Post by guantolento »

hi egregius,
but your script is in php not in lua, i understand ok ?
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: LUA copy SP from termostat to SP valve

Post by Egregius »

Yep, of course :)
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: LUA copy SP from termostat to SP valve

Post by guantolento »

Sigh i don't know this language. ....

Inviato dal mio GT-I9301I utilizzando Tapatalk
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: LUA copy SP from termostat to SP valve

Post 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.
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest