added mqtt publisher

Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-14 19:33:43 +01:00
parent 7b264c26bd
commit ad1be3288a
1 changed files with 5 additions and 11 deletions

View File

@ -132,18 +132,12 @@ def start_mqtt_publishers(universe_count):
#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:
dmxPacket = artNetPacket.data dmxPacket = artNetPacket.data
# channel = 1
# for value in artNetPacket.data:
# # Create MQTT topic based on the universe and channel
# topic = f"{str(artNetPacket.universe)}/{str(channel)}"
# # Publish the DMX value to the MQTT topic
# mqtt_client.publish(topic, str(value))
# channel + 1
for i in range(512): for i in range(512):
# Lists in python start at 0, # Create MQTT topic based on the universe and channel
print(dmxPacket[i-1], end=" ") topic = f"{str(artNetPacket.universe)}/{str(i)}"
print(5)
# Publish the DMX value to the MQTT topic
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}")