skodaconnect / homeassistant-skodaconnect

Skoda Connect - A home assistant plugin to add integration with your car
Apache License 2.0
233 stars 27 forks source link

Sometimes car's outside temperature is null / undefined and it crashes the update of all values #256

Closed nation-wide closed 9 months ago

nation-wide commented 10 months ago

Describe the bug I noticed that all values were not updating in Skoda Connect HA dashboard. Inspected the logs and saw that there was issue with "outside_temperature". See the log.

Debug logs 2024-01-20 09:50:34.303 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 233, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 389, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 172, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state state, attr = self._async_generate_attributes() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 820, in _async_generate_attributes state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/config/custom_components/skodaconnect/sensor.py", line 50, in state return self.instrument.state ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/skodaconnect/dashboard.py", line 127, in state val = super().state ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/skodaconnect/dashboard.py", line 58, in state if hasattr(self.vehicle, self.attr): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/skodaconnect/vehicle.py", line 2206, in outside_temperature response = int(self.attrs.get('StoredVehicleDataResponseParsed')['0x0301020001'].get('value', 0)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'invalid'

Installation:

Additional context In MySkoda I noticed that the temperature is empty. After refresh there I could also refresh Home Assistant, but I feel there should be some notice to user about the "null" error because it stops updating all other values as well.