Logic Machine Forum
trigging with tag - 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: trigging with tag (/showthread.php?tid=3169)



trigging with tag - vidar.karlsen@gk.no - 15.02.2021

Hello, 
I've 50 rooms at a hotel. 
I made a script for one room. How do I trigger my script with a tag 'guest present' instead,  and then get the name of the triggede room and write to its current VAV? I want one script instead of 50.
  
Card switch 'XS2_425_C_D' indicates guest present,and got the tag 'guest present' (together with 50 other rooms). VAV should then go to a common set value '4/2/0'. VAV's name is similar to card switch 'VAV_2_425_SP'. 
In the group 'VAV_2_425_REG' I have object from the regulator. This regulator will take over if it's greater than the set value(max comparator) and if guest is not present.

so far:

switch = grp.getvalue('XS2_425_C_D')
Comp_max_input1 = grp.getvalue('VAV_2_425_REG')
Comp_max_input2 = grp.getvalue('4/2/0')
Comp_max_output = 'VAV_2_425_SP'
if switch == true then
require('custom.fbeditor20.Math_advanced')
functions_Math_advanced_json_fbe_max_com_input_1 = Comp_max_input1
functions_Math_advanced_json_fbe_max_com_input_2 = Comp_max_input2
functions_Math_advanced_json_fbe_max_com_input_3 = nil
functions_Math_advanced_json_fbe_max_com_input_4 = nil
functions_Math_advanced_json_fbe_max_com_input_5 = nil
functions_Math_advanced_json_fbe_max_com_input_6 = nil
functions_Math_advanced_json_fbe_max_com_input_7 = nil
functions_Math_advanced_json_fbe_max_com_input_8 = nil
out = fbe_max_com(functions_Math_advanced_json_fbe_max_com_input_1, functions_Math_advanced_json_fbe_max_com_input_2, functions_Math_advanced_json_fbe_max_com_input_3, functions_Math_advanced_json_fbe_max_com_input_4, functions_Math_advanced_json_fbe_max_com_input_5, functions_Math_advanced_json_fbe_max_com_input_6, functions_Math_advanced_json_fbe_max_com_input_7, functions_Math_advanced_json_fbe_max_com_input_8, 'fb__Comparator__fbe_max_com__id')
grp.write(Comp_max_output, out)

  else
grp.write(Comp_max_output, Comp_max_input1)
end


This one works, but only for room 2_425.

best regards Vidar


RE: trigging with tag - Daniel - 15.02.2021

Hi here is example script which does what you ask for, you can convert yours same way.
Code:
--// when input = 1 then output (100%) ; when input = 0 then output (25%)

onValue = 255 -- remember that when object will have scale dpt then values are from 0-100
offValue = 64



----------------------------------------------Optional change-----------------------------------------------

PIR_name = 'PIR'
DALI_name = 'SetValue'



-----------------------------------------------------------------------------------------------
DaliOutName, found = string.gsub(grp.alias(event.dst), PIR_name, DALI_name)


myobject = grp.find(DaliOutName)
log(myobject)


if event.getvalue()  then
  if  found == 1 then
    if grp.find(DaliOutName) then   -- check if output group exists

          grp.write(DaliOutName, onValue) --//
    else
      alert('Group address '..DaliOutName ..' does not exist' )   
    end 
  else
    alert('Group address has not correct name %s', event.dst)   
  end 

 
else
 
  if found == 1 then
    if grp.find(DaliOutName) then
      grp.write(DaliOutName, offValue) --//
    else
      alert('Group address '..DaliOutName ..' does not exist' )   
    end   
  else
    alert('Group address has not correct name %s', event.dst)
    end
end
 
-----------------------------------------------------------------------------------------------



RE: trigging with tag - vidar.karlsen@gk.no - 16.02.2021

tnx, I'll try to figure it out