robinostlund/homeassistant-volkswagencarnet

Attribute Service inspection distance not working

legantois opened this issue · 2 comments

Seems that the Service inspection distance attribute is not read properly

an error is generated in the log file

my car is an ID.4

2024-01-20 15:11:15.967 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform volkswagencarnet
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1282, in add_to_platform_finish
self.async_write_ha_state()
File "/config/custom_components/volkswagencarnet/init.py", line 346, in async_write_ha_state
super().async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 945, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1003, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 524, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/config/custom_components/volkswagencarnet/sensor.py", line 59, in native_value
return self.instrument.state
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_dashboard.py", line 180, in state
val = super().state
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_dashboard.py", line 88, in state
if hasattr(self.vehicle, self.attr):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_vehicle.py", line 843, in service_inspection_distance
return int(find_path(self.attrs, "vehicleHealthInspection.maintenanceStatus.value.inspectionDue_km"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
return find_path(src[path[0]], path[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
return find_path(src[path[0]], path[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
return find_path(src[path[0]], path[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Previous line repeated 1 more time]
KeyError: 'inspectionDue_km'

@legantois This attribute is not valid for ID models.
Initial support for ID models was added 3 days ago.
Try latest beta: https://github.com/robinostlund/homeassistant-volkswagencarnet/releases/tag/v4.5.1-beta4

works fine the beta version many thanks

I close the thread