OpenLightingProject / ola

The Open Lighting Architecture - The Travel Adaptor for the Lighting Industry
https://www.openlighting.org/ola/
Other
641 stars 204 forks source link

Using Python wrapper + Enttec opendmx not working #1093

Open max246 opened 8 years ago

max246 commented 8 years ago

The dmx console on the web interface is able to control my DMX light and I can update the values and it keeps sending the data.

When I use any of the examples from OLA python, I can see the wrapper updating the value on OLA but it stops sending information to the DMX device. Only by pressing the DMX console tab, OLA send the data that I set via the Python script.

I have tried different way and spent a lot of time to figure out if I missed something or if I needed to send multiple times the same value, but nothing worked.

I found a work around to send a POST request as "temporary fix" but this is a very bad hack as OLA provide a wrapper.

I have downloaded the latest OLA version from GIT and compiled.

peternewman commented 8 years ago

Which DMX interface and plugin are you using @max246 is it the Enttec OpenDMX USB as in your other query?

Which OLA python example are you using, invoked how?

If you run up ola_dmxmonitor, does that show the changing values?

max246 commented 8 years ago

I am using the Enttec OpenxDMX USB, and I have tried all the examples you have on the github.

If I open the ola dmx monitor from the web interface I can see values changing but they are not sent to the device, it is very odd.

ghost commented 6 years ago

I am having the same exact issue with the Enttec. Any updates??

peternewman commented 6 years ago

@ltd9938 can you answer the same questions I asked @max246 . Including running up the CLI ola_dmxmonitor please.

Are you just sending the value once, or every time you want to send a new frame.

Can you both confirm which plugin you're using in OLA (there are two that will work with the Enttec OpenDMX USB.

Can you also give the output of ola_dev_info please.

ghost commented 6 years ago

Sorry I didn't provide it earlier.

Here is the script I'm running

from __future__ import print_function
from ola.ClientWrapper import ClientWrapper
import array
import sys

wrapper = None

def DmxSent(status):
  if status.Succeeded():
    print('Success!')
  else:
    print('Error: %s' % status.message, file=sys.stderr)

  global wrapper
  if wrapper:
    wrapper.Stop()

def main():
  universe = 2

  val = input("DMX Value: ")

  data = array.array('B')
  data.append(int(val))

  global wrapper
  wrapper = ClientWrapper()
  client = wrapper.Client()
  client.SendDmx(universe, data, DmxSent)
  wrapper.Run()

if __name__ == '__main__':
  main()

Here is an image of the ola_dmxmonitor after I set the DMX Value to 100 using the script. https://i.imgur.com/aqYRmdF.png

Here is an image of the Monitor after setting the DMX. https://i.imgur.com/3PX3wSQ.png

I can't actually see the light change to the value of 100 unless I click the dmx console, only then will it update.

As for plugins, I'm not sure (very new to this). I haven't enabled or disabled any. I just picked the device in the universe as an output.

Here is the ola_dev_info output. https://gist.github.com/ltd9938/fe7ad1ddc61b0635fec950815566f0b7

I hope this helps.

ghost commented 6 years ago

I also just noticed the Data Loss notice on the ola_dmxmonitor disappears right when I click the DMX Console tab on the UI.

peternewman commented 6 years ago

@ltd9938 you actually have an Enttec Usb Pro DMX, not an OpenDMX. This only sends DMX data to the device when you send data, and uses a uC on the device to generate the frames. I think if you send data continually in your Python script, it should work as expected.

The DMX monitor webpage will generate it continually, which resolves the issue. Or it may be your fixture wants more frames of data.

@max246 if you can give the output of ola_dev_info, we may be able to progress your issue too.

ghost commented 6 years ago

Which plugin do you recommend I be using then? Thank you for the clarification.

peternewman commented 6 years ago

You're on the one and only plugin that supports the Pro, I assumed you were on the OpenDMX, although I wonder if @max246 is also on the same device as you and got the names mixed up. Please try sending DMX at the frame rate you desire and see if that resolves the issue.

ghost commented 6 years ago

Haha that's the thing I have no clue what frame rate I need. I'm very knew to this stuff. I'll keep tinkering around.

peternewman commented 6 years ago

It's generally around 44 Hz or a bit less.

Essentially try sending it more than once, and your light will hopefully respond.

ghost commented 6 years ago

Nope nothing. This is the script I'm working with.

from __future__ import print_function
from ola.ClientWrapper import ClientWrapper
import array
import sys
import time

wrapper = None

def DmxSent(status):
  if status.Succeeded():
    print('Success!')
  else:
    print('Error: %s' % status.message, file=sys.stderr)

  global wrapper
  if wrapper:
    wrapper.Stop()

def main():
  universe = 1

  val = input("DMX Value: ")

  data = array.array('B')
  data.append(val)

  global wrapper
  wrapper = ClientWrapper()
  client = wrapper.Client()
  for i in range(0, 100):
    client.SendDmx(universe, data, DmxSent)
    wrapper.Run()
    time.sleep(.025)

if __name__ == '__main__':
  main()

It's weird because if I use this https://github.com/davepaul0/DmxPy the light responds no problem just sending it once.

I even created a new universe and still nothing.

ghost commented 6 years ago

UPDATE: It only works once when I input 255 and have the webpage monitor open, then I can't change the value to anything else.

peternewman commented 6 years ago

The wrapper.Stop() command in your code means it will only ever run once. Or it will be continually stopping and starting. See the example code here: https://www.openlighting.org/ola/developer-documentation/python-api/#Sending_Multiple_Frames

As mentioned before, the webpage monitor will deal with regenerating the frames for you, hence why it seems to fix it.

Where did you input 255?