BMS Version π
1.0.5
Connection Method π
USB-RS485
Pre-submission Checklist β
What's happening? π€
Last update of Home Assistant in Jan 2026 broke my bms_connector to Seplos bms , I was able to get Chatgpt to help me with Pyton as i,m not a super user ....
Changes made to 2 files ..."sensor.py" cause its β 2026.1.0 will break that sensor.py as-written because itβs still using removed/deprecated typing aliases.
Heres what chat gpt gave me
import logging
from homeassistant.core import HomeAssistant
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.entity_platform import AddEntitiesCallback
#################################################
############## BMS Routing Imports ##############
#################################################
from .bms.seplos.v2.sensors import generate_sensors as SEPLOS_V2_START
from .bms.seplos.v3.sensors import generate_sensors as SEPLOS_V3_START
_LOGGER = logging.getLogger(name)
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up sensors from a config entry."""
try:
sensor_prefix = config_entry.data.get("sensor_prefix")
bms_type = config_entry.data.get("bms_type")
port = config_entry.data.get("connector_port")
battery_address = config_entry.data.get("battery_address")
entry = config_entry.data
_LOGGER.debug("Sensor Prefix: %s", sensor_prefix)
_LOGGER.debug("BMS Type: %s", bms_type)
_LOGGER.debug("Port: %s", port)
_LOGGER.debug("Battery Address: %s", battery_address)
# For SEPLV2 BMS's
if bms_type == "SEPLV2":
_LOGGER.debug("%s selected. Routing now..", bms_type)
await SEPLOS_V2_START(
hass, bms_type, port, battery_address, sensor_prefix, entry, async_add_entities
)
# For SEPLV3 BMS's
elif bms_type == "SEPLV3":
And
_LOGGER.debug("%s selected. Routing now..", bms_type)
await SEPLOS_V3_START(
hass, bms_type, port, battery_address, sensor_prefix, entry, async_add_entities
)
else:
_LOGGER.error("Unsupported BMS type: %s", bms_type)
except Exception as e:
_LOGGER.exception("Error setting up BMS sensors: %s", e)
......Second file was "init.py"
That traceback is very clear: your init.py is trying to import a function that does not exist anymore.
from .sensor import initialize_bms_component
ImportError: cannot import name 'initialize_bms_component'
So i replaced with
from future import annotations
from homeassistant.core import HomeAssistant
from homeassistant.config_entries import ConfigEntry
PLATFORMS: list[str] = ["sensor"]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up bms_connector from a config entry."""
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
All working now i have uploaded new files to this chat
Steps to Reproduce π
init.py
sensor.py
...
Debug logs π
Logger: homeassistant.setup
Source: setup.py:343
First occurred: 14:04:21 (1 occurrence)
Last logged: 14:04:21
Setup failed for custom integration 'bms_connector': Unable to import component: cannot import name 'initialize_bms_component' from 'custom_components.bms_connector.sensor' (/config/custom_components/bms_connector/sensor.py)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1018, in async_get_component
comp = await self.hass.async_add_import_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self._get_component, True
^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/loader.py", line 1078, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 201, in protected_loop_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/config/custom_components/bms_connector/__init__.py", line 9, in <module>
from .sensor import initialize_bms_component
ImportError: cannot import name 'initialize_bms_component' from 'custom_components.bms_connector.sensor' (/config/custom_components/bms_connector/sensor.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 343, in _async_setup_component
component = await integration.async_get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1038, in async_get_component
self._component_future.result()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1030, in async_get_component
comp = self._get_component()
File "/usr/src/homeassistant/homeassistant/loader.py", line 1078, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 201, in protected_loop_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/config/custom_components/bms_connector/__init__.py", line 9, in <module>
from .sensor import initialize_bms_component
ImportError: cannot import name 'initialize_bms_component' from 'custom_components.bms_connector.sensor' (/config/custom_components/bms_connector/sensor.py)
Diagnostics dump π¦
No response
BMS Version π
1.0.5
Connection Method π
USB-RS485
Pre-submission Checklist β
What's happening? π€
Last update of Home Assistant in Jan 2026 broke my bms_connector to Seplos bms , I was able to get Chatgpt to help me with Pyton as i,m not a super user ....
Changes made to 2 files ..."sensor.py" cause its β 2026.1.0 will break that sensor.py as-written because itβs still using removed/deprecated typing aliases.
Heres what chat gpt gave me
import logging
from homeassistant.core import HomeAssistant
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.entity_platform import AddEntitiesCallback
#################################################
############## BMS Routing Imports ##############
#################################################
from .bms.seplos.v2.sensors import generate_sensors as SEPLOS_V2_START
from .bms.seplos.v3.sensors import generate_sensors as SEPLOS_V3_START
_LOGGER = logging.getLogger(name)
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up sensors from a config entry."""
try:
sensor_prefix = config_entry.data.get("sensor_prefix")
bms_type = config_entry.data.get("bms_type")
port = config_entry.data.get("connector_port")
battery_address = config_entry.data.get("battery_address")
entry = config_entry.data
And
_LOGGER.debug("%s selected. Routing now..", bms_type)
await SEPLOS_V3_START(
hass, bms_type, port, battery_address, sensor_prefix, entry, async_add_entities
)
......Second file was "init.py"
That traceback is very clear: your init.py is trying to import a function that does not exist anymore.
from .sensor import initialize_bms_component
ImportError: cannot import name 'initialize_bms_component'
So i replaced with
from future import annotations
from homeassistant.core import HomeAssistant
from homeassistant.config_entries import ConfigEntry
PLATFORMS: list[str] = ["sensor"]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up bms_connector from a config entry."""
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
All working now i have uploaded new files to this chat
Steps to Reproduce π
init.py
sensor.py
...
Debug logs π
Diagnostics dump π¦
No response