Logic Machine Forum
General command script - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: General command script (/showthread.php?tid=3176)



General command script - svetoslavp - 17.02.2021

Hi there,
Could you help me with this script.
I have:
general comfort(32/1/2)
general standby(32/1/3)
general sleep(32/1/4)
general protection(32/1/5)

And i need a general feedback from all thermostats, something like:

if thermostat 1 op.mode.feedback (1/1/1) is "1" and if thermostat 2 op.mode.feedback (1/2/1) is "1" write general comfort feedback (32/1/6) "1"

and if thermostat 1 op.mode.feedback (1/1/1) is "2" and if thermostat 2 op.mode.feedback (1/2/1) is "2" write general standby feedback (32/1/7) "1"

I am working with Schneider wiser for knx.


Thank you!
Svetoslav Pavlov


RE: General command script - Daniel - 17.02.2021

Code:
fMode1 = grp.getvalue('1/1/1')
fMode2 = grp.getvalue('1/2/1')

if (fMode1 == 1 and fMode2 == 1) then
 
  grp.write('32/1/6', 1)

elseif (fMode1 == 2 and fMode2 == 2) then
 
  grp.write('32/1/7', 1)
 
end



RE: General command script - svetoslavp - 17.02.2021

Thank you very much!

But of course the thinks are not so easy for me. Smile How to reset the value in 32/1/6 if one of the fMode(1/1/1 or 1/2/1 ) is different then 1 and in 32/1/7 is different then 2 and in 32/1/8 will be different then 3 and in 32/1/9 different then 4. I am not sure if I understand correctly. When the parameters 1/1/1 and 1/2/1 are in position "1" the value of 32/1/6 is 1 and this is perfect. But when they (1/1/1 and 1/2/1 ) both or only one of them changed to position "2" in parameter 32/1/6 we still have "1" and we don't want. How to do this?


RE: General command script - Daniel - 17.02.2021

What do you want to write to the 32/1/7 and 32/1/7 when the condition is not meet?


RE: General command script - admin - 17.02.2021

I suppose you need something like this. 32/1/6 = 1 when both modes are 1, 0 otherwise; 32/1/7 = 1 when both modes are 2, 0 otherwise and so on.
Code:
mode1 = grp.getvalue('1/1/1')
mode2 = grp.getvalue('1/2/1')

function check(value)
  if mode1 == value and mode2 == value then
    return 1
  else
    return 0
  end
end

grp.checkwrite('32/1/6', check(1))
grp.checkwrite('32/1/7', check(2))
grp.checkwrite('32/1/8', check(3))
grp.checkwrite('32/1/9', check(4))



RE: General command script - svetoslavp - 17.02.2021

32/1/6 is a feedback signal when is 1 there is a icon(pictures) on the graphics and i want when one of the value of 1/1/1 or 1/2/1 be different then 1 this parameter 32/1/6 to be 0( the picture disappear) or if the parameters of the 1/1/1 and 1/2/1 get value 2, that means 32/1/7 to be 1 and the parameter 32/1/6 to be 0. It is something like a reset trigger but i don't know how to did here.


RE: General command script - Daniel - 17.02.2021

admin script would do this but here is version for beginners Wink
Code:
fMode1 = grp.getvalue('1/1/1')
fMode2 = grp.getvalue('1/2/1')

if (fMode1 == 1 and fMode2 == 1) then
 
  grp.checkwrite('32/1/6', 1)
 
else
 
  grp.checkwrite('32/1/6', 0)
 
end 

if (fMode1 == 2 and fMode2 == 2) then
 
  grp.checkwrite('32/1/7', 1)
   
else
   
   grp.checkwrite('32/1/7', 0)
 
end



RE: General command script - svetoslavp - 17.02.2021

(17.02.2021, 14:40)admin Wrote: I suppose you need something like this. 32/1/6 = 1 when both modes are 1, 0 otherwise; 32/1/7 = 1 when both modes are 2, 0 otherwise and so on.
Code:
mode1 = grp.getvalue('1/1/1')
mode2 = grp.getvalue('1/2/1')

function check(value)
  if mode1 == value and mode2 == value then
    return 1
  else
    return 0
  end
end

grp.checkwrite('32/1/6', check(1))
grp.checkwrite('32/1/7', check(2))
grp.checkwrite('32/1/8', check(3))
grp.checkwrite('32/1/9', check(4))

Exactly, this is exactly that i need. Thank you ppl. I really don't understand why my company use Schneider device... Here in LM there is a information for everything and you guys helps a lot. We have 5 projects with wiser and a lot of the thinks i am getting from here. Thank you again for the support! Be safe