snicker / zwift_hass

Zwift Sensor Integration for HomeAssistant
52 stars 13 forks source link

Update for sensor.zwift_gradient_XXXXXX fails #23

Closed Veldkornet closed 3 years ago

Veldkornet commented 3 years ago

Zwift Plug-in: 3.2.1 HomeAssistant: 2021.4.4

Started receiving this today in the logs non-stop while Zwifting:

2021-04-13 20:01:02 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.zwift_gradient_XXXXXX fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 292, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 490, in async_device_update
    raise exc
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/zwift/sensor.py", line 202, in update
    self._state = getattr(self._player,self._type)
  File "/config/custom_components/zwift/sensor.py", line 270, in gradient
    return round(self.data.get('gradient', 0.0), 1)
TypeError: type NoneType doesn't define __round__ method
snicker commented 3 years ago

Likely fixed by #22, please reopen if not