mawinkler / astroweather

Asynchronous Astro Weather Forecast for Home Assistant
GNU General Public License v3.0
79 stars 9 forks source link

Weather entity is unavailable #28

Closed jds11111 closed 1 year ago

jds11111 commented 1 year ago

EDIT: Nevermind, immediately after posting this, an update showed up in HACS that fixed everything. Thanks!

The integration has been working great for a long time. However, recently the weather.astroweather_xxxx has become unavailable. I have tried reloading the integration, deleting it and reinstalling it. However, HA states that the entity is no longer provided by the integration.

I enabled debug logging, and see the following in the logs:

    Error adding entities for domain weather with platform astroweather
    Error while setting up astroweather platform for weather

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 442, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 717, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 807, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 602, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/weather/__init__.py", line 673, in state_attributes
    if (wind_speed := self.native_wind_speed) is not None:
  File "/config/custom_components/astroweather/weather.py", line 268, in native_wind_speed
    return self._current.wind10m_speed
  File "/usr/local/lib/python3.10/site-packages/pyastroweatherio/dataclasses.py", line 106, in wind10m_speed
    return float(WIND10M_SPEED[self._wind10m.get("speed", 0)])
IndexError: list index out of range
jds11111 commented 1 year ago

Update fixed it.