FL550 / dwd_weather

Deutscher Wetterdienst integration for Home-Assistant
MIT License
188 stars 12 forks source link

station X104 does not fetch „Precipitation Probability“ and „Precipitation Duration“ #87

Closed diplix closed 1 year ago

diplix commented 1 year ago

as asked in https://github.com/FL550/dwd_weather/issues/86#issuecomment-1749020713

here’s a new issue for dwd_weather not fetching

X104_Precipitation Probability and name Precipitation Probability
X104_Precipitation Duration and name Precipitation Duration

after setting

logger:
  default: error
  logs:
    custom_components.dwd_weather: debug

and restarting there’s no remarkable errors but still, both sensors are unavailable.

image

here’s a log with the relevant entries: dwd_weather_debug.log

it seems the data is already missing in the Forecast data dict. i guess i need to be looking elsewhere for the error — but i have no clue where, do you?

diplix commented 1 year ago

just read in https://github.com/FL550/simple_dwd_weatherforecast#available-methods

All methods return their values as string. The datetime value has to be in UTC. If no data is available for this datetime, None will be returned. With the optional boolean shouldUpdate an automated check for new updates can be prevented by setting this parameter to False. Otherwise data is updated if new data is available with every function call.

There is also data available which is updated every hour by DWD. Be careful though, as this will download each time roughly 37MB of data. Furthermore, some elements are missing from this data:

PRECIPITATION_PROBABILITY PRECIPITATION_DURATION You can use this data by using the optional parameter force_hourly=True.

i indeed configured X104 with the „force_hourly“ option. so this would actually be expected? — unless the custom component would fill in the blanks from data without the force_hourly option — which it obviously doesn’t …

from simple_dwd_weatherforecast import dwdforecast
from datetime import datetime, timedelta, timezone
dwd_weather = dwdforecast.Weather("X104")
time_now = datetime.now(timezone.utc)
dwd_weather.update()
access_forecast_dict = dwd_weather.forecast_data
print(access_forecast_dict)
OrderedDict([('2023-10-06T04:00:00.000Z', {'TTT': 284.35, 'Td': 284.05, 'condition': '2', 'PPPP': 102450.0, 'DD': 223.0, 
'FF': 3.09, 'FX1': 5.14, 'RR1c': 0.0, 'wwP': 22.0, 'DRR1': 0.0, ' […]

dwd_weather.update(force_hourly=True)
access_forecast_dict = dwd_weather.forecast_data
print(access_forecast_dict)
OrderedDict([('2023-10-06T09:00:00.000Z', {'TTT': 288.15, 'Td': 284.85, 'condition': '2', 'PPPP': 102320.0, 'DD': 221.0, 
'FF': 4.12, 'FX1': 7.72, 'RR1c': 0.0, 'wwP': None, 'DRR1': None, ' […]

so if you configure force_hourly there’s no PRECIPITATION_PROBABILITY and PRECIPITATION_DURATION …

diplix commented 1 year ago

so there actually is no error and the workaround i used until now still stands: configure one instance with force_hourly disabled and use PRECIPITATION_PROBABILITY and PRECIPITATION_DURATION it's sensors and one instance with force_horly enabled and use the hourly sensors ...

so i would suggest to disable PRECIPITATION_PROBABILITY and PRECIPITATION_DURATION if the user chooses to enable force_hourly or — as a more elaborate workaround — replace the unavailable data in the background with non hourly data?

FL550 commented 1 year ago

Hi, thank you for your troubleshooting. I implemented your second idea with replacing the unavailable data.