briis / smartweather

WeatherFlow Smart Weather Component for Home Assistant
MIT License
108 stars 11 forks source link

Error parsing response JSON #24

Closed zacs closed 4 years ago

zacs commented 5 years ago

Have a few hundred of these wind_direction errors this morning…

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 377, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/smartweather/sensor.py", line 162, in update
    self.data.update()
  File "/usr/src/app/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/smartweather/__init__.py", line 121, in update
    self.data = weather.currentdata()
  File "/usr/local/lib/python3.7/site-packages/pysmartweatherio/models.py", line 46, in currentdata
    wind_bearing = int(self.json['obs'][0]['wind_direction'])
KeyError: 'wind_direction'
briis commented 4 years ago

These type of errors occur when a Device (AIR or SKY) goes Offline. With the current release this is now fixed.