From 58f20c5028bc791115ea9785212efa3fcb59432d Mon Sep 17 00:00:00 2001 From: mlobstein Date: Tue, 6 Jul 2021 12:46:25 -0500 Subject: [PATCH] [tivo] Fix thing staying offline after connection refresh (#10902) Signed-off-by: Michael Lobstein --- .../org/openhab/binding/tivo/internal/handler/TiVoHandler.java | 1 + .../binding/tivo/internal/service/TivoStatusProvider.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.tivo/src/main/java/org/openhab/binding/tivo/internal/handler/TiVoHandler.java b/bundles/org.openhab.binding.tivo/src/main/java/org/openhab/binding/tivo/internal/handler/TiVoHandler.java index 4546be62f..c38a8871b 100644 --- a/bundles/org.openhab.binding.tivo/src/main/java/org/openhab/binding/tivo/internal/handler/TiVoHandler.java +++ b/bundles/org.openhab.binding.tivo/src/main/java/org/openhab/binding/tivo/internal/handler/TiVoHandler.java @@ -115,6 +115,7 @@ public class TiVoHandler extends BaseThingHandler { } public void setStatusOffline() { + lastConnectionStatus = ConnectionStatus.UNKNOWN; this.updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Power on device or check network configuration/connection."); } diff --git a/bundles/org.openhab.binding.tivo/src/main/java/org/openhab/binding/tivo/internal/service/TivoStatusProvider.java b/bundles/org.openhab.binding.tivo/src/main/java/org/openhab/binding/tivo/internal/service/TivoStatusProvider.java index b83164933..ae3e70cf7 100644 --- a/bundles/org.openhab.binding.tivo/src/main/java/org/openhab/binding/tivo/internal/service/TivoStatusProvider.java +++ b/bundles/org.openhab.binding.tivo/src/main/java/org/openhab/binding/tivo/internal/service/TivoStatusProvider.java @@ -20,6 +20,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.net.Socket; +import java.net.SocketException; import java.net.SocketTimeoutException; import java.net.UnknownHostException; import java.util.concurrent.TimeUnit; @@ -441,7 +442,7 @@ public class TivoStatusProvider { try { receivedData = reader.readLine(); - } catch (SocketTimeoutException e) { + } catch (SocketTimeoutException | SocketException e) { // Do nothing. Just allow the thread to check if it has to stop. }