Files
lianli-wireless/test/watch_rx.py
T

19 lines
676 B
Python
Raw Normal View History

# Watch the fan's effect id via the RX dongle only (TX stays free for SignalRGB).
import os, sys, time
TOOLS = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
sys.path.insert(0, TOOLS)
import lianli_poc as p
rx = p.Dongle(p.RX_ID, "RX")
try:
seen = []
end = time.time() + (float(sys.argv[1]) if len(sys.argv) > 1 else 10)
while time.time() < end:
for d in p.get_devices(rx):
e = d["effect"].hex()
if not seen or seen[-1] != e:
seen.append(e)
print(f"{time.strftime('%H:%M:%S')} effect {e}")
time.sleep(0.2)
print(f"{len(seen)} distinct effect ids")
finally:
rx.close()