Skip to content

Commit

Permalink
Handling CHANGE message
Browse files Browse the repository at this point in the history
Signed-off-by: clinique <gael@lhopital.org>
  • Loading branch information
clinique committed Jun 21, 2022
1 parent 2516d6c commit 7cd41a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.mynice.internal.xml;
package org.openhab.binding.mynice.internal.handler;

import java.io.IOException;
import java.io.InputStreamReader;
Expand All @@ -29,7 +29,6 @@
import javax.net.ssl.TrustManager;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.mynice.internal.handler.It4WifiHandler;
import org.openhab.binding.mynice.internal.xml.dto.CommandType;
import org.openhab.core.io.net.http.TrustAllTrustManager;
import org.slf4j.Logger;
Expand Down Expand Up @@ -59,7 +58,7 @@ public class It4WifiConnector extends Thread {
private Optional<ScheduledFuture<?>> keepAlive = Optional.empty();

public It4WifiConnector(String hostname, It4WifiHandler handler, ScheduledExecutorService scheduler) {
super();
super(It4WifiConnector.class.getName());
this.hostname = hostname;
this.handler = handler;
this.scheduler = scheduler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.mynice.internal.config.It4WifiConfiguration;
import org.openhab.binding.mynice.internal.discovery.MyNiceDiscoveryService;
import org.openhab.binding.mynice.internal.xml.It4WifiConnector;
import org.openhab.binding.mynice.internal.xml.MyNiceXStream;
import org.openhab.binding.mynice.internal.xml.RequestBuilder;
import org.openhab.binding.mynice.internal.xml.dto.CommandType;
Expand Down Expand Up @@ -91,7 +90,7 @@ public void initialize() {
connector = new It4WifiConnector(config.hostname, this, scheduler);
connected = false;
if (config.username.isBlank()) {
updateStatus(ThingStatus.ONLINE, ThingStatusDetail.CONFIGURATION_PENDING,
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING,
"Please define a username for this thing");
} else {
reqBuilder = new RequestBuilder(config.macAddress, config.username);
Expand Down Expand Up @@ -132,7 +131,7 @@ private void handleResponse(Response response) {
sendCommand(CommandType.CONNECT);
return;
case wait:
updateStatus(ThingStatus.ONLINE, ThingStatusDetail.CONFIGURATION_PENDING,
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING,
"Please validate the user on the MyNice application");
scheduler.schedule(() -> handShaked(), 15, TimeUnit.SECONDS);
return;
Expand Down Expand Up @@ -161,6 +160,9 @@ private void handleResponse(Response response) {
case STATUS:
notifyListeners(response.getDevices());
break;
case CHANGE:
logger.debug("Change command accepted");
break;
default:
logger.info("Unhandled response type : {}", response.type);
}
Expand Down

0 comments on commit 7cd41a7

Please sign in to comment.