parent
47506bedf7
commit
b3eb6a9719
|
@ -114,27 +114,22 @@ def start_mqtt_publishers():
|
||||||
mqtt_client = connect_mqtt()
|
mqtt_client = connect_mqtt()
|
||||||
artnetBindIp = get_eth0_ip()
|
artnetBindIp = get_eth0_ip()
|
||||||
artNet = Artnet.Artnet(BINDIP = artnetBindIp, DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454)
|
artNet = Artnet.Artnet(BINDIP = artnetBindIp, DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454)
|
||||||
try:
|
while True:
|
||||||
while True:
|
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()
|
# Make sure we actually *have* a packet
|
||||||
# Make sure we actually *have* a packet
|
if artNetPacket is not None:
|
||||||
if artNetPacket 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
|
# Create MQTT topic based on the universe and channel
|
||||||
# Create MQTT topic based on the universe and channel
|
topic = {"PiXelTubes/"+str(artNetPacket.universe)}
|
||||||
topic = {"PiXelTubes/"+str(artNetPacket.universe)}
|
|
||||||
|
# Publish the DMX value to the MQTT topic
|
||||||
# Publish the DMX value to the MQTT topic
|
mqtt_client.publish(topic, str(dmxPacket))
|
||||||
mqtt_client.publish(topic, str(dmxPacket))
|
except KeyboardInterrupt:
|
||||||
except Exception as e:
|
artNet.close()
|
||||||
print(e)
|
sys.exit()
|
||||||
except KeyboardInterrupt:
|
|
||||||
artNet.close()
|
|
||||||
sys.exit()
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
flask_thread = Process(target=flask_api)
|
flask_thread = Process(target=flask_api)
|
||||||
|
|
Loading…
Reference in New Issue