Simon Bruder
ecd7808dd1
Older scripts (that now have no real purpose) or ones that require packages that are not in nixpkgs are not updated. They should either be removed or fixed at a later date.
15 lines
505 B
Python
Executable file
15 lines
505 B
Python
Executable file
#!/usr/bin/env 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)
|