parent
1242fa12d4
commit
4430840f71
|
@ -123,27 +123,27 @@ def start_mqtt_publishers(universe_count):
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
for universe in range(universe_count):
|
# for universe in range(universe_count):
|
||||||
universe = universe - 1
|
universe = universe - 1
|
||||||
# Gets whatever the last Art-Net packet we received is
|
# Gets whatever the last Art-Net packet we received is
|
||||||
artNetPacket = artNet.readPacket()
|
artNetPacket = artNet.readPacket()
|
||||||
# Make sure we actually *have* a packet
|
# Make sure we actually *have* a packet
|
||||||
if artNetPacket is not None and artNetPacket.data is not None:
|
if artNetPacket is not None and artNetPacket.data is not None:
|
||||||
#Checks to see if the current packet is for the specified DMX Universe
|
#Checks to see if the current packet is for the specified DMX Universe
|
||||||
if artNetPacket.universe == universe:
|
if artNetPacket.universe in range(universe_count):
|
||||||
print(artNetPacket.universe)
|
print(artNetPacket.universe)
|
||||||
dmxPacket = artNetPacket.data
|
dmxPacket = artNetPacket.data
|
||||||
try:
|
try:
|
||||||
for i in range(512):
|
for i in range(512):
|
||||||
# Create MQTT topic based on the universe and channel
|
# Create MQTT topic based on the universe and channel
|
||||||
topic = f"{str(artNetPacket.universe)}/{str(i)}"
|
topic = f"{str(artNetPacket.universe)}/{str(i)}"
|
||||||
|
|
||||||
# Publish the DMX value to the MQTT topic
|
# Publish the DMX value to the MQTT topic
|
||||||
mqtt_client.publish(topic, str(dmxPacket[i-1]))
|
mqtt_client.publish(topic, str(dmxPacket[i-1]))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error in universes {universe_list}: {e}")
|
print(f"Error in universes {universe_list}: {e}")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
break
|
break
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error in universes {universe_list}: {e}")
|
print(f"Error in universes {universe_list}: {e}")
|
||||||
|
|
Loading…
Reference in New Issue