Skip to content

Commit

Permalink
Merge pull request #15 from golles/forecast-low-and-high-temps
Browse files Browse the repository at this point in the history
Fix for high temperature for forecasts
  • Loading branch information
golles authored Jan 8, 2022
2 parents f7a1a49 + c03753f commit 4de958b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body:
label: Did you read the instructions?
description: Please read the instructions carefully, thank you.
options:
- label: I have read the [README](../blob/master/README.md).
- label: I have read the [README](../blob/main/README.md), including the [known-limitations](../blob/main/README.md#known-limitations) section.
required: true

- type: textarea
Expand Down
8 changes: 4 additions & 4 deletions custom_components/knmi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ async def api_wrapper(self, method: str, url: str) -> dict:
# The API has no proper error handling for a wrong API key.
# Instead a 200 with a message is returned, try to detect that here.
if "Vraag eerst een API-key op" in await response.text():
raise KnmiApiKeyException("Invalid API key")
raise KnmiApiException("Invalid API key")

if "Dagelijkse limiet" in await response.text():
raise KnmiApiKeyException("Exceeded Daily Limit")
raise KnmiApiException("Exceeded Daily Limit")

data = await response.json()
return data.get("liveweer")[0]
Expand All @@ -63,13 +63,13 @@ async def api_wrapper(self, method: str, url: str) -> dict:
url,
exception,
)
except KnmiApiKeyException as exception:
except KnmiApiException as exception:
_LOGGER.error("Error in API! - %s", exception)
# Raise to pass on to the user.
raise exception
except Exception as exception: # pylint: disable=broad-except
_LOGGER.error("Something really wrong happened! - %s", exception)


class KnmiApiKeyException(Exception):
class KnmiApiException(Exception):
pass
2 changes: 1 addition & 1 deletion custom_components/knmi/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# Base component constants.
NAME = "KNMI"
DOMAIN = "knmi"
VERSION = "1.1.5"
VERSION = "1.1.6"
ATTRIBUTION = "KNMI Weergegevens via https://weerlive.nl/"

# Platforms.
Expand Down
2 changes: 1 addition & 1 deletion custom_components/knmi/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"documentation": "https://github.com/golles/ha-knmi/",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/golles/ha-knmi//issues",
"version": "1.1.5",
"version": "1.1.6",
"config_flow": true,
"codeowners": [
"@golles"
Expand Down
4 changes: 2 additions & 2 deletions custom_components/knmi/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def forecast(self):
else None
)
temp = (
float(super().getData(f"d{i}tmin"))
if super().getData(f"d{i}tmin") is not None
float(super().getData(f"d{i}tmax"))
if super().getData(f"d{i}tmax") is not None
else None
)
precipitation = (
Expand Down

0 comments on commit 4de958b

Please sign in to comment.