[openweathermap]: Fix NPE on OneCall-API (#125740) and reduce min refreshInterval to support paid plans (#11255)

* 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>
This commit is contained in:
Oliver Raible 2021-09-20 07:48:19 +02:00 committed by GitHub
parent 8e94d8d8b9
commit 02fffccdad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 6 deletions

View 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

View 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;

View 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;

View 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>

View 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.

View 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é.