1
0
mirror of https://github.com/daniviga/bite.git synced 2024-11-23 05:16:13 +01:00

Use shared subscription

This commit is contained in:
Daniele Viganò 2020-06-16 23:09:14 +02:00
parent 2a443815b0
commit 32b6350c35
Signed by: dani
GPG Key ID: DB49AFC03C40EE02

View File

@ -32,7 +32,8 @@ class Command(BaseCommand):
async def mqtt_broker(self):
async with Client(MQTT_HOST, port=MQTT_PORT) as client:
await client.subscribe("#")
# use shared subscription for HA/balancing
await client.subscribe("$share/telemetry/#")
async with client.unfiltered_messages() as messages:
async for message in messages:
payload = json.loads(message.payload.decode('utf-8'))