Script LUA for Room Test -some problem with danfoss-

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:

Script LUA for Room Test -some problem with danfoss-

Post by guantolento »

Hi friends,
iam made some test with 2 bathroom. the situation is the same:

1 danfoss room to read the real temperature
2 danfoss valve one in each bathroom
1 SP virtual to command the 2 danfoss valve SP

i use the SP virtual to setting the temperature ,and this script copy the SP to the danfoss.

Code: Select all

sp1Name    = 'SP Bagni'     --nome set point virtuale zona bagni
spR1       = 23                      --nome valvola fisica 1
spR2       = 82                      --nome valvola fisica 2
T1         = otherdevices[sp1Name]   --lettura temperatura set point virtuale zona bagni
VT1      = tonumber(otherdevices['SP Bagni']) --valore del setpoint virtuale zona bagni

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

commandArray = {}

if devicechanged[sp1Name] then
      commandArray[#commandArray + 1] = {['UpdateDevice']=spR1..'|0|'..tostring(T1)}
      commandArray[#commandArray + 1] = {['UpdateDevice']=spR2..'|0|'..tostring(T1)}
      print (pfx..' SetPoint Modificato / Valore Attuale '..sp1Name..' : '..VT1..'')
   end
return commandArray
if the set point of danfoss or room temperature change start another script to put on or off the boyler.

Code: Select all

tUse      = tonumber(otherdevices['SP Bagno Grande']) --valore del setpoint valvola bagno grande
tDelta    = tonumber(uservariables['T Delta Bagni']) --valore della variabile delta bagni
tAct      = tonumber(otherdevices['T Bagni']) --valore della temperatura letta dal termometro bagno grande
debugger = 0

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

commandArray = {}
    if devicechanged['SP Bagno Grande'] or devicechanged['T Bagni'] then 
        if (tAct < (tUse - tDelta)) and (otherdevices['Accensione Caldaia Bagni'] == 'Off') then
            commandArray['Accensione Caldaia Bagni'] = 'On'
            print (pfx..'T ° Attuale Bagni / T ° Set Bagno Grande: '..tAct..'/'..tUse..' (±'..tDelta..') Richiesta Accensione Caldaia Bagni')
        elseif (tAct > (tUse + tDelta)) and (otherdevices['Accensione Caldaia Bagni'] == 'On') then
            commandArray['Accensione Caldaia Bagni'] = 'Off'
            print (pfx..'T ° Attuale Bagni / T ° Set Bagno Grande: '..tAct..'/'..tUse..' (±'..tDelta..') Richiesta Spegnimento Caldaia Bagni')
        else
            if debugger == 1 then
                print ('>>> [Temperatura] NTD >>> T ° Attuale Bagni / T ° Set Bagno Grande: '..tAct..'/'..tUse..' (±'..tDelta..') Nessuna Azione da intraprendere ['..otherdevices['T Bagni']..']')
            end
        end
    end
    return commandArray
in apparence the script work ok, but from the log i view some problem. here the log:

2017-01-08 16:10:46.474 LUA: >>> [Temperatura] >>> SetPoint Modificato / Valore Attuale SP Bagni : 23
2017-01-08 16:10:46.478 EventSystem: Script event triggered: LUA_T_Set_Point_Bagni
2017-01-08 16:14:11.178 LUA: >>> [Temperatura] >>>T ° Attuale Bagni / T ° Set Bagno Grande: 20.5/23 (±0.3) Richiesta Accensione Caldaia Bagni
2017-01-08 16:14:11.180 EventSystem: Script event triggered: LUA_T_Zona_Bagni
2017-01-08 16:14:11.617 LUA: >>> [Temperatura] >>>Comando Accensione Caldaia
2017-01-08 16:14:11.618 EventSystem: Script event triggered: LUA_T_Caldaia
2017-01-08 16:14:41.879 LUA: >>> [Temperatura] >>>T ° Attuale Bagni / T ° Set Bagno Grande: 20.5/18 (±0.3) Richiesta Spegnimento Caldaia Bagni
2017-01-08 16:14:41.882 EventSystem: Script event triggered: LUA_T_Zona_Bagni
2017-01-08 16:14:42.192 LUA: >>> [Temperatura] >>>Comando Accensione Caldaia
2017-01-08 16:14:42.193 EventSystem: Script event triggered: LUA_T_Caldaia
2017-01-08 16:14:42.276 LUA: >>> [Temperatura] >>>T ° Attuale Bagni / T ° Set Bagno Grande: 20.5/23 (±0.3) Richiesta Accensione Caldaia Bagni
2017-01-08 16:14:42.278 EventSystem: Script event triggered: LUA_T_Zona_Bagni
2017-01-08 16:14:42.662 LUA: >>> [Temperatura] >>>Comando Accensione Caldaia
2017-01-08 16:14:42.663 EventSystem: Script event triggered: LUA_T_Caldaia


in red the issue. in 1 second the system pull off and on the boyler. i don't so why but for a moment the value of SP Bagno Grande is read as 18 but instead is at 23. 18 is the value before the change. why this ????
another question, why sometimes the Virtual SP goes in red but work of with schedule ? it's normal ?
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: Script LUA for Room Test -some problem with danfoss-

Post by guantolento »

I've modificated and updated the post
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