From 08ed1883ceeb6a614340313d42d16b4338482fd3 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 5 Sep 2020 23:53:50 +0200 Subject: [PATCH] first commit --- README.md | 8 + ola_recv_dmx.py | 66 +++++++++ send-DMX_Arduino.py | 67 +++++++++ simple.qxw | 354 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 495 insertions(+) create mode 100644 README.md create mode 100755 ola_recv_dmx.py create mode 100644 send-DMX_Arduino.py create mode 100644 simple.qxw diff --git a/README.md b/README.md new file mode 100644 index 0000000..6153242 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# OLA-Plugin für LED Ansteuerung + +im Terminal öffnen: +python ola_recv_dmx.py | python send-DMX.py + +Dazu muss QLC+ installiert sein und der OLA Deamon laufen. +Mit QLC+ lassen sich Shows erstellen. Die ersten 6 Kanäle werden an die LED Module geschickt. Bitte IP-Adressen anpassen. +simple.qxw ist ein Beispiel für eine einfache Show. diff --git a/ola_recv_dmx.py b/ola_recv_dmx.py new file mode 100755 index 0000000..6f1abdf --- /dev/null +++ b/ola_recv_dmx.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# ola_recv_dmx.py +# Copyright (C) 2005 Simon Newton + +"""Receive DMX data.""" + +import getopt +import textwrap +import sys +from ola.ClientWrapper import ClientWrapper + +__author__ = 'nomis52@gmail.com (Simon Newton)' + + +def NewData(data): + print(data) + + +def Usage(): + print(textwrap.dedent(""" + Usage: ola_recv_dmx.py --universe + + Display the DXM512 data for the universe. + + -h, --help Display this help message and exit. + -u, --universe Universe number.""")) + + +def main(): + try: + opts, args = getopt.getopt(sys.argv[1:], "hu:", ["help", "universe="]) + except getopt.GetoptError as err: + print(str(err)) + Usage() + sys.exit(2) + + universe = 1 + for o, a in opts: + if o in ("-h", "--help"): + Usage() + sys.exit() + elif o in ("-u", "--universe"): + universe = int(a) + + wrapper = ClientWrapper() + client = wrapper.Client() + client.RegisterUniverse(universe, client.REGISTER, NewData) + wrapper.Run() + + +if __name__ == "__main__": + main() diff --git a/send-DMX_Arduino.py b/send-DMX_Arduino.py new file mode 100644 index 0000000..09d9e7b --- /dev/null +++ b/send-DMX_Arduino.py @@ -0,0 +1,67 @@ +#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 diff --git a/simple.qxw b/simple.qxw new file mode 100644 index 0000000..a4a4c37 --- /dev/null +++ b/simple.qxw @@ -0,0 +1,354 @@ + + + + + Q Light Controller Plus + 4.11.2 + + + + + + + + + + + + + + + Generic + Generic + 6 Channel + 0 + Dimmer + 0 +
0
+ 6 +
+ + + Forward + Loop + + 1 + 6 + 7 + + + + 0,255,1,0,2,0,3,255,4,0,5,0 + + + + + + Forward + Loop + + 0:2,255 + 0:0,255 + 0:1,255 + + + + Forward + Loop + + + + 0,0,1,255,2,0,3,0,4,255,5,0 + + + + 0,0,1,0,2,255,3,0,4,0,5,255 + + + + 0,255,1,0,2,0,3,0,4,255,5,0 + + + + 0,255,1,0,2,0,3,0,4,0,5,255 + + + + 0,0,1,255,2,0,3,255,4,0,5,0 + + + + 0,0,1,255,2,0,3,0,4,0,5,255 + + + + 0,0,1,0,2,255,3,255,4,0,5,0 + + + + 0,0,1,0,2,255,3,255,4,0,5,0 + + + + 0,0,1,0,2,255,3,0,4,255,5,0 + + + + Forward + Loop + + 14 + 13 + 11 + 10 + 9 + 8 + 1 + 7 + 10 + 1 + 6 + 9 + 8 + 19 + 14 + 13 + 17 + 18 + 6 + 20 + 21 + 22 + 7 + 11 + 10 + 1 + 6 + 9 + 7 + 8 + + + + Forward + Loop + + 14 + 13 + 11 + 10 + 1 + 6 + 7 + 9 + 8 + + + + 0,134,1,0,2,236,3,0,4,120,5,236 + + + + 0,139,1,255,2,0,3,0,4,230,5,120 + + + + 0,0,1,0,2,255,3,0,4,0,5,255 + + + + 0,145,1,0,2,255,3,0,4,0,5,255 + + + + 0,0,1,175,2,0,3,125,4,102,5,225 + + + + 0,0,1,239,2,0,3,77,4,0,5,255 + +
+ + + + None + Default + Default + None + Default + + + + + Sunken + Default + Default + None + Default + + + 0,0 + + + 0,3 + + + 0,1 + + + 0,2 + + + 0,5 + + + 0,4 + + + 0,5 + + + 0,4 + + + + + + + + + + + + + + + + + 255 + 255 + 0 + + + + 0 + 255 + 0 + 255 + 0 + + + + 0 + 255 + 0 + 0 + 255 + + + + 0 + 0 + 255 + 0 + 0 + 255 + + + + 0 + 0 + 255 + 255 + 0 + 0 + + + + 0 + 255 + 0 + 255 + 0 + 0 + + + + 255 + 0 + 0 + 255 + 0 + 0 + + + + 255 + 0 + 0 + 0 + 0 + 255 + + + + 255 + 0 + 255 + 0 + 255 + 0 + + + + 0 + 0 + 255 + 0 + 255 + 0 + + + + + +