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

KeyError: (<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, <Units.ELECTRIC_CURRENT_AMPERE: 'A'>) #123

Open
jamezpolley opened this issue Oct 28, 2024 · 2 comments · May be fixed by #124

Comments

@jamezpolley
Copy link

jamezpolley commented Oct 28, 2024

Version of the custom_component

Plugin reports 0.1.1 - I'm not sure if that's meaningful though.
HACS reports a8eee which matches the most recent commit here.

Configuration

I'm not sure what is being requested here

Describe the bug

Logger: custom_components.victron_ble
Source: components/bluetooth/passive_update_processor.py:575
integration: Victron BLE ([documentation](https://github.com/keshavdv/victron-hacs/), [issues](https://github.com/keshavdv/victron-hacs/issues))
First occurred: 11:31:37 (3942 occurrences)
Last logged: 12:37:56

Unexpected error updating SmartSolar HQ20439DQ data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/passive_update_processor.py", line 575, in async_handle_update
    new_data = self.update_method(update)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/victron_ble/sensor.py", line 207, in update_method
    return sensor_update_to_bluetooth_data_update(sensor_update)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/victron_ble/sensor.py", line 172, in sensor_update_to_bluetooth_data_update
    ): SENSOR_DESCRIPTIONS[
       ^^^^^^^^^^^^^^^^^^^^
KeyError: (<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, <Units.ELECTRIC_CURRENT_AMPERE: 'A'>)

Debug log

Will come back and add these later if needed.

@jamezpolley
Copy link
Author

jamezpolley commented Oct 28, 2024

Seems superficially similar to #90 (comment) - which doesn't seem to have been patched?

Also seems superficially similar to #99 (comment). I've already left comments on #101 before saying that it fixed the issue for me. Sadly that doesn't seem to have been merged yet.

I guess I'm re-patching the patch I previously patched..

jamezpolley added a commit to jamezpolley/victron-hacs that referenced this issue Oct 28, 2024
@jamezpolley jamezpolley linked a pull request Oct 28, 2024 that will close this issue
@jamezpolley
Copy link
Author

Now that I've fixed the bug, I understand what debug logs are useful for it, so...

2024-10-28 15:35:29.756 DEBUG (MainThread) [custom_components.victron_ble.device] Parsing Victron BLE advertisement data: {737: b'\x10\x02S\xa0\x01q\x86\xd2\xc4\xc5\xa9\xdf\x89\xf4\xf8\xfa\x82\xa7\n['}
2024-10-28 15:35:29.758 DEBUG (MainThread) [custom_components.victron_ble.device] Handle Victron BLE advertisement data: {'charge_state': <OperationMode.FLOAT: 5>, 'charger_error': <ChargerError.NO_ERROR: 0>, 'battery_voltage': 14.6, 'battery_charging_current': 0.0, 'yield_today': 160, 'solar_power': 2, 'external_device_load': 0.1}
2024-10-28 15:35:29.759 ERROR (MainThread) [custom_components.victron_ble] Unexpected error updating SmartSolar HQ20439DQ data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/passive_update_processor.py", line 575, in async_handle_update
    new_data = self.update_method(update)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/victron_ble/sensor.py", line 213, in update_method
    return sensor_update_to_bluetooth_data_update(sensor_update)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/victron_ble/sensor.py", line 178, in sensor_update_to_bluetooth_data_update
    ): SENSOR_DESCRIPTIONS[
       ^^^^^^^^^^^^^^^^^^^^
KeyError: (<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, <Units.ELECTRIC_CURRENT_AMPERE: 'A'>)
2024-10-28 15:35:29.766 DEBUG (MainThread) [custom_components.victron_ble.device] Parsing Victron BLE advertisement data: {737: b'\x10\x02S\xa0\x01r\x86\xd2r\x1a"ht\x0c\x8d\xf7\xec<!\x89'}
2024-10-28 15:35:29.767 DEBUG (MainThread) [custom_components.victron_ble.device] Handle Victron BLE advertisement data: {'charge_state': <OperationMode.FLOAT: 5>, 'charger_error': <ChargerError.NO_ERROR: 0>, 'battery_voltage': 14.59, 'battery_charging_current': 0.0, 'yield_today': 160, 'solar_power': 2, 'external_device_load': 0.1}
2024-10-28 15:35:29.769 ERROR (MainThread) [custom_components.victron_ble] Unexpected error updating SmartSolar HQ20439DQ data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/passive_update_processor.py", line 575, in async_handle_update
    new_data = self.update_method(update)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/victron_ble/sensor.py", line 213, in update_method
    return sensor_update_to_bluetooth_data_update(sensor_update)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/victron_ble/sensor.py", line 178, in sensor_update_to_bluetooth_data_update
    ): SENSOR_DESCRIPTIONS[
       ^^^^^^^^^^^^^^^^^^^^
KeyError: (<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, <Units.ELECTRIC_CURRENT_AMPERE: 'A'>)
2024-10-28 15:35:29.781 DEBUG (MainThread) [custom_components.victron_ble.device] Parsing Victron BLE advertisement data: {737: b'\x10\x02S\xa0\x01s\x86\xd2\xf4\xec\x94\xf6\xf4\xe9\xe4`e\xbc\xd3\x04'}
2024-10-28 15:35:29.783 DEBUG (MainThread) [custom_components.victron_ble.device] Handle Victron BLE advertisement data: {'charge_state': <OperationMode.FLOAT: 5>, 'charger_error': <ChargerError.NO_ERROR: 0>, 'battery_voltage': 14.6, 'battery_charging_current': 0.0, 'yield_today': 160, 'solar_power': 2, 'external_device_load': 0.1}
2024-10-28 15:35:29.784 ERROR (MainThread) [custom_components.victron_ble] Unexpected error updating SmartSolar HQ20439DQ data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/passive_update_processor.py", line 575, in async_handle_update
    new_data = self.update_method(update)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/victron_ble/sensor.py", line 213, in update_method
    return sensor_update_to_bluetooth_data_update(sensor_update)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/victron_ble/sensor.py", line 178, in sensor_update_to_bluetooth_data_update
    ): SENSOR_DESCRIPTIONS[
       ^^^^^^^^^^^^^^^^^^^^
KeyError: (<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, <Units.ELECTRIC_CURRENT_AMPERE: 'A'>)

For comparison, this is the logging output after #124 is applied.

2024-10-28 15:18:09.400 DEBUG (MainThread) [custom_components.victron_ble.device] Parsing Victron BLE advertisement data: {737: b'\x10\x02S\xa0\x01c\x82\xd2C\xf2\xb25\x81v\\L\xbc=\xae\n'}
2024-10-28 15:18:09.401 DEBUG (MainThread) [custom_components.victron_ble.device] Handle Victron BLE advertisement data: {'charge_state': <OperationMode.FLOAT: 5>, 'charger_error': <ChargerError.NO_ERROR: 0>, 'battery_voltage': 14.59, 'battery_charging_current': 0.0, 'yield_today': 160, 'solar_power': 2, 'external_device_load': 0.1}
2024-10-28 15:18:09.403 DEBUG (MainThread) [custom_components.victron_ble.sensor] IN 2here: PassiveBluetoothDataUpdate(devices={None: {'name': 'SmartSolar HQ20439DQ', 'manufacturer': 'Victron', 'model': 'SmartSolar MPPT 75|15'}}, entity_descriptions={PassiveBluetoothEntityKey(key='power', device_id=None): SensorEntityDescription(key='power_W', device_class=<SensorDeviceClass.POWER: 'power'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.POWER_WATT: 'W'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key='voltage', device_id=None): SensorEntityDescription(key='voltage_V', device_class=<SensorDeviceClass.VOLTAGE: 'voltage'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ELECTRIC_POTENTIAL_VOLT: 'V'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key='current', device_id=None): SensorEntityDescription(key='current_A', device_class=<SensorDeviceClass.CURRENT: 'current'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ELECTRIC_CURRENT_AMPERE: 'A'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_id=None): SensorEntityDescription(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_class=<SensorDeviceClass.ENERGY: 'energy'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ENERGY_WATT_HOUR: 'Wh'>, options=None, state_class=<SensorStateClass.TOTAL_INCREASING: 'total_increasing'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_id=None): SensorEntityDescription(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_class=<SensorDeviceClass.ENUM: 'enum'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=None, options=['off', 'low_power', 'fault', 'bulk', 'absorption', 'float', 'storage', 'equalize_manual', 'inverting', 'power_supply', 'starting_up', 'repeated_absorption', 'recondition', 'battery_safe', 'active', 'external_control', 'not_available'], state_class=None, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_id=None): SensorEntityDescription(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_class=<SensorDeviceClass.CURRENT: 'current'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ELECTRIC_CURRENT_AMPERE: 'A'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key='signal_strength', device_id=None): SensorEntityDescription(key='signal_strength_dBm', device_class=<SensorDeviceClass.SIGNAL_STRENGTH: 'signal_strength'>, entity_category=None, entity_registry_enabled_default=False, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.SIGNAL_STRENGTH_DECIBELS_MILLIWATT: 'dBm'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None)}, entity_names={PassiveBluetoothEntityKey(key='power', device_id=None): 'Power', PassiveBluetoothEntityKey(key='voltage', device_id=None): 'Voltage', PassiveBluetoothEntityKey(key='current', device_id=None): 'Current', PassiveBluetoothEntityKey(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_id=None): 'Yield Today', PassiveBluetoothEntityKey(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_id=None): 'Operation Mode', PassiveBluetoothEntityKey(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_id=None): 'External Device Load', PassiveBluetoothEntityKey(key='signal_strength', device_id=None): 'Signal Strength'}, entity_data={PassiveBluetoothEntityKey(key='power', device_id=None): 2, PassiveBluetoothEntityKey(key='voltage', device_id=None): 14.59, PassiveBluetoothEntityKey(key='current', device_id=None): 0.0, PassiveBluetoothEntityKey(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_id=None): 160, PassiveBluetoothEntityKey(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_id=None): 'float', PassiveBluetoothEntityKey(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_id=None): 0.1, PassiveBluetoothEntityKey(key='signal_strength', device_id=None): -78})
2024-10-28 15:18:10.515 DEBUG (MainThread) [custom_components.victron_ble.device] Parsing Victron BLE advertisement data: {737: b'\x10\x02S\xa0\x01d\x82\xd2\xbf\x1b\x11h\xb5\xc5\x87\xfa\xa9\xc8\x8cY'}
2024-10-28 15:18:10.517 DEBUG (MainThread) [custom_components.victron_ble.device] Handle Victron BLE advertisement data: {'charge_state': <OperationMode.FLOAT: 5>, 'charger_error': <ChargerError.NO_ERROR: 0>, 'battery_voltage': 14.6, 'battery_charging_current': 0.0, 'yield_today': 160, 'solar_power': 2, 'external_device_load': 0.1}
2024-10-28 15:18:10.520 DEBUG (MainThread) [custom_components.victron_ble.sensor] IN 2here: PassiveBluetoothDataUpdate(devices={None: {'name': 'SmartSolar HQ20439DQ', 'manufacturer': 'Victron', 'model': 'SmartSolar MPPT 75|15'}}, entity_descriptions={PassiveBluetoothEntityKey(key='power', device_id=None): SensorEntityDescription(key='power_W', device_class=<SensorDeviceClass.POWER: 'power'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.POWER_WATT: 'W'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key='voltage', device_id=None): SensorEntityDescription(key='voltage_V', device_class=<SensorDeviceClass.VOLTAGE: 'voltage'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ELECTRIC_POTENTIAL_VOLT: 'V'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key='current', device_id=None): SensorEntityDescription(key='current_A', device_class=<SensorDeviceClass.CURRENT: 'current'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ELECTRIC_CURRENT_AMPERE: 'A'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_id=None): SensorEntityDescription(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_class=<SensorDeviceClass.ENERGY: 'energy'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ENERGY_WATT_HOUR: 'Wh'>, options=None, state_class=<SensorStateClass.TOTAL_INCREASING: 'total_increasing'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_id=None): SensorEntityDescription(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_class=<SensorDeviceClass.ENUM: 'enum'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=None, options=['off', 'low_power', 'fault', 'bulk', 'absorption', 'float', 'storage', 'equalize_manual', 'inverting', 'power_supply', 'starting_up', 'repeated_absorption', 'recondition', 'battery_safe', 'active', 'external_control', 'not_available'], state_class=None, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_id=None): SensorEntityDescription(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_class=<SensorDeviceClass.CURRENT: 'current'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ELECTRIC_CURRENT_AMPERE: 'A'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key='signal_strength', device_id=None): SensorEntityDescription(key='signal_strength_dBm', device_class=<SensorDeviceClass.SIGNAL_STRENGTH: 'signal_strength'>, entity_category=None, entity_registry_enabled_default=False, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.SIGNAL_STRENGTH_DECIBELS_MILLIWATT: 'dBm'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None)}, entity_names={PassiveBluetoothEntityKey(key='power', device_id=None): 'Power', PassiveBluetoothEntityKey(key='voltage', device_id=None): 'Voltage', PassiveBluetoothEntityKey(key='current', device_id=None): 'Current', PassiveBluetoothEntityKey(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_id=None): 'Yield Today', PassiveBluetoothEntityKey(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_id=None): 'Operation Mode', PassiveBluetoothEntityKey(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_id=None): 'External Device Load', PassiveBluetoothEntityKey(key='signal_strength', device_id=None): 'Signal Strength'}, entity_data={PassiveBluetoothEntityKey(key='power', device_id=None): 2, PassiveBluetoothEntityKey(key='voltage', device_id=None): 14.6, PassiveBluetoothEntityKey(key='current', device_id=None): 0.0, PassiveBluetoothEntityKey(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_id=None): 160, PassiveBluetoothEntityKey(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_id=None): 'float', PassiveBluetoothEntityKey(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_id=None): 0.1, PassiveBluetoothEntityKey(key='signal_strength', device_id=None): -75})
2024-10-28 15:18:11.675 DEBUG (MainThread) [custom_components.victron_ble.device] Parsing Victron BLE advertisement data: {737: b'\x10\x02S\xa0\x01e\x82\xd2\xab\xf6G\xe1\x07\xef\xb4\xcd\xa88\xad\xa6'}
2024-10-28 15:18:11.677 DEBUG (MainThread) [custom_components.victron_ble.device] Handle Victron BLE advertisement data: {'charge_state': <OperationMode.FLOAT: 5>, 'charger_error': <ChargerError.NO_ERROR: 0>, 'battery_voltage': 14.6, 'battery_charging_current': 0.0, 'yield_today': 160, 'solar_power': 2, 'external_device_load': 0.1}
2024-10-28 15:18:11.681 DEBUG (MainThread) [custom_components.victron_ble.sensor] IN 2here: PassiveBluetoothDataUpdate(devices={None: {'name': 'SmartSolar HQ20439DQ', 'manufacturer': 'Victron', 'model': 'SmartSolar MPPT 75|15'}}, entity_descriptions={PassiveBluetoothEntityKey(key='power', device_id=None): SensorEntityDescription(key='power_W', device_class=<SensorDeviceClass.POWER: 'power'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.POWER_WATT: 'W'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key='voltage', device_id=None): SensorEntityDescription(key='voltage_V', device_class=<SensorDeviceClass.VOLTAGE: 'voltage'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ELECTRIC_POTENTIAL_VOLT: 'V'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key='current', device_id=None): SensorEntityDescription(key='current_A', device_class=<SensorDeviceClass.CURRENT: 'current'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ELECTRIC_CURRENT_AMPERE: 'A'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_id=None): SensorEntityDescription(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_class=<SensorDeviceClass.ENERGY: 'energy'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ENERGY_WATT_HOUR: 'Wh'>, options=None, state_class=<SensorStateClass.TOTAL_INCREASING: 'total_increasing'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_id=None): SensorEntityDescription(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_class=<SensorDeviceClass.ENUM: 'enum'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=None, options=['off', 'low_power', 'fault', 'bulk', 'absorption', 'float', 'storage', 'equalize_manual', 'inverting', 'power_supply', 'starting_up', 'repeated_absorption', 'recondition', 'battery_safe', 'active', 'external_control', 'not_available'], state_class=None, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_id=None): SensorEntityDescription(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_class=<SensorDeviceClass.CURRENT: 'current'>, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.ELECTRIC_CURRENT_AMPERE: 'A'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None), PassiveBluetoothEntityKey(key='signal_strength', device_id=None): SensorEntityDescription(key='signal_strength_dBm', device_class=<SensorDeviceClass.SIGNAL_STRENGTH: 'signal_strength'>, entity_category=None, entity_registry_enabled_default=False, entity_registry_visible_default=True, force_update=False, icon=None, has_entity_name=False, name=<UndefinedType._singleton: 0>, translation_key=None, translation_placeholders=None, unit_of_measurement=None, last_reset=None, native_unit_of_measurement=<Units.SIGNAL_STRENGTH_DECIBELS_MILLIWATT: 'dBm'>, options=None, state_class=<SensorStateClass.MEASUREMENT: 'measurement'>, suggested_display_precision=None, suggested_unit_of_measurement=None)}, entity_names={PassiveBluetoothEntityKey(key='power', device_id=None): 'Power', PassiveBluetoothEntityKey(key='voltage', device_id=None): 'Voltage', PassiveBluetoothEntityKey(key='current', device_id=None): 'Current', PassiveBluetoothEntityKey(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_id=None): 'Yield Today', PassiveBluetoothEntityKey(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_id=None): 'Operation Mode', PassiveBluetoothEntityKey(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_id=None): 'External Device Load', PassiveBluetoothEntityKey(key='signal_strength', device_id=None): 'Signal Strength'}, entity_data={PassiveBluetoothEntityKey(key='power', device_id=None): 2, PassiveBluetoothEntityKey(key='voltage', device_id=None): 14.6, PassiveBluetoothEntityKey(key='current', device_id=None): 0.0, PassiveBluetoothEntityKey(key=<VictronSensor.YIELD_TODAY: 'yield_today'>, device_id=None): 160, PassiveBluetoothEntityKey(key=<VictronSensor.OPERATION_MODE: 'operation_mode'>, device_id=None): 'float', PassiveBluetoothEntityKey(key=<VictronSensor.EXTERNAL_DEVICE_LOAD: 'external_device_load'>, device_id=None): 0.1, PassiveBluetoothEntityKey(key='signal_strength', device_id=None): -78})

jamezpolley added a commit to jamezpolley/victron-hacs that referenced this issue Oct 28, 2024
…'external_device_load'>, <Units.ELECTRIC_CURRENT_AMPERE: 'A'>) keshavdv#123

Rather than fixing the problem, this aims to robustify the code by handling failed lookups - not perfectly, but well enough to move on with, rather than simply failing to record anything at all into HomeAssistant.

It's probably overkill - I was trying to add in debug logs, and in hindsight, they aren't useful. Just adding the default description under line 169 and changing line 178 to use that default is probably sufficient.
jamezpolley added a commit to jamezpolley/victron-hacs that referenced this issue Oct 28, 2024
…'external_device_load'>, <Units.ELECTRIC_CURRENT_AMPERE: 'A'>) keshavdv#123

Rather than fixing the problem, this aims to robustify the code by handling failed lookups - not perfectly, but well enough to move on with, rather than simply failing to record anything at all into HomeAssistant.

It's probably overkill - I was trying to add in debug logs, and in hindsight, they aren't useful. Just adding the default description under line 169 and changing line 178 to use that default is probably sufficient.
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

Successfully merging a pull request may close this issue.

1 participant