artnet receiver passthrough

Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-13 16:20:52 +01:00
parent bc5ac6de73
commit 5165c85ded
1 changed files with 3 additions and 3 deletions

View File

@ -113,11 +113,12 @@ def connect_mqtt():
return client return client
def mqtt_publisher(universe, artnetPacket): def mqtt_publisher(universe, artnet_receiver):
universe = universe-1 universe = universe-1
mqtt_client = connect_mqtt() mqtt_client = connect_mqtt()
try: try:
while True: while True:
artnetPacket = artnet_receiver.readPacket()
try: try:
if artnetPacket is not None and artnetPacket.data is not None: if artnetPacket is not None and artnetPacket.data is not None:
if artnetPacket.universe == universe: if artnetPacket.universe == universe:
@ -142,11 +143,10 @@ def start_mqtt_publishers(universe_count):
artnet_receiver = Artnet.Artnet(DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster - "+str(get_mac_address), REFRESH = 60) artnet_receiver = Artnet.Artnet(DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster - "+str(get_mac_address), REFRESH = 60)
print(str(get_eth0_ip())) print(str(get_eth0_ip()))
artnetPacket = artnet_receiver.readPacket()
print(2) print(2)
# Create and start a thread for each universe # Create and start a thread for each universe
for universe in universes_to_publish: for universe in universes_to_publish:
threads = [threading.Thread(target=mqtt_publisher, args=(universe, artnetPacket))] threads = [threading.Thread(target=mqtt_publisher, args=(universe, artnet_receiver))]
print(3) print(3)
for thread in threads: for thread in threads: