#zeile aufnehmen und an glaeser senden #python ola_recv_dmx.py | grep array #python ola_recv_dmx.py | python send-DMX.py #python ola_recv_dmx.py | python3 send-DMX_Arduino.py import sys import os import struct import socket UDP_IP = "172.23.92.15" #UDP_IP = "172.23.92.4" UDP_PORT = 49152 sock = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP i = 1 line = sys.stdin.readline() while line: line = sys.stdin.readline() data = line.split("[")[1] ch1 = int(data.split(", ")[0]) ch2 = int(data.split(", ")[1]) ch3 = int(data.split(", ")[2]) ch4 = int(data.split(", ")[3]) ch5 = int(data.split(", ")[4]) ch6 = int(data.split(", ")[5]) print (ch1,ch2,ch3,ch4,ch5,ch6) # echo -n "170000070150000050" >/dev/udp/172.23.92.16/31302 if (i == 1 or i == 6 or i == 11 or i == 16): # 172.23.92.16 ist Lounge, 172.23.92.19 ist flur cmd="/bin/bash -c \"echo -n \"%03i%03i%03i%03i%03i%03i\" >/dev/udp/172.23.92.16/31302\"" %(ch1,ch2,ch3,ch4,ch5,ch6) os.system(cmd) # 172.23.92.19 ist flur cmd="/bin/bash -c \"echo -n \"%03i%03i%03i%03i%03i%03i\" >/dev/udp/172.23.92.19/31302\"" %(ch1,ch2,ch3,ch4,ch5,ch6) os.system(cmd) os.system(cmd) # gläser # cmd="/bin/bash -c \"echo -n \"%03i%03i%03i%03i%03i%03i\" >/dev/udp/192.168.1.114/31302\"" %(ch1,ch2,ch3,ch4,ch5,ch6) # os.system(cmd) # cmd="/bin/bash -c \"echo -n \"%03i%03i%03i%03i%03i%03i\" >/dev/udp/192.168.1.202/31302\"" %(ch1,ch2,ch3,ch4,ch5,ch6) # os.system(cmd) # cmd="/bin/bash -c \"echo -n \"%03i%03i%03i%03i%03i%03i\" >/dev/udp/172.23.92.154/31302\"" %(ch1,ch2,ch3,ch4,ch5,ch6) # os.system(cmd) # cmd="/bin/bash -c \"echo -n \"%03i%03i%03i%03i%03i%03i\" >/dev/udp/172.23.92.153/31302\"" %(ch1,ch2,ch3,ch4,ch5,ch6) # os.system(cmd) # cmd="/bin/bash -c \"echo -n \"%03i%03i%03i%03i%03i%03i\" >/dev/udp/172.23.92.185/31302\"" %(ch1,ch2,ch3,ch4,ch5,ch6) # os.system(cmd) # neue gläser # cmd="/bin/bash -c \"echo -n \"%03i%03i%03i%03i%03i%03i\" >/dev/udp/172.23.92.191/31302\"" %(ch1,ch2,ch3,ch4,ch5,ch6) # os.system(cmd) # Fensterbogenbeleuchtung if (i == 20 or i == 10 or i == 15 or i == 5): data = [ch2,ch1,ch3]*116 sock.sendto(b'r' + struct.pack(">H", len(data) + 2) + b'\x00\x00' + bytes(data), (UDP_IP, UDP_PORT)) i = i+1 if i > 20: i = 0