[qbus] - Update logo / Small code changes (#10514)
Signed-off-by: Koen Schockaert <ks@qbus.be>
This commit is contained in:
@@ -56,15 +56,15 @@ public class QbusBridgeHandler extends BaseBridgeHandler {
|
||||
*/
|
||||
@Override
|
||||
public void initialize() {
|
||||
Integer serverCheck = getServerCheck();
|
||||
|
||||
readConfig();
|
||||
|
||||
createCommunicationObject();
|
||||
Integer serverCheck = getServerCheck();
|
||||
|
||||
if (serverCheck != null) {
|
||||
this.setupRefreshTimer(serverCheck);
|
||||
}
|
||||
|
||||
createCommunicationObject();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,6 +176,7 @@ public class QbusBridgeHandler extends BaseBridgeHandler {
|
||||
}
|
||||
|
||||
refreshTimer = scheduler.scheduleWithFixedDelay(() -> {
|
||||
logger.debug("Timer started");
|
||||
QbusCommunication comm = getCommunication();
|
||||
Integer serverCheck = getServerCheck();
|
||||
|
||||
|
||||
@@ -121,12 +121,26 @@ public final class QbusCommunication extends BaseThingHandler {
|
||||
InetAddress addr = InetAddress.getByName(handler.getAddress());
|
||||
Integer port = handler.getPort();
|
||||
|
||||
if (port != null) {
|
||||
Socket socket = new Socket(addr, port);
|
||||
if (port == null) {
|
||||
handler.bridgeOffline(ThingStatusDetail.CONFIGURATION_ERROR, "Please set a correct port.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (addr == null) {
|
||||
handler.bridgeOffline(ThingStatusDetail.CONFIGURATION_ERROR, "Please set the hostname of the Qbus server.");
|
||||
return;
|
||||
}
|
||||
|
||||
Socket socket = null;
|
||||
|
||||
try {
|
||||
socket = new Socket(addr, port);
|
||||
qSocket = socket;
|
||||
qOut = new PrintWriter(socket.getOutputStream(), true);
|
||||
qIn = new BufferedReader(new InputStreamReader(socket.getInputStream()));
|
||||
} else {
|
||||
} catch (IOException e) {
|
||||
String msg = e.getMessage();
|
||||
handler.bridgeOffline(ThingStatusDetail.COMMUNICATION_ERROR, "No communication with Qbus Server. " + msg);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -338,7 +352,6 @@ public final class QbusCommunication extends BaseThingHandler {
|
||||
logger.trace("Not acted on unsupported json {} : {}", qMessage, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
QbusBridgeHandler handler = bridgeCallBack;
|
||||
|
||||
if (handler != null) {
|
||||
|
||||
Reference in New Issue
Block a user