added register listener with callback

Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-13 13:32:14 +01:00
parent dd20c48bd2
commit 93791586f0
1 changed files with 3 additions and 3 deletions

View File

@ -121,13 +121,13 @@ def mqtt_publisher(universe):
print(str(get_eth0_ip())) print(str(get_eth0_ip()))
receiver.start() receiver.start()
def callback(packet): # packet type: sacn.DataPacket def on_dmx_frame(packet, universe, channel_data): # packet type: sacn.DataPacket
print(packet.dmxData) print(packet.dmxData)
global dmx_values global dmx_values
dmx_values = packet.dmxData dmx_values = packet.dmxData
receiver.join_multicast(universe) receiver.join_multicast(universe)
receiver.listen_on('universe', universe=universe) receiver.register_listener(universe, on_dmx_frame)
receiver.register_listener('universe', universe=universe, callback=callback)
while True: while True:
if dmx_values is not None: if dmx_values is not None: