Open gorenje opened 4 years ago
Hey!
You are correct, this currently doesn't have support for OLA. If you're familiar with OLA it'd be great to have someone implement a controller for it, similar to how the uDMX controller is implemeneted! :)
Ok, then I'll have a look and see what I can do!
I was looking at their API (https://www.openlighting.org/ola/developer-documentation/python-api/) and it seems that, roughly speaking, the controller would do something like:
### import and initalise OLA
from array import array
from ola.ClientWrapper import ClientWrapper
def DmxSent(state):
wrapper.Stop()
### ... in the controller ...
def _send_data(self):
# Get the data
data = self.get_frame()
# Attempt to send data max 5 times, then 2 more with reconnect to device
# Thanks to Dave Hocker (pyudmx author) for giving me this solution to the random usb errors
success = False
retry_count = 0
while not success:
try:
wrapper = ClientWrapper()
client = wrapper.Client()
client.SendDmx(4, array('B', data), DmxSent)
success = True
except Exception as e:
retry_count += 1
if retry_count > 7:
raise e
But I don't know what data
consists of. OLA assumes an arrray with one entry per channel ... I assume that's the same here.
That looks roughly correct -- You'll probably want to persist the wrapper/client in the controller rather than creating them each time & off the top of my head (haven't touched this in-depth for a while), yeah, data
should be a list containing values for the entire universe.
Had a play around and got some working code together --> https://github.com/gorenje/PyDMXControl/commit/eb551e70370c0b9544bfba6852a0d2a0496951a9
As you said, I persisted the wrapper and client but I also prevented the controller from bombarding the OLA daemon since OLA remembers it's state. To keep things simple, I removed the error handling and retry, don't know what the consequence of doing that is.
This basically "works for me"(TM) - running OLA and PyDMXControl on a Raspberry Pi 3+.
Hi,
There isn't support for the Open Lighting Architecture if I see that right? I was wondering whether it would make sense to have a controller that interfaces with OLA via their Python APIs?
I'm new to DMX and OLA but I've got a setup working with OLA and a BitWizard usb dongle (http://www.bitwizard.nl/shop/raspberry-pi?product_id=154). What I'm looking for is a QLCplus-like web interface for managing my lights.
So I'm kinda wondering if this is the right project for me!
Cheers!