workign with power
This commit is contained in:
parent
0ec4645f54
commit
71151758b5
6
mqtt.py
6
mqtt.py
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user