Skip to content

Commit 33ee65c

Browse files
authored
fix: ignore mdns REMOVED package (#1296)
1 parent f95c71c commit 33ee65c

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

custom_components/xiaomi_home/miot/miot_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,11 +1048,11 @@ async def __on_mips_service_state_change(
10481048

10491049
mips = self._mips_local.get(group_id, None)
10501050
if mips:
1051-
if state == MipsServiceState.REMOVED:
1052-
mips.disconnect()
1053-
self._mips_local.pop(group_id, None)
1054-
return
1055-
if (
1051+
# if state == MipsServiceState.REMOVED:
1052+
# mips.disconnect()
1053+
# self._mips_local.pop(group_id, None)
1054+
# return
1055+
if ( # ADDED or UPDATED
10561056
mips.client_id == self._entry_data['virtual_did']
10571057
and mips.host == data['addresses'][0]
10581058
and mips.port == data['port']

custom_components/xiaomi_home/miot/miot_mdns.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,10 @@ def __on_service_state_change(
232232
for item in list(self._services.values()):
233233
if item['name'] != name:
234234
continue
235-
service_data = self._services.pop(item['group_id'], {})
236-
self.__call_service_change(
237-
state=MipsServiceState.REMOVED, data=service_data)
235+
# Ignore mdns REMOVED package. Let the connection close by itself.
236+
# service_data = self._services.pop(item['group_id'], {})
237+
# self.__call_service_change(
238+
# state=MipsServiceState.REMOVED, data=service_data)
238239
return
239240
self._main_loop.create_task(
240241
self.__request_service_info_async(zeroconf, service_type, name))

0 commit comments

Comments
 (0)