]> git.basschouten.com Git - openhab-addons.git/commitdiff
[openweathermap]: Fix NPE on OneCall-API (#125740) and reduce min refreshInterval...
authorOliver Raible <38162008+ehora@users.noreply.github.com>
Mon, 20 Sep 2021 05:48:19 +0000 (07:48 +0200)
committerGitHub <noreply@github.com>
Mon, 20 Sep 2021 05:48:19 +0000 (07:48 +0200)
* fix NullPointerException at OneCall-API
* reduce min refreshInterval from 10 to 1 min to support paid plans

Signed-off-by: ehora <oliver.raible@yapoware.com>
bundles/org.openhab.binding.openweathermap/README.md
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/handler/OpenWeatherMapAPIHandler.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/handler/OpenWeatherMapOneCallHandler.java
bundles/org.openhab.binding.openweathermap/src/main/resources/OH-INF/config/config.xml
bundles/org.openhab.binding.openweathermap/src/main/resources/OH-INF/i18n/openweathermap_de.properties
bundles/org.openhab.binding.openweathermap/src/main/resources/OH-INF/i18n/openweathermap_fr.properties

index a043f07e9ff929f9fccb102644e7451914670149..7960595e6deeef95852407a5ea63c5ce463b1572 100644 (file)
@@ -70,7 +70,7 @@ Once the system location will be changed, the background discovery updates the c
 | Parameter       | Description                                                                                                                                                                                                                                                                       |
 |-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
 | apikey          | API key to access the OpenWeatherMap API. **Mandatory**                                                                                                                                                                                                                           |
-| refreshInterval | Specifies the refresh interval (in minutes). Optional, the default value is 60, the minimum value is 10.                                                                                                                                                                          |
+| refreshInterval | Specifies the refresh interval (in minutes). Optional, the default value is 60, the minimum value is 1.                                                                                                                                                                          |
 | language        | Language to be used by the OpenWeatherMap API. Optional, valid values are: `ar`, `bg`, `ca`, `de`, `el`, `en`, `es`, `fa`, `fi`, `fr`, `gl`, `hr`, `hu`, `it`, `ja`, `kr`, `la`, `lt`, `mk`,  `nl`, `pl`, `pt`, `ro`, `ru`, `se`, `sk`, `sl`, `tr`, `ua`, `vi`, `zh_cn`, `zh_tw`. |
 
 ### Current Weather And Forecast
index 654d940cfd0d6566a4eed2bd311eaab4c5854717..644065d1473fc268b3cb26ce52ccbb3e85c4e7be 100644 (file)
@@ -80,7 +80,7 @@ public class OpenWeatherMapAPIHandler extends BaseBridgeHandler {
             configValid = false;
         }
         int refreshInterval = config.refreshInterval;
-        if (refreshInterval < 10) {
+        if (refreshInterval < 1) {
             updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
                     "@text/offline.conf-error-not-supported-refreshInterval");
             configValid = false;
index 9cd2d030847d5603a600411010aca9c401ed620a..60a4082e3b039fe4203afea45ed926b10edfdf26 100644 (file)
@@ -382,7 +382,8 @@ public class OpenWeatherMapOneCallHandler extends AbstractOpenWeatherMapHandler
                     channelGroupId);
             return;
         }
-        if (localWeatherData != null && localWeatherData.getMinutely().size() > count) {
+        if (localWeatherData != null && localWeatherData.getMinutely() != null
+                && localWeatherData.getMinutely().size() > count) {
             org.openhab.binding.openweathermap.internal.dto.onecall.Minutely forecastData = localWeatherData
                     .getMinutely().get(count);
             State state = UnDefType.UNDEF;
index ff6d7024c843331271f9944c726e92145941de37..116c1666000f46009c5c90df4cf9640852bf79a4 100644 (file)
@@ -11,7 +11,7 @@
                        <label>API Key</label>
                        <description>API key to access the OpenWeatherMap API.</description>
                </parameter>
-               <parameter name="refreshInterval" type="integer" min="10" unit="min">
+               <parameter name="refreshInterval" type="integer" min="1" unit="min">
                        <label>Refresh Interval</label>
                        <description>Specifies the refresh interval (in minutes).</description>
                        <default>60</default>
index 551dcbbb20c27081565625a714eb648c2719449d..78b315aa30593911f8752591de968a04da9ffd58 100644 (file)
@@ -408,7 +408,7 @@ channel-type.openweathermap.alert-source.description = Zeigt die Quelle der Wett
 # thing status
 offline.conf-error-missing-apikey = Der Parameter 'API Schlüssel' muss konfiguriert werden.
 offline.conf-error-invalid-apikey = Ungültiger 'API Schlüssel'. Mehr Infos unter https://openweathermap.org/faq#error401.
-offline.conf-error-not-supported-refreshInterval = Der Parameter 'Abfrageintervall' muss mindestens 10 min betragen.
+offline.conf-error-not-supported-refreshInterval = Der Parameter 'Abfrageintervall' muss mindestens 1 min betragen.
 offline.conf-error-not-supported-language = Der angegebene Parameter 'Sprache' wird nicht unterstützt.
 
 offline.conf-error-missing-location = Der Parameter 'Ort' muss konfiguriert werden.
index ac5ae4579a222b38508b43b64d21ac5b9e75aa67..1ebe61246a8d5e6d1299dea0b70f65524228645d 100644 (file)
@@ -243,7 +243,7 @@ channel-type.openweathermap.forecasted-uvindex.description = L'indice UV prévu.
 # thing status
 offline.conf-error-missing-apikey = Le paramètre 'apikey' doit être configuré.
 offline.conf-error-invalid-apikey = Clé API invalide. Veuillez consulter https://openweathermap.org/faq#error401 pour plus d''informations.
-offline.conf-error-not-supported-refreshInterval = Le paramètre 'refreshInterval' doit être au moins de 10 minutes.
+offline.conf-error-not-supported-refreshInterval = Le paramètre 'refreshInterval' doit être au moins de 1 minute.
 offline.conf-error-not-supported-language = Le paramètre 'language' choisi n''est pas supporté.
 
 offline.conf-error-missing-location = Le paramètre 'location' doit être configuré.