This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Script Error. HELP
#1
Hi Everyone,

I'm having some problems with this script. The logic is able to activate the output but It doesn't turn it off and I don't understand why.

Can someone help me to figure out this?

--dichiarazione delle variabili locali

gRichiestaDeumidificazione = ("7/0/0")
gStatoDeumidificazione = ("7/1/0")
gStagione = ("0/2/2") --gruppo stagione invertito: 1= raffrescamento / 0= riscaldamento
gSogliaZona1 = ("7/3/0")
gSogliaZona2 = ("7/3/2")
gSogliaZona3 = ("7/3/4")
gSogliaZona4 = ("7/3/14")
gSogliaZona5 = ("")
gSogliaZona6 = ("")


-------------------------------non toccare più nulla sotto questa riga------------------------------------------


Zn1 = grp.getvalue(gSogliaZona1)
Zn2 = grp.getvalue(gSogliaZona2)
Zn3 = grp.getvalue(gSogliaZona3)
Zn4 = grp.getvalue(gSogliaZona4)
Zn5 = grp.getvalue(gSogliaZona5)
Zn6 = grp.getvalue(gSogliaZona6)
Stagione = grp.getvalue(gStagione)


if (Zn1 or Zn2 or Zn3 or Zn4 or Zn5 or Zn6) and Stagione then
   
  grp.checkwrite(gRichiestaDeumidificazione, 1, true, gStatoDeumidificazione)
else
grp.checkwrite(gRichiestaDeumidificazione, 0, false, gStatoDeumidificazione)

end
Reply
#2
Set the third argument in grp.checkwrite to nil
------------------------------
Ctrl+F5
Reply
#3
Code:
--dichiarazione delle variabili locali

gRichiestaDeumidificazione    = ("7/0/10")
gStatoDeumidificazione            = ("7/1/10")
gStagione                                        =    ("0/2/2") --gruppo stagione invertito: 1= raffrescamento / 0= riscaldamento
gSogliaZona1                                = ("7/3/10")
gSogliaZona2                                = ("7/3/12")
gSogliaZona3                                = ("")
gSogliaZona4                                = ("7/3/14")
gSogliaZona5                                = ("")
gSogliaZona6                                = ("")


-------------------------------non toccare più nulla sotto questa riga------------------------------------------


Zn1                = grp.getvalue(gSogliaZona1)
Zn2                = grp.getvalue(gSogliaZona2)
Zn3                = grp.getvalue(gSogliaZona3)
Zn4                = grp.getvalue(gSogliaZona4)
Zn5                = grp.getvalue(gSogliaZona5)
Zn6                = grp.getvalue(gSogliaZona6)
Stagione    = grp.getvalue(gStagione)


if (Zn1 or Zn2 or Zn3 or Zn4 or Zn5 or Zn6) and Stagione then
          grp.write(gRichiestaDeumidificazione, 1, nil, gStatoDeumidificazione)
else
            grp.write(gRichiestaDeumidificazione, 0, nil, gStatoDeumidificazione)

end
 
(29.07.2024, 09:12)Daniel Wrote: Set the third argument in grp.checkwrite to nil
 Hi Daniel,

thanks for your reply. I set the third argument as "nil" but it still doesn't work. 

The scope of the script is to verify if at least one "Zone" is "ON" AND if the "season" is "ON". In this case set the output on "True", otherwise if alla the zones are "OFF" or the "Season" is "OFF" set to "FALSE" the output.
Reply
#4
grp.write has only has only two parameters, ok 3 but you are not using dpt.
https://kb.logicmachine.net/libraries/lu...--datatype
Add log inside if and log all variables.
------------------------------
Ctrl+F5
Reply
#5
Try this:
Code:
value = (Zn1 or Zn2 or Zn3 or Zn4 or Zn5 or Zn6) and Stagione
grp.write(gRichiestaDeumidificazione, value)
Reply


Forum Jump: