SavinaRoja / DMXEnttecPro

Control the Enttec DMX USB Pro with Python3
GNU General Public License v3.0
21 stars 8 forks source link

unable to set value for a channel #1

Closed qxlsz closed 2 years ago

qxlsz commented 5 years ago

when i do python -m DMXEnttecPro.utils i get

/dev/ttyUSB0
  name: ttyUSB0
  description: FT232R USB UART
  hwid: USB VID:PID=0403:6001 SER=AL05J8AO LOCATION=1-3
  vid: 1027
  pid: 24577
  serial_number: AL05J8AO
  location: 1-3
  manufacturer: FTDI
  product: FT232R USB UART
  interface: None

i am able to read the device , but unable to set channel 1 . it doesnt cry for an error , but at the same time the dmx controller doesnt do anything to my devices connected

In [1]: from DMXEnttecPro import Controller

In [2]: dmx = Controller('/dev/ttyUSB0', auto_submit=True)

In [3]: dmx.set_channel(1, 10)

In [4]:
SavinaRoja commented 5 years ago

There can be a few things to check for on the configuration of the DMX universe. Do you have an alternative method to validate the effect of setting channel 1 to 10?

Does that port info make sense for your device? Seems a bit different from what I've seen with my Enttec devices.

qxlsz commented 5 years ago

what is the usually port info ?

qxlsz commented 5 years ago

now when i do this

In [1]: from DMXEnttecPro import Controller

In [2]: from DMXEnttecPro.utils import get_port_by_serial_number

In [3]: port = get_port_by_serial_number('AL05J8AO')

In [4]: dmx = Controller(port_string=port, auto_submit=True)

I get this error

---------------------------------------------------------------------------
PermissionError                           Traceback (most recent call last)
~/.dirty/raj/lib/python3.6/site-packages/serial/serialposix.py in open(self)
    264         try:
--> 265             self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
    266         except OSError as msg:

PermissionError: [Errno 13] Permission denied: '/dev/ttyUSB0'

During handling of the above exception, another exception occurred:

SerialException                           Traceback (most recent call last)
<ipython-input-4-2095b0135638> in <module>
----> 1 dmx = Controller(port_string=port, auto_submit=True)

~/.dirty/raj/lib/python3.6/site-packages/DMXEnttecPro/controller.py in __init__(self, port_string, dmx_size, baudrate, timeout, auto_submit)
     57             port_string,
     58             baudrate=self.baudrate,
---> 59             timeout=self.timeout
     60             )
     61

~/.dirty/raj/lib/python3.6/site-packages/serial/serialutil.py in __init__(self, port, baudrate, bytesize, parity, stopbits, timeout, xonxoff, rtscts, write_timeout, dsrdtr, inter_byte_timeout, exclusive, **kwargs)
    238
    239         if port is not None:
--> 240             self.open()
    241
    242     #  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

~/.dirty/raj/lib/python3.6/site-packages/serial/serialposix.py in open(self)
    266         except OSError as msg:
    267             self.fd = None
--> 268             raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
    269         #~ fcntl.fcntl(self.fd, fcntl.F_SETFL, 0)  # set blocking
    270

SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
qxlsz commented 5 years ago

when i logged in as root and when i run the same commands

In [5]: port = get_port_by_serial_number('AL05J8AO')

In [6]: dmx = Controller(port_string=port, auto_submit=True)

In [7]: dmx.channels
Out[7]: bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')

In [8]: dmx.set_channel(1, 100)

In [9]: dmx.set_channel(1, 100)

In [10]: dmx.set_channel(2, 100)

In [11]: dmx.submit()

In [12]: dmx
Out[12]: <DMXEnttecPro.controller.Controller at 0x7f9b977d5be0>

In [13]: dmx.get_channel(1)
Out[13]: 100

I can set values to the channel but i dont think it's reflecting on the actual device itself.

qxlsz commented 5 years ago

btw i am using this device https://www.enttec.com/product/controls/dmx-usb-interfaces/open-dmx-usb/

HJ959 commented 3 years ago

Are you perhaps not using the .close() method at the end of the script? Maybe it's already open from a previous run of the script and wasn't closed gracefully?