Skip to content

Commit

Permalink
Set Stookalert to boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
fwestenberg committed Nov 3, 2023
1 parent ad6c764 commit 3de6902
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
setup(
name = 'stookwijzer',
packages = ['stookwijzer'],
version = '1.4.0',
version = '1.4.1',
license='MIT',
description = 'Stookwijzer package',
author = 'fwestenberg',
Expand Down
3 changes: 2 additions & 1 deletion stookwijzer/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
print(sw.windspeed_bft)
print(sw.windspeed_ms)
print(sw.lki)
print(sw.forecast)
print(sw.forecast)

7 changes: 3 additions & 4 deletions stookwijzer/stookwijzerapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ def forecast(self):

for offset in range(2, 25, 2):
forecast.append(self.get_forecast_at_offset(localdt, offset))

return {"forecast": forecast}
return forecast

@property
def last_updated(self):
Expand All @@ -70,15 +69,15 @@ def update(self):
advice = self.get_property("advies_0")
if advice:
self._state = self.get_color(advice)
self._alert = self.get_property("alert_0")
self._alert = self.get_property("alert_0") == '1'
self._last_updated = datetime.now()

def get_forecast_at_offset(self, runtime: datetime, offset: int) -> dict:
"""Get forecast at a certain offset."""
return {
"datetime": (runtime + timedelta(hours=offset)).isoformat(),
"advice": self.get_color(self.get_property("advies_" + str(offset))),
"alert": self.get_property("alert_" + str(offset)),
"alert": self.get_property("alert_" + str(offset)) == '1',
}

def get_boundary_box(self, latitude: float, longitude: float) -> str:
Expand Down

0 comments on commit 3de6902

Please sign in to comment.