Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

断网重连后部分蓝牙mesh设备无法自动重连,需要手动重载插件 #686

Open
refined-fish opened this issue Jan 22, 2025 · 4 comments

Comments

@refined-fish
Copy link

refined-fish commented Jan 22, 2025

Describe the Bug / 描述问题

由于 停电 PPPoE在线超时 路由器重启 等原因,外网连接有时会发生中断,尽管中断只是暂时的,但重新连接外网后总是有部分蓝牙mesh设备无法重连,在HomeAssistan中显示为离线状态。只有手动重载插件,或者重启HomeAssistan才可重连。

How to Reproduce / 复现步骤

  1. 由各种事件导致外网链接暂时性断开
  2. 外网链接恢复,设备开始陆续在线
  3. 但是部分蓝牙mesh设备始终无法重连,如下图

Image

Expected Behavior / 预期结果

最好的情况是完全本地控制,但是我的中枢网关尚未接收到推送,但是目前预期结果也应该是断网回复后能够尽快恢复所有设备的在线状态。

Reproduce Time / 问题复现的时间点

2025-01-22 4:28:34

Home Assistant Logs / 系统日志

问题发生的时间节点我没有开启集成日志的debug,如果有办法获取日志并且需要,还请告诉我

断网时间似乎只有一条检测网络问题的日志如下

此错误来自自定义集成。

日志记录器: homeassistant
来源: custom_components/xiaomi_home/miot/miot_mips.py:1033
集成: Xiaomi Home (文档, 问题)
首次出现: 04:28:12 (1 次总计出现)
上次记录: 04:28:12

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/config/custom_components/xiaomi_home/miot/miot_client.py", line 1073, in __on_mips_cloud_state_changed
    self.__update_device_msg_sub(did=did)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/config/custom_components/xiaomi_home/miot/miot_client.py", line 965, in __update_device_msg_sub
    self._mips_cloud.unsub_prop(did=did)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/config/custom_components/xiaomi_home/miot/miot_mips.py", line 910, in unsub_prop
    return self.__unreg_broadcast_external(topic=topic)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_home/miot/miot_mips.py", line 1033, in __unreg_broadcast_external
    self._internal_loop.call_soon_threadsafe(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self.__unreg_broadcast, topic)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 873, in call_soon_threadsafe
    self._check_closed()
    ~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 551, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

然后在11点(断网后7小时且设备仍未链接),有一条日志

此错误来自自定义集成。

日志记录器: custom_components.xiaomi_home.miot.miot_client
来源: custom_components/xiaomi_home/miot/miot_mips.py:1141
集成: Xiaomi Home (文档, 问题)
首次出现: 2025年1月18日 13:10:37 (5657 次总计出现)
上次记录: 11:20:54

地名, mips try reconnect after 6s
地名, mips try reconnect after 12s
地名, mips try reconnect after 24s
地名, mips try reconnect after 48s
地名, mips try reconnect after 60s

Log Timezone / 日志时区

asia/shanghai

Home Assistant Core Version / Home Assistant Core 版本

2025.1.2

Home Assistant Operation System Version / Home Assistant Operation System 版本

14.1

Xiaomi Home Integration Version / 米家集成版本

v0.1.5b2

Additional Context / 其他说明

或许与https://github.com/XiaoMi/ha_xiaomi_home/issues/500相似

出现问题的掉线设备类型为蓝牙mesh灯泡 giot.light.v5ssm yeelink.light.mbulb3 ,其连接网关为小米中枢网关,其余设备工作均正常

@refined-fish refined-fish changed the title 断网重连后部分蓝牙mesh设备无法自动重连 断网重连后部分蓝牙mesh设备无法自动重连,需要手动重载插件 Jan 22, 2025
@topsworld topsworld self-assigned this Jan 22, 2025
@bumaociyuan
Copy link

662610	2025-01-22 10:01:47.826 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
662611	Traceback (most recent call last):
662612	  File "/config/custom_components/xiaomi_home/miot/miot_client.py", line 1073, in __on_mips_cloud_state_changed
662613	    self.__update_device_msg_sub(did=did)
662614	  File "/config/custom_components/xiaomi_home/miot/miot_client.py", line 965, in __update_device_msg_sub
662615	    self._mips_cloud.unsub_prop(did=did)
662616	  File "/config/custom_components/xiaomi_home/miot/miot_mips.py", line 910, in unsub_prop
662617	    return self.__unreg_broadcast_external(topic=topic)
662618	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
662619	  File "/config/custom_components/xiaomi_home/miot/miot_mips.py", line 1033, in __unreg_broadcast_external
662620	    self._internal_loop.call_soon_threadsafe(
662621	  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 838, in call_soon_threadsafe
662622	    self._check_closed()
662623	  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 540, in _check_closed
662624	    raise RuntimeError('Event loop is closed')
662625	RuntimeError: Event loop is closed

同样的问题

@qjrxsoft02
Copy link

建议加入一个类似 Xiaomi Miot Auto集成的Xiaomi Miot Auto: reload动作,以后就可以在自动化里自动里定时重载了Xiaomi Home集成了,如果定时重载Xiaomi Home集成,这样就稳定多了。

Image

@topsworld topsworld removed their assignment Jan 24, 2025
@Lucas-lyh
Copy link

自动重载会导致虚拟事件重复产生和设备断联时间,不是个很好的方法

@king-NB
Copy link

king-NB commented Jan 25, 2025

确实有这个问题,是松下的灯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants