]> git.basschouten.com Git - openhab-addons.git/commitdiff
Adding scheduled reconnection on timeout (#13130)
authorGaël L'hopital <gael@lhopital.org>
Sat, 16 Jul 2022 21:15:05 +0000 (23:15 +0200)
committerGitHub <noreply@github.com>
Sat, 16 Jul 2022 21:15:05 +0000 (23:15 +0200)
Signed-off-by: clinique <gael@lhopital.org>
bundles/org.openhab.binding.openuv/src/main/java/org/openhab/binding/openuv/internal/handler/OpenUVBridgeHandler.java
bundles/org.openhab.binding.openuv/src/main/resources/OH-INF/i18n/openuv.properties

index ddf5082a1e06edd301f40b785dd3ee81f89432cf..e00a5ad6a942aa4b985ae5134375f0981895a615 100644 (file)
@@ -142,7 +142,9 @@ public class OpenUVBridgeHandler extends BaseBridgeHandler {
                 logger.debug("{} : {}", statusMessage, jsonData);
             }
         } catch (IOException e) {
-            statusMessage = e.getMessage();
+            statusMessage = String.format("@text/offline.comm-error-ioexception [ \"%s\",\"%d\" ]", e.getMessage(),
+                    RECONNECT_DELAY_MIN);
+            scheduleReconnectJob(RECONNECT_DELAY_MIN);
         } catch (OpenUVException e) {
             if (e.isQuotaError()) {
                 LocalDateTime nextMidnight = LocalDate.now().plusDays(1).atStartOfDay().plusMinutes(2);
index 2f7010461c2f0c47fd02983d396baa3d5d5513f1..bb0524347aca89ae82ceaf4cdbe794af8bf0fba1 100644 (file)
@@ -67,6 +67,7 @@ offline.config-error-unknown-apikey = Parameter 'apikey' must be configured.
 offline.config-error-invalid-refresh = Parameter 'refresh' must be higher than 3 minutes to stay in free API plan.
 offline.comm-error-quota-exceeded = Quota Exceeded, going OFFLINE for today, will retry at : {0}
 offline.comm-error-faultly-service = Service not responding, will reconnect in {0} minutes
+offline.comm-error-ioexception = IOException : `{0}`, will reconnect in {1} minutes
 offline.invalid-json = Invalid JSON received when calling `{0}`
 offline.api-key-not-recognized = Service error while API key is known correct, will reconnect in {0} minutes