scripts/wordclock.py

15 lines
512 B
Python
Executable File

#!/usr/bin/env cached-nix-shell
#!nix-shell -i python3 -p "python3.withPackages(ps: [ ps.paho-mqtt ])"
import sys
import paho.mqtt.client as mqtt
import wordclock_credentials as creds
client = mqtt.Client("wordclock.py")
client.username_pw_set(creds.USER, creds.PASSWORD)
client.connect(creds.MQTT_HOST, 1883, 60)
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)