Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-13 22:54:03 +01:00
parent ce2b7eb962
commit 887843e703
1 changed files with 11 additions and 9 deletions

View File

@ -128,16 +128,18 @@ def mqtt_publisher(universe):
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 == artnetUniverse: if artNetPacket.universe == artnetUniverse:
# Then print out the data from each channel dmxPacket = artNetPacket.data
print("Received data: ", end="") # 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):
# Lists in python start at 0,
print(dmxPacket[i-1], end=" ")
except KeyboardInterrupt: except KeyboardInterrupt:
break break
except Exception as e: except Exception as e: