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;
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");
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()));
}
}
}
}
} 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()));
}
}
+ "\",\"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()));
}
}
+ "\",\"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()));
}
}
+ "\",\"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()));
}
}