Skip to content

Commit 35cdfd3

Browse files
committed
Update peripheral online state according to client connection
1 parent f6712fb commit 35cdfd3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

qtoggleserver/zigbee2mqtt/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def __init__(
116116
async def _client_loop(self) -> None:
117117
while True:
118118
try:
119+
self.set_online(False)
119120
async with aiomqtt.Client(
120121
hostname=self.mqtt_server,
121122
port=self.mqtt_port,
@@ -129,6 +130,7 @@ async def _client_loop(self) -> None:
129130
) as client:
130131
self._mqtt_client = client
131132
await client.subscribe(f"{self.mqtt_base_topic}/#")
133+
self.set_online(True)
132134
async for message in client.messages:
133135
try:
134136
await self.handle_mqtt_message(str(message.topic), message.payload)

0 commit comments

Comments
 (0)