- async with asyncio_mqtt.Client(client_id='telegram', hostname="burrow-mqtt", port=8883, tls_context=sctx) as mqtt:
- async with mqtt.unfiltered_messages() as messages:
- await mqtt.subscribe("burrow/heating/#")
- await mqtt.subscribe("burrow/temp/#")
- async for msg in messages:
- await mqtt_process_msg(msg.topic, msg.payload.decode())
+ mqtt = aiomqtt.Client(client_id='telegram', hostname="burrow-mqtt", port=8883, tls_context=sctx)
+ await mqtt.connect()
+
+ async with mqtt.messages() as messages:
+ await mqtt.subscribe("burrow/heating/#")
+ await mqtt.subscribe("burrow/temp/#")
+ async for msg in messages:
+ await mqtt_process_msg(msg.topic.value, msg.payload.decode())