aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbigclown-leds21
1 files changed, 11 insertions, 10 deletions
diff --git a/bigclown-leds b/bigclown-leds
index 46b3c88..516515e 100755
--- a/bigclown-leds
+++ b/bigclown-leds
@@ -3,25 +3,26 @@ import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, rc):
- print("Connected with result code "+str(rc))
- client.subscribe("node/lcd-thermostat:0/led/#")
+ print("Connected with result code " + str(rc))
+ client.subscribe("bigclown/node/lcd-thermostat:0/led/#")
# The callback for when a PUBLISH message is received from the server.
def on_message(client, userdata, msg):
topic = msg.topic[26:]
- if topic == 'effect/set':
+ if topic == "effect/set":
# Well for now just this way
client.publish(
- 'node/power-controller:0/led-strip/-/effect/set',
- '{"type": "rainbow", "wait":50}')
+ "bigclown/node/power-controller:0/led-strip/-/effect/set",
+ '{"type": "rainbow", "wait":50}',
+ )
else:
client.publish(
- 'node/power-controller:0/led-strip/-/' + topic,
- payload=msg.payload)
+ "bigclown/node/power-controller:0/led-strip/-/" + topic, payload=msg.payload
+ )
-#def on_log(mqttc, obj, level, string):
+# def on_log(mqttc, obj, level, string):
# print(string)
@@ -29,11 +30,11 @@ def main():
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
- #client.on_log = on_log
+ # client.on_log = on_log
client.connect("127.0.0.1", 1883, 60)
client.loop_forever()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()