Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-14 19:28:35 +01:00
parent 1108b9acfc
commit 70634f7eb5
1 changed files with 15 additions and 17 deletions

View File

@ -127,28 +127,26 @@ def start_mqtt_publishers(universe_count):
try: try:
# 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()
print(1)
# 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:
print(2)
print(artNetPacket.universe) print(artNetPacket.universe)
# 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 in universe_list: # if artNetPacket.universe in universe_list:
print(3) # print(3)
dmxPacket = artNetPacket.data # dmxPacket = artNetPacket.data
print(4) # print(4)
# channel = 1 # # channel = 1
# for value in artNetPacket.data: # # for value in artNetPacket.data:
# # Create MQTT topic based on the universe and channel # # # Create MQTT topic based on the universe and channel
# topic = f"{str(artNetPacket.universe)}/{str(channel)}" # # topic = f"{str(artNetPacket.universe)}/{str(channel)}"
# # Publish the DMX value to the MQTT topic # # # Publish the DMX value to the MQTT topic
# mqtt_client.publish(topic, str(value)) # # mqtt_client.publish(topic, str(value))
# channel + 1 # # channel + 1
for i in range(512): # for i in range(512):
# Lists in python start at 0, # # Lists in python start at 0,
print(dmxPacket[i-1], end=" ") # print(dmxPacket[i-1], end=" ")
print(5) # print(5)
except Exception as e: except Exception as e:
print(f"Error in universes {universe_list}: {e}") print(f"Error in universes {universe_list}: {e}")