DMX output interfaces

This module provides SHC interface implementations to control DMX lighting equipment from SHC.

Simple usage example:

import shc
import shc.interfaces.dmx
from shc.datatypes import RangeUInt8, RGBFloat1

dmx_interface = shc.interfaces.dmx.EnttecDMXUSBProConnector(serial_url="/dev/ttyUSB3",
                                                            universe_size=10)  # improves transmission speed

dimmer_1 = shc.Variable(RangeUInt8, "dimmer 1").connect(dmx_interface.address(1))
dimmer_2 = shc.Variable(RangeUInt8, "dimmer 2").connect(dmx_interface.address(2))
# ...

rgb_par = shc.Variable(RGBUInt8, "LED PAR")
rgb_par.field('red').connect(dmx_interface.address(7))
rgb_par.field('green').connect(dmx_interface.address(8))
rgb_par.field('blue').connect(dmx_interface.address(9))

(see Tuple Field Access for an explanation why accessing the RGB colors works this way.)

class shc.interfaces.dmx.AbstractDMXConnector(universe_size: int = 512)

Abstract base class for DMX output interfaces.

Concrete implementations, included with SHC, for specific protocols are:

Instances of these classes provide a method address() to create a writable object for a given DMX channel.

address(dmx_address: int) DMXAddress

Get a Writable object for a specific DMX channel

The expected value type is shc.datatypes.RangeUInt8.

Parameters:

dmx_address – The DMX channel address from 1 to 512

Returns:

A Writable object for that DMX channel

abstract async transmit() None

Abstract coroutine to trigger the transmission of the cached DMX universe to the DMX interface.

This method is automatically called by DMXAddress.write().

Concrete implementations of this method should make sure to await the successful transmission of the current universe state to the hardware interface. This might include waiting for the flushing of the serial buffer.

class shc.interfaces.dmx.DMXAddress(connector: AbstractDMXConnector, address: int)

Writable object of type RangeUInt8, representing a single DMX channel of a AbstractDMXConnector.

Writing a value to a DMXAddress object sets the corresponding channel in the cached DMX universe to that value and triggers transmission of the universe to the hardware DMX interface.

class shc.interfaces.dmx.EnttecDMXUSBProConnector(serial_url: str, universe_size: int = 512)

A DMX Interface for the Enttec DMX USB PRO and compatible devices (with the same serial protocol).