23.03.2023, 17:20 
		
	
	
		Hey
I have made this script to open and close my gate, it works almost all the time
I'm not a programmer at all, so maybe someone can tell me if there is a better/easier/more correct way to make it work 100% all the time.
I have a 4x knx relay where I only use 3 relays
First one (2/2/0) is to control a contactor that supplies power to a big 3x400vAC to 24vDC transformer.
Second one (2/2/2) is to tell my actuators to close.
Third one (2/2/4) is to tell my actuators to open.
32/1/1 is just to open a widget with the controls.
32/1/4 is to show the status of the gate, open or closed
There is mechanical stops on the gate if it hits something.
	
	
	
	
I have made this script to open and close my gate, it works almost all the time

I'm not a programmer at all, so maybe someone can tell me if there is a better/easier/more correct way to make it work 100% all the time.
I have a 4x knx relay where I only use 3 relays
First one (2/2/0) is to control a contactor that supplies power to a big 3x400vAC to 24vDC transformer.
Second one (2/2/2) is to tell my actuators to close.
Third one (2/2/4) is to tell my actuators to open.
32/1/1 is just to open a widget with the controls.
32/1/4 is to show the status of the gate, open or closed
There is mechanical stops on the gate if it hits something.
Code:
close = event.getvalue()
status = grp.getvalue('32/1/4')
if close== true and
  status== false then
  grp.write('2/2/0', 'true')
  os.sleep(1.5)
  grp.write('2/2/2', 'true')
  os.sleep(12)
  grp.write('2/2/2', false)
  os.sleep(1.5)
  grp.write('2/2/0', false)
  grp.update('32/1/2', false)
  grp.update('32/1/4', true)
    elseif
  
  grp.getvalue('32/1/2')
  
  then
  
  grp.update('32/1/2', false)
  
  endCode:
open = event.getvalue()
status = grp.getvalue('32/1/4')
if open== true and
  status== true then
  grp.write('2/2/0', 'true')
  os.sleep(1.5)
  grp.write('2/2/4', 'true')
  os.sleep(12)
  grp.write('2/2/4', false)
  os.sleep(1.5)
  grp.write('2/2/0', false)
  grp.update('32/1/3', false)
  grp.update('32/1/4', false)
  
  elseif
  
  grp.getvalue('32/1/3')
  
  then
  
  grp.update('32/1/3', false)
  
  end