mawinkler / astroweather

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

This entity is no longer being provided by the astroweather integration. #27

Closed BaltasarParreira closed 1 year ago

BaltasarParreira commented 1 year ago

Recently in one or two days I started getting this error for the following entities:

sensor.astroweather_10m_wind_speed sensor.astroweather_10m_wind_speed_plain weather.astroweather_38_731_9_1373

Because of this my custom:astroweather-card stopeed working and it only show this:

image

this is the code I'm using on the card itself:

type: custom:vertical-stack-in-card
title: Weather
cards:
  - type: custom:astroweather-card
    entity: weather.forecast_home
    number_of_forecasts: '5'
    details: false
    deepskydetails: false
    forecast: false
    graph: false
ejpenney commented 1 year ago

Same, seeing lots of these in the logs:

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 330, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 135, in async_update_listeners
    update_callback()
  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 600, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 565, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 470, in state
    value = self.native_value
  File "/config/custom_components/astroweather/sensor.py", line 387, in native_value
    return getattr(self.coordinator.data[SENSOR_NAME], self._sensor, None)
  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
BaltasarParreira commented 1 year ago

Update: Right now almost all the 43 entities from astroweather are down giving the same error:

image

and many more.

So I lost the most important to me that I was using, the moon phase. : (

afxefx commented 1 year ago

It looks like 7timer is returning odd values for the 10m_wind_speed and that is causing the issue with the integration, see below:

"wind10m" : { "direction" : "-9999", "speed" : -9999 }

Akinetopsia1 commented 1 year ago

Same issue, card stopped working with an error when attempting to read wind speed


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```
mawinkler commented 1 year ago

You're right, the problem is caused by the odd values for the wind. The fix needs to be in pyastroweatherio and astroweather will need a dependency update. Working on it.

mawinkler commented 1 year ago

I did a quick fix, but there is no new release yet since I want to double-check for any other possibilities astroweather failing if the 7timer API delivers odd values. If you can, please change the requirements key in the custom_components/astroweather/manifest.json to "pyastroweatherio==0.22.5" and restart Home Assistant.

It would be cool if you report back success or failure.

afxefx commented 1 year ago

"Quick fix" worked for me, thank you.

Akinetopsia1 commented 1 year ago

Yep, that worked!

BaltasarParreira commented 1 year ago

Correct, that code change fixed everything for me as well. Great, thanks !!!

JosWennmacker commented 1 year ago

Yes, works!!

mawinkler commented 1 year ago

Fixed in https://github.com/mawinkler/astroweather/releases/tag/v0.22.5.1