keshavdv / victron-hacs

Home Assistant plug-in for Victron Instant Readout compatible devices
46 stars 16 forks source link

The integration stopped working #114

Closed philspain72 closed 1 month ago

philspain72 commented 1 month ago

With the beta of this month the integration stopped working it is not connecting to the device anymore. When I restore the backup of the last version it works again.

The device is the Victron Smart Battery Sense

I have the latest version of this integration

--> 0.1.1

Version of the custom_component

Configuration


Logger: homeassistant.config_entries
Source: config_entries.py:594
First occurred: 10:55:51 AM (1 occurrences)
Last logged: 10:55:51 AM

Error setting up entry Victronsmartbattery for victron_ble
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1249, in _load_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1281, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 128, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/victron_ble/sensor.py", line 198, in
PassiveBluetoothDataProcessor[Optional[Union[float, int]]]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/typing.py", line 384, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/typing.py", line 1066, in _generic_class_getitem
_check_generic(cls, params, len(cls.parameters))
File "/usr/local/lib/python3.12/site-packages/typing_extensions.py", line 2941, in _check_generic
raise TypeError(f"Too {'many' if alen > elen else 'few'} arguments"
TypeError: Too few arguments for <class 'homeassistant.components.bluetooth.passive_update_processor.PassiveBluetoothDataProcessor'>; actual 1, expected at least 2

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/victron_ble/init.py", line 36, in async_setup_entry
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2031, in async_forward_entry_setups
await integration.async_get_platforms(platforms)
File "/usr/src/homeassistant/homeassistant/loader.py", line 1162, in async_get_platforms
import_future.result()
File "/usr/src/homeassistant/homeassistant/loader.py", line 1150, in async_get_platforms
platforms.update(self._load_platforms(platform_names))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _load_platforms
platform_name: self._load_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1269, in _load_platform
raise ImportError(
ImportError: Exception importing custom_components.victron_ble.sensor
philspain72 commented 1 month ago

It is still doing the same in 24.6 update. Is it only me having this problem?

DrKoma21 commented 1 month ago

I have exactly the same problem. Stopped working with 24.6 update.

philspain72 commented 1 month ago

I added comment on core also https://github.com/home-assistant/core/issues/118932

alwien commented 1 month ago

I updated to the latest versions yesterday and my Smart Solar and Battery Sense are both not working with a failure to set-up error showing on the integration page... have not yet dug in deeper to see if reverting fixes it.

sayer commented 1 month ago

I have the exact same issue. Thanks

pvtex commented 1 month ago

have the same problem

pvtex commented 1 month ago

ok i found a solution. edit the sensor.py file and change the line 215 to

PassiveBluetoothDataProcessor[Optional[Union[float, int]], 1]

reload integration and you get data from the bluetooth device. working here with a smartshunt

x230-thinkpad commented 1 month ago

ok i found a solution. edit the sensor.py file and change the line 215 to

PassiveBluetoothDataProcessor[Optional[Union[float, int]], 1]

reload integration and you get data from the bluetooth device. working here with a smartshunt

thx dude, it works

DrKoma21 commented 1 month ago

ok i found a solution. edit the sensor.py file and change the line 215 to

PassiveBluetoothDataProcessor[Optional[Union[float, int]], 1]

reload integration and you get data from the bluetooth device. working here with a smartshunt

Can you help me: sensor.py has only 207 lines (even in Github). Seems to be line 198.

Thanks!

alwien commented 1 month ago

If you search for PassiveBluetoothDataProcessor[Optional[Union[float, int]]] in your sensor.py file you should find it.

Was line 199 for me, adding the ', 1' Fixed my implementation, haven't tried to understand why yet 😉

pvtex commented 1 month ago

fixed in #115

pvtex commented 1 month ago

line 198 in the original version is right. i added some more to DESCRIPTIOS for my smartshut

    (
        VictronSensor.STARTER_BATTERY_VOLTAGE,
        Units.ELECTRIC_POTENTIAL_VOLT,
    ): SensorEntityDescription(
        key=VictronSensor.STARTER_BATTERY_VOLTAGE,
        device_class=SensorDeviceClass.VOLTAGE,
        native_unit_of_measurement=Units.ELECTRIC_POTENTIAL_VOLT,
        state_class=SensorStateClass.MEASUREMENT,
    ),
    (
        VictronSensor.MIDPOINT_VOLTAGE,
        Units.ELECTRIC_POTENTIAL_VOLT,
    ): SensorEntityDescription(
        key=VictronSensor.MIDPOINT_VOLTAGE,
        device_class=SensorDeviceClass.VOLTAGE,
        native_unit_of_measurement=Units.ELECTRIC_POTENTIAL_VOLT,
        state_class=SensorStateClass.MEASUREMENT,
    ),
philspain72 commented 1 month ago

thanks

philspain72 commented 1 month ago

fixed in https://github.com/keshavdv/victron-hacs/pull/115