added more tries and a for loop for the universe_list
Signed-off-by: Ebbe Baß <ebbe.bass>main
parent
e5cfecd8dd
commit
8dd4924f13
|
@ -123,20 +123,26 @@ def start_mqtt_publishers(universe_count):
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
# Gets whatever the last Art-Net packet we received is
|
for universe in universe_list:
|
||||||
artNetPacket = artNet.readPacket()
|
# Gets whatever the last Art-Net packet we received is
|
||||||
# Make sure we actually *have* a packet
|
artNetPacket = artNet.readPacket()
|
||||||
if artNetPacket is not None and artNetPacket.data is not None:
|
# Make sure we actually *have* a packet
|
||||||
#Checks to see if the current packet is for the specified DMX Universe
|
if artNetPacket is not None and artNetPacket.data is not None:
|
||||||
if artNetPacket.universe in universe_list:
|
#Checks to see if the current packet is for the specified DMX Universe
|
||||||
print(artNetPacket.universe)
|
if artNetPacket.universe == universe:
|
||||||
dmxPacket = artNetPacket.data
|
print(artNetPacket.universe)
|
||||||
for i in range(512):
|
dmxPacket = artNetPacket.data
|
||||||
# Create MQTT topic based on the universe and channel
|
try:
|
||||||
topic = f"{str(artNetPacket.universe)}/{str(i)}"
|
for i in range(512):
|
||||||
|
# Create MQTT topic based on the universe and channel
|
||||||
|
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:
|
||||||
|
print(f"Error in universes {universe_list}: {e}")
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
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