Compare commits

...

3 Commits

Author SHA1 Message Date
Li Shuzhen
5d0878b30b
Merge 880fea3f4b into fbddaf80a7 2025-10-13 18:01:57 +08:00
Li Shuzhen
fbddaf80a7
fix: pylint 4.0.0 (#1455)
Some checks are pending
Tests / check-rule-format (push) Waiting to run
Validate / validate-hassfest (push) Waiting to run
Validate / validate-hacs (push) Waiting to run
Validate / validate-lint (push) Waiting to run
Validate / validate-setup (push) Waiting to run
2025-10-13 17:11:30 +08:00
LiShuzhen
880fea3f4b fix: ignore mdns REMOVED package 2025-07-24 09:54:47 +08:00
3 changed files with 14 additions and 13 deletions

View File

@ -1048,11 +1048,11 @@ class MIoTClient:
mips = self._mips_local.get(group_id, None)
if mips:
if state == MipsServiceState.REMOVED:
mips.disconnect()
self._mips_local.pop(group_id, None)
return
if (
# if state == MipsServiceState.REMOVED:
# mips.disconnect()
# self._mips_local.pop(group_id, None)
# return
if ( # ADDED or UPDATED
mips.client_id == self._entry_data['virtual_did']
and mips.host == data['addresses'][0]
and mips.port == data['port']

View File

@ -232,9 +232,10 @@ class MipsService:
for item in list(self._services.values()):
if item['name'] != name:
continue
service_data = self._services.pop(item['group_id'], {})
self.__call_service_change(
state=MipsServiceState.REMOVED, data=service_data)
# Ignore mdns REMOVED package. Let the connection close by itself.
# service_data = self._services.pop(item['group_id'], {})
# self.__call_service_change(
# state=MipsServiceState.REMOVED, data=service_data)
return
self._main_loop.create_task(
self.__request_service_info_async(zeroconf, service_type, name))

View File

@ -49,7 +49,7 @@ MIoT redirect web pages.
import os
import asyncio
_template = ''
web_template = ''
def _load_page_template():
@ -57,18 +57,18 @@ def _load_page_template():
os.path.dirname(os.path.abspath(__file__)),
'resource/oauth_redirect_page.html')
with open(path, 'r', encoding='utf-8') as f:
global _template
_template = f.read()
global web_template
web_template = f.read()
async def oauth_redirect_page(
title: str, content: str, button: str, success: bool
) -> str:
"""Return oauth redirect page."""
if _template == '':
if web_template == '':
await asyncio.get_running_loop().run_in_executor(
None, _load_page_template)
web_page = _template.replace('TITLE_PLACEHOLDER', title)
web_page = web_template.replace('TITLE_PLACEHOLDER', title)
web_page = web_page.replace('CONTENT_PLACEHOLDER', content)
web_page = web_page.replace('BUTTON_PLACEHOLDER', button)
web_page = web_page.replace(