diff --git a/dmx_queue.py b/dmx_queue.py index 4184d21..b8ca31d 100644 --- a/dmx_queue.py +++ b/dmx_queue.py @@ -8,6 +8,7 @@ from sacn import sACNsender LOG = logging.getLogger('DMXQueue') + class DMXQueue: def __init__(self, args, queue, lights): self.args = args @@ -27,7 +28,7 @@ class DMXQueue: if not self.args.sacn_multicast: self.sacn[1].destination = self.args.sacn_target - self.dmx_data = 512*[0] + self.dmx_data = 512 * [0] for i in range(1, 513): self._dmx(i, 0) @@ -41,12 +42,12 @@ class DMXQueue: self.sacn.stop() def _dmx(self, addr, data): - self.dmx_data[addr-1] = data + self.dmx_data[addr - 1] = data self.sacn[1].dmx_data = tuple(self.dmx_data) def _bulk(self, start_addr, values): for idx, value in enumerate(values): - self._dmx(start_addr+idx, value) + self._dmx(start_addr + idx, value) def _update_all(self, intensity, red, green, blue, white=0): for light in self.lights: @@ -97,7 +98,7 @@ class DMXQueue: elif level == 'info': for i in range(2): for intensity_multiplier in forward + reverse: - self._update_all(intensity_multiplier*15, 0, 50, 255) + self._update_all(intensity_multiplier * 15, 0, 50, 255) sleep(0.03) self.queue.task_done() except Empty: diff --git a/lights/common.py b/lights/common.py index ad0a516..3c5eab5 100644 --- a/lights/common.py +++ b/lights/common.py @@ -2,6 +2,7 @@ import logging LOG = logging.getLogger('DMX') + class BaseDMXLight: def __init__(self, address): self.address = address diff --git a/lights/ignition_wal_l710.py b/lights/ignition_wal_l710.py index 5029297..5803e19 100644 --- a/lights/ignition_wal_l710.py +++ b/lights/ignition_wal_l710.py @@ -1,5 +1,6 @@ from .common import BaseDMXLight + class IgnitionWALL710(BaseDMXLight): name = "Ignition WAL-L710 PAR" @@ -10,5 +11,5 @@ class IgnitionWALL710(BaseDMXLight): self.green, self.blue, self.white, - 0, # program + 0, # program ] diff --git a/lights/varytec_hero_wash_zoom_712.py b/lights/varytec_hero_wash_zoom_712.py index 50e0d23..10a1b18 100644 --- a/lights/varytec_hero_wash_zoom_712.py +++ b/lights/varytec_hero_wash_zoom_712.py @@ -1,23 +1,24 @@ from .common import BaseDMXLight + class VarytecHeroWashZoom712(BaseDMXLight): name = "Varytec Hero Wash 712 Z RGBW Zoom" def _dump(self): return self.address, [ - 128, # pan - 128, # pan fine - 128, # tilt - 128, # tilt fine - 0, # speed + 128, # pan + 128, # pan fine + 128, # tilt + 128, # tilt fine + 0, # speed self.intensity, - 0, # shutter + 0, # shutter self.red, self.green, self.blue, self.white, - 0, # colortemp - 0, # color macro - 0, # zoom - 0, # auto run + 0, # colortemp + 0, # color macro + 0, # zoom + 0, # auto run ] diff --git a/lights/wled.py b/lights/wled.py index 2b22a92..ecb220b 100644 --- a/lights/wled.py +++ b/lights/wled.py @@ -1,5 +1,6 @@ from .common import BaseDMXLight + class WLED(BaseDMXLight): name = "WLED" diff --git a/main.py b/main.py index 382c5aa..ff88bf9 100755 --- a/main.py +++ b/main.py @@ -7,11 +7,10 @@ from sys import exit from time import sleep from dmx_queue import DMXQueue -from mqtt_queue import MQTTQueue - -from lights.wled import WLED from lights.ignition_wal_l710 import IgnitionWALL710 from lights.varytec_hero_wash_zoom_712 import VarytecHeroWashZoom712 +from lights.wled import WLED +from mqtt_queue import MQTTQueue logging.basicConfig( level=logging.DEBUG, @@ -20,8 +19,8 @@ logging.basicConfig( LOG = logging.getLogger('main') -def main(): +def main(): parser = ArgumentParser() # rainbow is output if we have no effects @@ -124,5 +123,6 @@ def main(): LOG.info('Bye!') + if __name__ == '__main__': main() diff --git a/mqtt_queue.py b/mqtt_queue.py index c413d08..dfa235a 100644 --- a/mqtt_queue.py +++ b/mqtt_queue.py @@ -8,6 +8,7 @@ from sacn import sACNsender LOG = logging.getLogger('MQTTQueue') + class MQTTQueue: def __init__(self, args, queue): self.args = args @@ -44,10 +45,12 @@ class MQTTQueue: text = re.sub(r'\<[a-z\/]+\>', '', data['msg']) - self.queue.put(( - data['level'].lower(), - data['component'], - text, - )) + self.queue.put( + ( + data['level'].lower(), + data['component'], + text, + ) + ) except Exception as e: LOG.exception(msg.payload)