Skip to content

Commit

Permalink
Merge pull request #26 from bremor/bremor-patch-1
Browse files Browse the repository at this point in the history
Stop rain_amount_max being from being unknown.
  • Loading branch information
bremor authored Nov 13, 2020
2 parents c28dd05 + 3553447 commit fc00885
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions custom_components/bureau_of_meteorology/PyBoM/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,14 @@ async def flatten_forecast_data(self):
flattened["uv_end_time"] = uv["end_time"]

rain = self.daily_forecasts_data["data"][day]["rain"]
flattened["rain_amount_min"] = rain["amount"]["min"]
flattened["rain_amount_max"] = rain["amount"]["max"]
flattened["rain_chance"] = rain["chance"]
flattened["rain_amount_min"] = rain["amount"]["min"]

# When rain amount max is None, set as rain amount min
if rain["amount"]["max"] is None:
flattened["rain_amount_max"] = flattened["rain_amount_min"]
else:
flattened["rain_amount_max"] = rain["amount"]["max"]

self.daily_forecasts_data["data"][day].update(flattened)

Expand Down

0 comments on commit fc00885

Please sign in to comment.