diff --git a/custom_components/swissweather/meteo.py b/custom_components/swissweather/meteo.py index 156f7ff..946aa43 100644 --- a/custom_components/swissweather/meteo.py +++ b/custom_components/swissweather/meteo.py @@ -11,7 +11,7 @@ CURRENT_CONDITION_URL= 'https://data.geo.admin.ch/ch.meteoschweiz.messwerte-aktuell/VQHA80.csv' -FORECAST_URL= "https://app-prod-ws.meteoswiss-app.ch/v1/plzDetail?plz={}00" +FORECAST_URL= "https://app-prod-ws.meteoswiss-app.ch/v1/plzDetail?plz={:<06d}" FORECAST_USER_AGENT = "android-31 ch.admin.meteoswiss-2160000" CONDITION_CLASSES = { @@ -270,8 +270,8 @@ def _get_csv_dictionary_for_url(self, url, encoding='utf-8'): def _get_forecast_json(self, postCode, language): try: - url = FORECAST_URL.format(postCode) - logger.debug("Requesting forecast data...") + url = FORECAST_URL.format(int(postCode)) + logger.debug("Requesting forecast data from %s...", url) return requests.get(url, headers = { "User-Agent": FORECAST_USER_AGENT, "Accept-Language": language,