jnxxx / homeassistant-connectedcars_io

Home Assistant integration for connectedcars.io (Min Volkswagen)
17 stars 2 forks source link

Failing on `fuel_economy` #15

Closed mm98 closed 11 months ago

mm98 commented 1 year ago

Hi,

Am I the only one having 203 occurrences of this error today, because fuel_economy can't be found? 😅 Integration is working - I just have a bunch of these logged.

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:732
First occurred: 12:08:26 (207 occurrences)
Last logged: 15:34:27

Update for sensor.audi_a5_fuel_economy fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 732, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 991, in async_device_update
    await self.async_update()
  File "/config/custom_components/connectedcars_io/sensor.py", line 428, in async_update
    self._state = round(
                  ^^^^^^
TypeError: type NoneType doesn't define __round__ method

https://github.com/jnxxx/homeassistant-connectedcars_io/blob/3f4f010a508cd308b10feeafa1cdf9a1371dc3ce/custom_components/connectedcars_io/sensor.py#L427-L433

jnxxx commented 1 year ago

Yeah, I get it too. It seems the API started to return null as fuelEconomy last night.

The integration was meant to check for this, but apparently only does so at startup. And it fails to round null/None...

Ways to get rid of the error without a code change:

Either of these should do it. If still enabled, it should appear as Unavailable.

mm98 commented 11 months ago

Thanks! - I'll close this, since i don't see these events logged anymore!