al-one / hass-xiaomi-miot

Automatic integrate all Xiaomi devices to HomeAssistant via miot-spec, support Wi-Fi, BLE, ZigBee devices. 小米米家智能家居设备接入Hass集成
https://miot-spec.com
Apache License 2.0
4.46k stars 626 forks source link

Blocking call inside event loop #1694

Closed luca-angemi closed 2 months ago

luca-angemi commented 4 months ago

HA 2024.6.0b0

Detected blocking call to open inside the event loop by custom integration 'xiaomi_miot' at custom_components/xiaomi_miot/__init__.py, line 208: with open(os.path.dirname(__file__) + '/core/miot_specs_extend.json') as file: (offender: /config/custom_components/xiaomi_miot/__init__.py, line 208: with open(os.path.dirname(__file__) + '/core/miot_specs_extend.json') as file:), please create a bug report at https://github.com/al-one/hass-xiaomi-miot/issues
hmmbob commented 4 months ago

Got several other line numbers as well:

2024-06-01 16:22:19.589 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'xiaomi_miot' at custom_components/xiaomi_miot/core/xiaomi_cloud.py, line 40: super().init(username, password) (offender: /usr/local/lib/python3.12/site-packages/tzlocal/unix.py, line 62: with open(tzpath) as tzfile:) 2024-06-01 16:22:19.605 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'xiaomi_miot' at custom_components/xiaomi_miot/core/xiaomi_cloud.py, line 40: super().init(username, password) (offender: /usr/local/lib/python3.12/site-packages/tzlocal/unix.py, line 97: with open(tzpath, "rt") as tzfile:) 2024-06-01 16:22:19.636 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'xiaomi_miot' at custom_components/xiaomi_miot/core/xiaomi_cloud.py, line 40: super().init(username, password) (offender: /usr/local/lib/python3.12/site-packages/tzlocal/unix.py, line 189: with open(tzpath, "rb") as tzfile:) 2024-06-01 16:40:59.187 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'xiaomi_miot' at custom_components/xiaomi_miot/core/utils.py, line 15: with open(f'{os.path.dirname(file)}/../manifest.json') as fil: (offender: /config/custom_components/xiaomi_miot/core/utils.py, line 15: with open(f'{os.path.dirname(file)}/../manifest.json') as fil:)

The timezone ones might be related to https://developers.home-assistant.io/blog/2024/05/19/fix_zoneinfo_blocking_io/

dawiinci commented 3 months ago

Please check here for a solution: https://github.com/dummylabs/thewatchman/issues/135#issuecomment-2155726347 https://github.com/andreasbrett/thewatchman/commit/402d1bf203f2cfa607ffd01ce4feabea34dbac7f

Maybe this fix can be done with this integration as well.

Please do so fast as this flooding makes HA crash.