briis / smartweather

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

Forecast -> condition attribute value is sometimes null #44

Closed jacekpaszkowski closed 3 years ago

jacekpaszkowski commented 3 years ago

Hi,

i've noticed that for some forecasts attribute condition has value null. This causes lovelace weather card problems.

weather.smartweather Eg.

temperature: 7.2
humidity: 80
pressure: 1014.9
wind_bearing: 0
wind_speed: 0
attribution: Powered by a WeatherFlow Smart Weather Station
forecast: 
- datetime: '2020-11-17T23:00:00+00:00'
  temperature: 11
  templow: 8
  precipitation: 0.1
  precipitation_probability: 50
  condition: rainy
  wind_speed: 13.7
  wind_bearing: 217
  icon: rainy
- datetime: '2020-11-18T23:00:00+00:00'
  temperature: 11
  templow: 7
  precipitation: 0.9
  precipitation_probability: 50
  condition: rainy
  wind_speed: 22.3
  wind_bearing: 218
  icon: rainy
- datetime: '2020-11-19T23:00:00+00:00'
  temperature: 8
  templow: 2
  precipitation: 0
  precipitation_probability: 20
  condition: null
  wind_speed: 19.6
  wind_bearing: 277
  icon: possibly-snow-day
- datetime: '2020-11-20T23:00:00+00:00'
  temperature: 4
  templow: 0
  precipitation: 0
  precipitation_probability: 20
  condition: null
  wind_speed: 12.5
  wind_bearing: 256
  icon: possibly-snow-day
- datetime: '2020-11-21T23:00:00+00:00'
  temperature: 7
  templow: 1
  precipitation: 1.8
  precipitation_probability: 40
  condition: partlycloudy
  wind_speed: 21.9
  wind_bearing: 234
  icon: possibly-rainy-day
- datetime: '2020-11-22T23:00:00+00:00'
  temperature: 7
  templow: 6
  precipitation: 1.2
  precipitation_probability: 40
  condition: partlycloudy
  wind_speed: 21.4
  wind_bearing: 265
  icon: possibly-rainy-day
- datetime: '2020-11-23T23:00:00+00:00'
  temperature: 7
  templow: 4
  precipitation: 0.4
  precipitation_probability: 40
  condition: partlycloudy
  wind_speed: 18.4
  wind_bearing: 274
  icon: possibly-rainy-day
- datetime: '2020-11-24T23:00:00+00:00'
  temperature: 7
  templow: 3
  precipitation: 0
  precipitation_probability: 20
  condition: null
  wind_speed: 11.8
  wind_bearing: 236
  icon: possibly-snow-day
- datetime: '2020-11-25T23:00:00+00:00'
  temperature: 6
  templow: 2
  precipitation: 0
  precipitation_probability: 20
  condition: null
  wind_speed: 12
  wind_bearing: 223
  icon: possibly-snow-day

current_icon: cc-cloudy
uv: 0
friendly_name: Smartweather Osiedle Twój Parzniew Miasto Ogród II

and values from weather.dark_sky:

temperature: 7.3
humidity: 88
ozone: 243.8
pressure: 1026.6
wind_bearing: 211
wind_speed: 3.53
visibility: 16.093
attribution: Powered by Dark Sky
forecast: 
- datetime: '2020-11-16T23:00:00+00:00'
  temperature: 9.8
  templow: 7
  precipitation: 0.3
  wind_speed: 3.04
  wind_bearing: 233
  condition: rainy
- datetime: '2020-11-17T23:00:00+00:00'
  temperature: 11.9
  templow: 6.1
  precipitation: 0.8
  wind_speed: 3.98
  wind_bearing: 219
  condition: rainy
- datetime: '2020-11-18T23:00:00+00:00'
  temperature: 12.1
  templow: 2.3
  precipitation: 0.8
  wind_speed: 6.35
  wind_bearing: 226
  condition: rainy
- datetime: '2020-11-19T23:00:00+00:00'
  temperature: 5.6
  templow: 0.4
  precipitation: 0.2
  wind_speed: 5.83
  wind_bearing: 275
  condition: rainy
- datetime: '2020-11-20T23:00:00+00:00'
  temperature: 4.6
  templow: 0.7
  precipitation: 0.1
  wind_speed: 3.41
  wind_bearing: 259
  condition: sunny
- datetime: '2020-11-21T23:00:00+00:00'
  temperature: 5.8
  templow: 5.2
  precipitation: 1.6
  wind_speed: 6.02
  wind_bearing: 230
  condition: rainy
- datetime: '2020-11-22T23:00:00+00:00'
  temperature: 7.3
  templow: 4.5
  precipitation: 1.4
  wind_speed: 5.69
  wind_bearing: 265
  condition: rainy
- datetime: '2020-11-23T23:00:00+00:00'
  temperature: 8.5
  templow: 5.1
  precipitation: 3.4
  wind_speed: 5.85
  wind_bearing: 284
  condition: rainy

friendly_name: Dark Sky
jacekpaszkowski commented 3 years ago

I've also found this kind of errors in my logs, not sure if it's related


2020-11-17 22:22:01 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 616, in _update_entity_states
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 283, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    sstate = self.state
  File "/config/custom_components/smartweather/sensor.py", line 205, in state
    value = getattr(self.coordinator.data[0], self._sensor, None)
IndexError: list index out of range
``
briis commented 3 years ago

This issue with the missing condition has been that until recently there was not a final list of possible conditions communicated by WeatherFlow. I now have it, and have adjusted the integration accordingly. It will be part of the next release common out soon.

It is hard to say what the second error is caused by, but let us see if it pops up again, after the next release.

briis commented 3 years ago

V2.0.5 released. Please close this issue if it fixes your problem.

jacekpaszkowski commented 3 years ago

@briis after updgrading to v2.0.5 it works ok. thank you! :)