diff --git a/bundles/org.openhab.binding.orbitbhyve/src/main/java/org/openhab/binding/orbitbhyve/internal/handler/OrbitBhyveBridgeHandler.java b/bundles/org.openhab.binding.orbitbhyve/src/main/java/org/openhab/binding/orbitbhyve/internal/handler/OrbitBhyveBridgeHandler.java index 95e7e44c7..42cd4c8b8 100644 --- a/bundles/org.openhab.binding.orbitbhyve/src/main/java/org/openhab/binding/orbitbhyve/internal/handler/OrbitBhyveBridgeHandler.java +++ b/bundles/org.openhab.binding.orbitbhyve/src/main/java/org/openhab/binding/orbitbhyve/internal/handler/OrbitBhyveBridgeHandler.java @@ -37,6 +37,7 @@ import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.client.util.StringContentProvider; import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.websocket.api.Session; +import org.eclipse.jetty.websocket.api.WebSocketException; import org.eclipse.jetty.websocket.client.WebSocketClient; import org.openhab.binding.orbitbhyve.internal.OrbitBhyveConfiguration; import org.openhab.binding.orbitbhyve.internal.discovery.OrbitBhyveDiscoveryService; @@ -183,7 +184,10 @@ public class OrbitBhyveBridgeHandler extends ConfigStatusBridgeHandler { updateAllStatuses(); } catch (IOException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, - "Error sending ping to a web socket"); + "Error sending ping (IOException on web socket)"); + } catch (WebSocketException e) { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + String.format("Error sending ping (WebSocketException: %s)", e.getMessage())); } } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Web socket creation error"); @@ -426,7 +430,10 @@ public class OrbitBhyveBridgeHandler extends ConfigStatusBridgeHandler { localSession.getRemote().sendString(msg); } catch (IOException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, - "Cannot send hello string to web socket!"); + "Error sending hello string (IOException on web socket)"); + } catch (WebSocketException e) { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + String.format("Error sending hello string (WebSocketException: %s)", e.getMessage())); } } } @@ -466,7 +473,10 @@ public class OrbitBhyveBridgeHandler extends ConfigStatusBridgeHandler { } } catch (IOException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, - "Error during program watering execution"); + "Error sending program watering execution (IOException on web socket)"); + } catch (WebSocketException e) { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + String.format("Error sending program watering execution (WebSocketException: %s)", e.getMessage())); } } @@ -505,7 +515,11 @@ public class OrbitBhyveBridgeHandler extends ConfigStatusBridgeHandler { + "\",\"delay\":" + delay + ",\"timestamp\":\"" + dateTime + "\"}"); } } catch (IOException e) { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Error during rain delay setting"); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + "Error setting rain delay (IOException on web socket)"); + } catch (WebSocketException e) { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + String.format("Error setting rain delay (WebSocketException: %s)", e.getMessage())); } } @@ -519,7 +533,11 @@ public class OrbitBhyveBridgeHandler extends ConfigStatusBridgeHandler { + "\",\"timestamp\":\"" + dateTime + "\",\"mode\":\"manual\",\"stations\":[]}"); } } catch (IOException e) { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Error during watering stopping"); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + "Error sending stop watering (IOException on web socket)"); + } catch (WebSocketException e) { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + String.format("Error sending stop watering (WebSocketException: %s)", e.getMessage())); } } @@ -555,7 +573,11 @@ public class OrbitBhyveBridgeHandler extends ConfigStatusBridgeHandler { + "\",\"device_id\":\"" + deviceId + "\",\"timestamp\":\"" + dateTime + "\"}"); } } catch (IOException e) { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Error during setting run mode"); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + "Error setting run mode (IOException on web socket)"); + } catch (WebSocketException e) { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + String.format("Error setting run mode (WebSocketException: %s)", e.getMessage())); } }