diff --git a/test.py b/test.py index 631eece..6feeba4 100644 --- a/test.py +++ b/test.py @@ -20,17 +20,17 @@ class MQTTClient: self.client = mqtt.Client() self.client.username_pw_set(self.username, self.password) - def push(self): + async def push(self): self.client.publish(self.topic, payload=json.dumps({"msg": "open_led"}, ensure_ascii=False), qos=0) - time.sleep(5) + await asyncio.sleep(5) self.client.publish(self.topic, payload=json.dumps({"msg": "push_stream"}, ensure_ascii=False), qos=0) - def close(self): + async def close(self): self.client.publish(self.topic, payload=json.dumps({"msg": "close_stream"}, ensure_ascii=False), qos=0) - time.sleep(5) + await asyncio.sleep(10) self.client.publish(self.topic, payload=json.dumps({"msg": "close_led"}, ensure_ascii=False), qos=0)