Skip to content

Commit

Permalink
Bugfix for report data
Browse files Browse the repository at this point in the history
  • Loading branch information
FL550 committed Sep 18, 2023
1 parent c75179b commit 34e9a77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="simple_dwd_weatherforecast",
version="2.0.10",
version="2.0.11",
author="Max Fermor",
description="A simple tool to retrieve a weather forecast from DWD OpenData",
long_description=long_description,
Expand Down
15 changes: 9 additions & 6 deletions simple_dwd_weatherforecast/dwdforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,17 @@ def get_reported_weather(self, weatherDataType: WeatherDataType, shouldUpdate=Tr
if not self.has_measurement(self.station_id):
print("no report for this station available")
return None
if shouldUpdate or self.report_data is None:
if shouldUpdate:
self.update(with_measurements=True)
if weatherDataType == WeatherDataType.CONDITION:
return self.actual_report_codes[
self.report_data[WeatherDataType.CONDITION.value[0]]
]
if self.report_data is not None:
if weatherDataType == WeatherDataType.CONDITION:
return self.actual_report_codes[
self.report_data[WeatherDataType.CONDITION.value[0]]
]
else:
return self.report_data[weatherDataType.value[0]]
else:
return self.report_data[weatherDataType.value[0]]
print("no report for this station available. Have you updated first?")

def get_timeframe_max(
self,
Expand Down

0 comments on commit 34e9a77

Please sign in to comment.