From ad1be3288a30aaf46fe84c3d0988be4d43851a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Wed, 14 Feb 2024 19:33:43 +0100 Subject: [PATCH] added mqtt publisher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/app.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/server/app.py b/server/app.py index 440973b..4eda2f8 100644 --- a/server/app.py +++ b/server/app.py @@ -132,18 +132,12 @@ def start_mqtt_publishers(universe_count): #Checks to see if the current packet is for the specified DMX Universe if artNetPacket.universe in universe_list: 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): - # Lists in python start at 0, - print(dmxPacket[i-1], end=" ") - print(5) + # Create MQTT topic based on the universe and channel + topic = f"{str(artNetPacket.universe)}/{str(i)}" + + # Publish the DMX value to the MQTT topic + mqtt_client.publish(topic, str(dmxPacket[i-1])) except Exception as e: print(f"Error in universes {universe_list}: {e}")