implement door status synchronization towards club-assistant
All checks were successful
Build Container / Build Container (push) Successful in 4m22s
All checks were successful
Build Container / Build Container (push) Successful in 4m22s
This commit is contained in:
parent
c56c54d7c9
commit
3f08745544
1 changed files with 152 additions and 48 deletions
|
|
@ -143,7 +143,9 @@ class AsyncMqttClient:
|
|||
if to_remove:
|
||||
self.active_subscriptions.difference_update(to_remove)
|
||||
if self.is_connected:
|
||||
logger.info(f"mqtt client unsubscribing from topics {','.join(to_remove)}")
|
||||
logger.info(
|
||||
f"mqtt client unsubscribing from topics {','.join(to_remove)}"
|
||||
)
|
||||
self.fut_unsubscribe = asyncio.get_running_loop().create_future()
|
||||
self.client.unsubscribe(list(to_remove))
|
||||
await self.fut_unsubscribe
|
||||
|
|
@ -170,7 +172,7 @@ class AsyncMqttClient:
|
|||
async def disconnect(self):
|
||||
if not self.is_connected:
|
||||
return
|
||||
|
||||
|
||||
logger.info("Disconnecting mqtt client from broker")
|
||||
self.fut_disconnect = asyncio.get_running_loop().create_future()
|
||||
self.client.disconnect()
|
||||
|
|
@ -179,3 +181,7 @@ class AsyncMqttClient:
|
|||
@property
|
||||
def is_connected(self) -> bool:
|
||||
return self.client.is_connected()
|
||||
|
||||
async def publish(self, topic: str, msg: bytes, qos: int):
|
||||
logger.debug(f"Publishing mqtt message on topic {topic}: {msg}")
|
||||
self.client.publish(topic, msg, qos)
|
||||
|
|
|
|||
Loading…
Reference in a new issue