mawinkler / astroweather

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

Strange states after last update #36

Closed samhaa closed 10 months ago

samhaa commented 11 months ago

Thank you for amazing component and card!

After last update the weather sensor state is "▄" and same markings can be found on attributes deepsky_forecast_today_plain and tommorow. Also deepsky_forecast_tomorrow_dayname is same as today.

- datetime: '2023-10-12T00:00:00+00:00' precipitation: null precipitation_probability: null cloudcover_percentage: 37 cloudless_percentage: 62 cloud_area_fraction: 48.9 cloud_area_fraction_high: 0 cloud_area_fraction_medium: 0 cloud_area_fraction_low: 48.9 fog_area_fraction: 0 seeing_percentage: 28 transparency_percentage: 71 lifted_index: 2 condition: 52 precipitation_amount: 0 wind_speed: 1.44 wind_bearing: SW temperature: 9.1 humidity: 77 attribution: Powered by 7Timer and Met.no timestamp: '2023-10-10T00:00:00+00:00' cloudcover_percentage: 0 cloudless_percentage: 100 cloud_area_fraction: 0.8 cloud_area_fraction_high: 0 cloud_area_fraction_medium: 0 cloud_area_fraction_low: 0.7 fog_area_fraction: 0 seeing_percentage: 14 transparency_percentage: 71 lifted_index: 6 condition_percentage: 75 condition_plain: Good precipitation_amount: 0 deepsky_forecast_today_dayname: Tuesday deepsky_forecast_today_plain: ▆▆▄ deepsky_forecast_today_desc: Partlycloudy night deepsky_forecast_tomorrow_dayname: Tuesday deepsky_forecast_tomorrow_plain: ▂▂▂▂▁▁▁▁▁▁ deepsky_forecast_tomorrow_desc: Cloudy sun_next_rising: '2023-10-10T07:04:47.742935+03:00' sun_next_setting: '2023-10-10T19:08:48.190722+03:00' sun_next_rising_nautical: '2023-10-10T06:16:18.112708+03:00' sun_next_setting_nautical: '2023-10-10T19:57:06.229637+03:00' sun_next_rising_astro: '2023-10-10T05:26:28.296063+03:00' sun_next_setting_astro: '2023-10-10T20:46:38.625751+03:00' moon_next_rising: '2023-10-11T03:13:13.346802+03:00' moon_next_setting: '2023-10-10T18:07:14.456405+03:00' moon_phase: 19.7 moon_next_new_moon: '2023-10-14T20:55:06.524308+03:00' icon: mdi:weather-night friendly_name: Astroweather supported_features: 2

Same behavior for individual sensors: sensor.astroweather_deepsky_forecast_today_plain sensor.astroweather_deepsky_forecast_tomorrow_plain

sensor.astroweather_deepsky_forecast_tomorrow gives little too optimistic values as I'v got high as 212% :).

sensor.astroweather_deepsky_forecast_today seems to be correct.

Errors from Home assistant log:

` 2023-10-08 04:28:51.574 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 882, in _update_entity_states await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 750, in async_update_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state state, attr = self._async_generate_attributes() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 820, in _async_generate_attributes state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 475, in state value = self.native_value ^^^^^^^^^^^^^^^^^ File "/config/custom_components/astroweather/sensor.py", line 423, in native_value return getattr(self.coordinator.data[SENSOR_NAME], self._sensor, None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyastroweatherio/dataclasses.py", line 408, in deepsky_forecast_tomorrow for nightly_condition in self._deepsky_forecast[1].nightly_conditions:


IndexError: list index out of range
2023-10-08 04:28:51.607 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 874, in _update_entity_states
    await entity.async_update_ha_state(True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 750, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 823, in _async_generate_attributes
    attr.update(self.extra_state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/astroweather/weather.py", line 423, in extra_state_attributes
    ATTR_WEATHER_DEEPSKY_TOMORROW_PLAIN: self.deepsky_forecast_tomorrow_plain,
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/astroweather/weather.py", line 287, in deepsky_forecast_tomorrow_plain
    return self._current.deepsky_forecast_tomorrow_plain
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyastroweatherio/dataclasses.py", line 429, in deepsky_forecast_tomorrow_plain
    for nightly_condition in self._deepsky_forecast[1].nightly_conditions:
                             ~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range`
mawinkler commented 11 months ago

Did you go with the release or did you install from main?

astroweather_deepsky_forecast_tomorrow - I already found the error and will create a new pyastroweatherio today

For the daynames - I need to check this. For me it looks fine:

image

Did you experience this during the astronomical night?

The deep sky forecasts plain - this was actually intended since I now calculate hourly forecasts. good, excellent, etc, was just too long in autumn/winter time. I experimented with other variants, though:

CONDITION = ["excellent", "good", "fair", "poor", "bad"]

CONDITION = ["↑", "↗", "→", "↘", "↓"]

CONDITION = ["😁", "😀", "😐", "😕", "😞"]

CONDITION = ["█", "▆", "▄", "▂", "▁"] But decided for the little bars.

mawinkler commented 11 months ago

Should be resolved with release v0.31.0

mawinkler commented 10 months ago

Closing as this should be fixed with the above version. If it's not resolved, please let me know. 👍