Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-16 00:11:37 +01:00
parent bf6d8c5a0c
commit e48a43710e
2 changed files with 13 additions and 14 deletions

View File

@ -119,18 +119,17 @@ def start_mqtt_publishers():
# 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()
# 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: #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 dmxPacket = artNetPacket.data
dmxPacket = artNetPacket.data for i in range(512):
for i in range(512): try:
try: # Create MQTT topic based on the universe and channel
# Create MQTT topic based on the universe and channel topic = f"{str(artNetPacket.universe)}/{str(i)}"
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 KeyboardInterrupt: except KeyboardInterrupt:
break break
time.sleep(0.01) time.sleep(0.01)
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -15,8 +15,8 @@ def get_eth0_ip():
debug = False debug = False
### ArtNet Config ### ### ArtNet Config ###
artnetBindIp = str(get_eth0_ip()) # artnetBindIp = str(get_eth0_ip())
# artnetBindIp = "10.0.0.4" artnetBindIp = "10.0.0.4"
artnetUniverse = 0 artnetUniverse = 0
### Art-Net Setup ### ### Art-Net Setup ###