diff --git a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/AirCareCapability.java b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/AirCareCapability.java index 351fbf951be5f..c2e1545b09237 100644 --- a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/AirCareCapability.java +++ b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/AirCareCapability.java @@ -41,7 +41,7 @@ protected List updateReadings(AircareApi api) { try { return List.of(api.getHomeCoach(handler.getId())); } catch (NetatmoException e) { - logger.warn("Error retrieving home-coach data '{}' : {}", handler.getId(), e.getMessage()); + logger.warn("Error retrieving home-coach data '{}': {}", handler.getId(), e.getMessage()); } return List.of(); } diff --git a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/CacheWeatherCapability.java b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/CacheWeatherCapability.java index 05593888b9f6a..c472029a1f082 100644 --- a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/CacheWeatherCapability.java +++ b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/CacheWeatherCapability.java @@ -43,13 +43,16 @@ public CacheWeatherCapability(CommonInterface handler, Duration validity) { } @Override - protected List updateReadings(WeatherApi api) { + protected synchronized List updateReadings(WeatherApi api) { Instant now = Instant.now(); if (requestTS.plus(validity).isBefore(now)) { - logger.debug("Requesting fresh data"); - lastResult = getFreshData(api); - requestTS = now; + logger.debug("{} requesting fresh data for {}", getClass().getSimpleName(), thingUID); + List result = getFreshData(api); + if (!result.isEmpty()) { + lastResult = result; + requestTS = now; + } } return lastResult; diff --git a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/WeatherCapability.java b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/WeatherCapability.java index b86c820e67ee8..7faec8efef24a 100644 --- a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/WeatherCapability.java +++ b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/WeatherCapability.java @@ -42,7 +42,7 @@ protected List getFreshData(WeatherApi api) { try { return List.of(owned ? api.getOwnedStationData(handler.getId()) : api.getStationData(handler.getId())); } catch (NetatmoException e) { - logger.warn("Error retrieving weather data '{}' : {}", handler.getId(), e.getMessage()); + logger.warn("Error retrieving weather data '{}': {}", handler.getId(), e.getMessage()); } return List.of(); }