diff --git a/mqtt.py b/mqtt.py index ca95057..9d87461 100644 --- a/mqtt.py +++ b/mqtt.py @@ -51,12 +51,12 @@ def publish(client): 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) + json_response = json.loads(msg.payload.decode()) + if "color" in json_response: + hex = convert_to_bulb_format(json_response) run_bulb_action(hex) else: - if a["state"] == "OFF": + if json_response["state"] == "OFF": run_bulb_action("cc2433") else: run_bulb_action("cc2333")