patman15 / BMS_BLE-HA

This integration allows to monitor Bluetooth Low Energy (BLE) battery management systems (BMS) from within Home Assistant.
GNU Lesser General Public License v2.1
6 stars 2 forks source link

HA complaining about blocking import #20

Closed gerritb closed 1 month ago

gerritb commented 1 month ago

Describe the issue

Hello,

I'm trying to port the BMS addon for Supervolt batteries and wanted to get started today. I added the bluetooth device name pattern in manifest.json like this { "local_name": "SX100P-*", "service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb" } I wanted to check if I can get a connection to the BMS and start debugging/developing from there. The integration immediately fails with "No devices found on the network" and this is what I found in the HA logs.

Added my HW setup in the repro steps. Also added logger: default: info logs: custom_components.bms_ble: debug to my configuration.yaml but couldn't find the component log output.

Any help is appreciated, wanna get my batteries into the van HA instance.

Thank you for the base work on this project

Best, Gerrit

Reproduction steps

HA on RPi4 Core 2024.6.2 Supervisor 2024.06.0 Operating System 12.3 Frontend 20240610.0

Install integration through HACS Start integration config flow

Debug logs

Detected blocking call to import_module inside the event loop by custom integration 'bms_ble' at custom_components/bms_ble/config_flow.py, line 47: bms_plugin = importlib.import_module( (offender: /config/custom_components/bms_ble/config_flow.py, line 47: bms_plugin = importlib.import_module(), please create a bug report at https://github.com/patman15/BMS_BLE-HA/issues
patman15 commented 1 month ago

Hi! The issue Detected blocking call to import_module inside the event loop is due to a breaking change in HA 2024.05. I already have prepared the upgrade but it will force all users to upgrade at least to 2024.05 as the change is not backwards compatible. You can safely ignore this topic, it's at maximum a performance issue during startup only.

Regarding the new battery type, please refer to the contributing guidlines on how to get started and let me know if something is unclear.

I would also appreciate if you could open a new feature request with the name of the BMS you want to add, as this topic title does not really tell users what it is really about. We can discuss in the new issue if you need more help.

Best regards, patman15