2021-07-11 10:47:36 +02:00
|
|
|
#!/usr/bin/env cached-nix-shell
|
2020-08-25 23:52:58 +02:00
|
|
|
#!nix-shell -i python3 -p "python3.withPackages(ps: [ ps.paho-mqtt ])"
|
2020-01-16 19:25:19 +01:00
|
|
|
import sys
|
|
|
|
import paho.mqtt.client as mqtt
|
|
|
|
import wordclock_credentials as creds
|
|
|
|
|
2020-02-26 00:37:11 +01:00
|
|
|
client = mqtt.Client("wordclock.py")
|
2020-01-16 19:25:19 +01:00
|
|
|
|
|
|
|
client.username_pw_set(creds.USER, creds.PASSWORD)
|
|
|
|
client.connect(creds.MQTT_HOST, 1883, 60)
|
|
|
|
|
2020-02-26 00:37:11 +01:00
|
|
|
client.publish("wordclock/color/red", sys.argv[2], retain=True)
|
|
|
|
client.publish("wordclock/color/green", sys.argv[1], retain=True)
|
|
|
|
client.publish("wordclock/color/blue", sys.argv[3], retain=True)
|