workign with power

This commit is contained in:
karl.hudgell 2021-10-28 10:13:03 +01:00
parent 0ec4645f54
commit 71151758b5

View File

@ -52,8 +52,14 @@ def subscribe(client: mqtt_client):
def on_message(client, userdata, msg):
print(f"Received `{msg.payload.decode()}` from `{msg.topic}` topic")
a = json.loads(msg.payload.decode())
if "color" in a:
hex = convert_to_bulb_format(a)
run_bulb_action(hex)
else:
if a["state"] == "OFF":
run_bulb_action("cc2433")
else:
run_bulb_action("cc2333")
client.subscribe(topic)
client.on_message = on_message