I am trying to use DmxPy with a state machine written in Transitions but trying to pass the DmxPy to the finite state machine is throwing a metaclass error. It seems output of DmxPy is a Nonetype which is not running within the Transitions state machine.
Does anyone know how to get the following simplistic, non-functioning script working or a variation to cause a light to turn on depending upon the state we are in?
class DmxPy:
def __init__(self, serialPort):
self.serial =serialPort(serialPort, baudrate=57600)
...other DMX code...
def set_red(self, channel)
...RGBW color red mix...
def set_green(self, channel)
...RGBW color green mix...
def render(self)
self.serial.write(...DMX code...)
The above is simplistic but to run it would be
dmx = DmxPy('COM5')
dmx.set_red(1)
dmx.render()
or
dmx = DmxPy('COM5')
dmx.set_red(1)
dmx.render()
The Transitions state machine code example, non-functional code is
class State:
pass
classFSMOpen(State, DmxPy):
dmx = DmxPy('COM5')
dmx.set_red(1)
dmx.render()
classFSMClosed(State,DmxPy):
dmx = DmxPy('COM5')
dmx.set_green(1)
dmx.render()
classFSM(object)
...creation of the FSM...
From the above code, I am receiving a TypeError: metaclass conflict
and when I check the type of the DmxPy run code, it tells me it's a <class 'NoneType'>
.
So, how can I use the DmxPy code within the FSM to change a light based on the state of the FSM? Or, does anyone have a better idea?