]> git.basschouten.com Git - openhab-addons.git/commitdiff
[wemo] Fix stability issues (#14163)
authorJacob Laursen <jacob-github@vindvejr.dk>
Sat, 28 Jan 2023 08:35:30 +0000 (09:35 +0100)
committerGitHub <noreply@github.com>
Sat, 28 Jan 2023 08:35:30 +0000 (09:35 +0100)
* Stabilize UPnP subscription handling
* Remove unused UpnpService
* Fix integration test

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
15 files changed:
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/WemoBindingConstants.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/WemoHandlerFactory.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoBaseThingHandler.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoCoffeeHandler.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoCrockpotHandler.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoDimmerHandler.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoHandler.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoHolmesHandler.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoInsightHandler.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoLightHandler.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoMakerHandler.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoMotionHandler.java
bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoSwitchHandler.java
itests/org.openhab.binding.wemo.tests/src/main/java/org/openhab/binding/wemo/internal/handler/test/WemoHandlerOSGiTest.java
itests/org.openhab.binding.wemo.tests/src/main/java/org/openhab/binding/wemo/internal/handler/test/WemoInsightHandlerTest.java

index 3bf83437ff3595277e392d603bdb2f36e8412e46..241ab2c81081c300914ecb53b91c3d23426f2ff5 100644 (file)
@@ -110,7 +110,7 @@ public class WemoBindingConstants {
     public static final String DEVICE_ID = "deviceID";
     public static final String POLLING_INTERVAL = "pollingInterval";
     public static final int DEFAULT_REFRESH_INTERVAL_SECONDS = 60;
-    public static final int SUBSCRIPTION_DURATION_SECONDS = 600;
+    public static final int SUBSCRIPTION_DURATION_SECONDS = 1800;
     public static final int LINK_DISCOVERY_SERVICE_INITIAL_DELAY = 5;
     public static final String HTTP_CALL_CONTENT_HEADER = "text/xml; charset=utf-8";
 
index 69b9254426bcdd4038b48198b5663fee585292a7..034930fe4cd1b0c8ea7f1fc46c1c3295b87c4b7e 100644 (file)
@@ -21,7 +21,6 @@ import java.util.Set;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
 import org.openhab.binding.wemo.internal.discovery.WemoLinkDiscoveryService;
 import org.openhab.binding.wemo.internal.handler.WemoBridgeHandler;
 import org.openhab.binding.wemo.internal.handler.WemoCoffeeHandler;
@@ -68,7 +67,6 @@ public class WemoHandlerFactory extends BaseThingHandlerFactory {
     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = WemoBindingConstants.SUPPORTED_THING_TYPES;
 
     private final UpnpIOService upnpIOService;
-    private final UpnpService upnpService;
     private @Nullable WemoHttpCallFactory wemoHttpCallFactory;
 
     @Override
@@ -79,9 +77,8 @@ public class WemoHandlerFactory extends BaseThingHandlerFactory {
     private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
 
     @Activate
-    public WemoHandlerFactory(final @Reference UpnpIOService upnpIOService, @Reference UpnpService upnpService) {
+    public WemoHandlerFactory(final @Reference UpnpIOService upnpIOService) {
         this.upnpIOService = upnpIOService;
-        this.upnpService = upnpService;
     }
 
     @Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
@@ -111,46 +108,46 @@ public class WemoHandlerFactory extends BaseThingHandlerFactory {
         } else if (WemoBindingConstants.THING_TYPE_INSIGHT.equals(thing.getThingTypeUID())) {
             logger.debug("Creating a WemoInsightHandler for thing '{}' with UDN '{}'", thing.getUID(),
                     thing.getConfiguration().get(UDN));
-            return new WemoInsightHandler(thing, upnpIOService, upnpService, wemoHttpcaller);
+            return new WemoInsightHandler(thing, upnpIOService, wemoHttpcaller);
         } else if (WemoBindingConstants.THING_TYPE_SOCKET.equals(thing.getThingTypeUID())
                 || WemoBindingConstants.THING_TYPE_LIGHTSWITCH.equals(thing.getThingTypeUID())) {
             logger.debug("Creating a WemoSwitchHandler for thing '{}' with UDN '{}'", thing.getUID(),
                     thing.getConfiguration().get(UDN));
-            return new WemoSwitchHandler(thing, upnpIOService, upnpService, wemoHttpcaller);
+            return new WemoSwitchHandler(thing, upnpIOService, wemoHttpcaller);
         } else if (WemoBindingConstants.THING_TYPE_MOTION.equals(thing.getThingTypeUID())) {
             logger.debug("Creating a WemoMotionHandler for thing '{}' with UDN '{}'", thing.getUID(),
                     thing.getConfiguration().get(UDN));
-            return new WemoMotionHandler(thing, upnpIOService, upnpService, wemoHttpcaller);
+            return new WemoMotionHandler(thing, upnpIOService, wemoHttpcaller);
         } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_MAKER)) {
             logger.debug("Creating a WemoMakerHandler for thing '{}' with UDN '{}'", thing.getUID(),
                     thing.getConfiguration().get(UDN));
-            return new WemoMakerHandler(thing, upnpIOService, upnpService, wemoHttpcaller);
+            return new WemoMakerHandler(thing, upnpIOService, wemoHttpcaller);
         } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_COFFEE)) {
             logger.debug("Creating a WemoCoffeeHandler for thing '{}' with UDN '{}'", thing.getUID(),
                     thing.getConfiguration().get(UDN));
-            return new WemoCoffeeHandler(thing, upnpIOService, upnpService, wemoHttpcaller);
+            return new WemoCoffeeHandler(thing, upnpIOService, wemoHttpcaller);
         } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_DIMMER)) {
             logger.debug("Creating a WemoDimmerHandler for thing '{}' with UDN '{}'", thing.getUID(),
                     thing.getConfiguration().get("udn"));
-            return new WemoDimmerHandler(thing, upnpIOService, upnpService, wemoHttpcaller);
+            return new WemoDimmerHandler(thing, upnpIOService, wemoHttpcaller);
         } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_CROCKPOT)) {
             logger.debug("Creating a WemoCockpotHandler for thing '{}' with UDN '{}'", thing.getUID(),
                     thing.getConfiguration().get("udn"));
-            return new WemoCrockpotHandler(thing, upnpIOService, upnpService, wemoHttpcaller);
+            return new WemoCrockpotHandler(thing, upnpIOService, wemoHttpcaller);
         } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_PURIFIER)) {
             logger.debug("Creating a WemoHolmesHandler for thing '{}' with UDN '{}'", thing.getUID(),
                     thing.getConfiguration().get("udn"));
-            return new WemoHolmesHandler(thing, upnpIOService, upnpService, wemoHttpcaller);
+            return new WemoHolmesHandler(thing, upnpIOService, wemoHttpcaller);
         } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_HUMIDIFIER)) {
             logger.debug("Creating a WemoHolmesHandler for thing '{}' with UDN '{}'", thing.getUID(),
                     thing.getConfiguration().get("udn"));
-            return new WemoHolmesHandler(thing, upnpIOService, upnpService, wemoHttpcaller);
+            return new WemoHolmesHandler(thing, upnpIOService, wemoHttpcaller);
         } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_HEATER)) {
             logger.debug("Creating a WemoHolmesHandler for thing '{}' with UDN '{}'", thing.getUID(),
                     thing.getConfiguration().get("udn"));
-            return new WemoHolmesHandler(thing, upnpIOService, upnpService, wemoHttpcaller);
+            return new WemoHolmesHandler(thing, upnpIOService, wemoHttpcaller);
         } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_MZ100)) {
-            return new WemoLightHandler(thing, upnpIOService, upnpService, wemoHttpcaller);
+            return new WemoLightHandler(thing, upnpIOService, wemoHttpcaller);
         } else {
             logger.warn("ThingHandler not found for {}", thingTypeUID);
             return null;
index b57f5715a95c6b57125fab584aaa9f895b8c2697..ba757452b2656c78ba2dbd3e3479dd45e24f275a 100644 (file)
@@ -19,16 +19,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 import java.util.stream.Stream;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
-import org.jupnp.model.message.header.RootDeviceHeader;
 import org.openhab.binding.wemo.internal.WemoBindingConstants;
 import org.openhab.binding.wemo.internal.http.WemoHttpCall;
 import org.openhab.core.io.transport.upnp.UpnpIOParticipant;
@@ -51,26 +47,21 @@ import org.slf4j.LoggerFactory;
 @NonNullByDefault
 public abstract class WemoBaseThingHandler extends BaseThingHandler implements UpnpIOParticipant {
 
-    private static final int SUBSCRIPTION_RENEWAL_INITIAL_DELAY_SECONDS = 15;
-    private static final int SUBSCRIPTION_RENEWAL_INTERVAL_SECONDS = 60;
     private static final int PORT_RANGE_START = 49151;
     private static final int PORT_RANGE_END = 49157;
 
     private final Logger logger = LoggerFactory.getLogger(WemoBaseThingHandler.class);
     private final UpnpIOService service;
-    private final UpnpService upnpService;
+    private final Object upnpLock = new Object();
 
     protected WemoHttpCall wemoHttpCaller;
 
     private @Nullable String host;
     private Map<String, Instant> subscriptions = new ConcurrentHashMap<String, Instant>();
-    private @Nullable ScheduledFuture<?> subscriptionRenewalJob;
 
-    public WemoBaseThingHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService,
-            WemoHttpCall wemoHttpCaller) {
+    public WemoBaseThingHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
         super(thing);
         this.service = upnpIOService;
-        this.upnpService = upnpService;
         this.wemoHttpCaller = wemoHttpCaller;
     }
 
@@ -83,7 +74,6 @@ public abstract class WemoBaseThingHandler extends BaseThingHandler implements U
 
     @Override
     public void dispose() {
-        cancelSubscriptionRenewalJob();
         removeSubscriptions();
         logger.debug("Unregistering UPnP participant for {}", getThing().getUID());
         service.unregisterParticipant(this);
@@ -98,16 +88,14 @@ public abstract class WemoBaseThingHandler extends BaseThingHandler implements U
     public void onStatusChanged(boolean status) {
         if (status) {
             logger.debug("UPnP device {} for {} is present", getUDN(), getThing().getUID());
-            if (service.isRegistered(this)) {
-                // After successful discovery, try to subscribe again.
-                renewSubscriptions();
-            }
         } else {
             logger.info("UPnP device {} for {} is absent", getUDN(), getThing().getUID());
             updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR);
             // Expire subscriptions.
-            for (Entry<String, Instant> subscription : subscriptions.entrySet()) {
-                subscription.setValue(Instant.MIN);
+            synchronized (upnpLock) {
+                for (Entry<String, Instant> subscription : subscriptions.entrySet()) {
+                    subscription.setValue(Instant.MIN);
+                }
             }
         }
     }
@@ -124,7 +112,9 @@ public abstract class WemoBaseThingHandler extends BaseThingHandler implements U
         }
         logger.debug("Subscription to service {} for {} {}", service, getUDN(), succeeded ? "succeeded" : "failed");
         if (succeeded) {
-            subscriptions.put(service, Instant.now());
+            synchronized (upnpLock) {
+                subscriptions.put(service, Instant.now());
+            }
         }
     }
 
@@ -138,67 +128,28 @@ public abstract class WemoBaseThingHandler extends BaseThingHandler implements U
     }
 
     protected void addSubscription(String serviceId) {
-        if (subscriptions.containsKey(serviceId)) {
-            logger.debug("{} already subscribed to {}", getUDN(), serviceId);
-            return;
-        }
-        if (subscriptions.isEmpty()) {
-            logger.debug("Adding first GENA subscription for {}, scheduling renewal job", getUDN());
-            scheduleSubscriptionRenewalJob();
+        synchronized (upnpLock) {
+            if (subscriptions.containsKey(serviceId)) {
+                logger.debug("{} already subscribed to {}", getUDN(), serviceId);
+                return;
+            }
+            subscriptions.put(serviceId, Instant.MIN);
+            logger.debug("Adding GENA subscription {} for {}, participant is {}", serviceId, getUDN(),
+                    service.isRegistered(this) ? "registered" : "not registered");
         }
-        subscriptions.put(serviceId, Instant.MIN);
-        logger.debug("Adding GENA subscription {} for {}, participant is {}", serviceId, getUDN(),
-                service.isRegistered(this) ? "registered" : "not registered");
         service.addSubscription(this, serviceId, WemoBindingConstants.SUBSCRIPTION_DURATION_SECONDS);
     }
 
-    private void scheduleSubscriptionRenewalJob() {
-        cancelSubscriptionRenewalJob();
-        this.subscriptionRenewalJob = scheduler.scheduleWithFixedDelay(this::renewSubscriptions,
-                SUBSCRIPTION_RENEWAL_INITIAL_DELAY_SECONDS, SUBSCRIPTION_RENEWAL_INTERVAL_SECONDS, TimeUnit.SECONDS);
-    }
-
-    private void cancelSubscriptionRenewalJob() {
-        ScheduledFuture<?> subscriptionRenewalJob = this.subscriptionRenewalJob;
-        if (subscriptionRenewalJob != null) {
-            subscriptionRenewalJob.cancel(true);
-        }
-        this.subscriptionRenewalJob = null;
-    }
-
-    private synchronized void renewSubscriptions() {
-        if (subscriptions.isEmpty()) {
-            return;
-        }
-        if (!service.isRegistered(this)) {
-            logger.debug("Participant not registered when renewing GENA subscriptions for {}, starting UPnP discovery",
-                    getUDN());
-            upnpService.getControlPoint().search(new RootDeviceHeader());
-            return;
-        }
-        logger.debug("Renewing GENA subscriptions for {}", getUDN());
-        subscriptions.forEach((serviceId, lastRenewed) -> {
-            if (lastRenewed.isBefore(Instant.now().minusSeconds(
-                    WemoBindingConstants.SUBSCRIPTION_DURATION_SECONDS - SUBSCRIPTION_RENEWAL_INTERVAL_SECONDS))) {
-                logger.debug("Subscription for service {} with timestamp {} has expired, renewing", serviceId,
-                        lastRenewed);
-                service.removeSubscription(this, serviceId);
-                service.addSubscription(this, serviceId, WemoBindingConstants.SUBSCRIPTION_DURATION_SECONDS);
-            }
-        });
-    }
-
     private void removeSubscriptions() {
-        if (subscriptions.isEmpty()) {
-            return;
-        }
         logger.debug("Removing GENA subscriptions for {}, participant is {}", getUDN(),
                 service.isRegistered(this) ? "registered" : "not registered");
-        subscriptions.forEach((serviceId, lastRenewed) -> {
-            logger.debug("Removing subscription for service {}", serviceId);
-            service.removeSubscription(this, serviceId);
-        });
-        subscriptions.clear();
+        synchronized (upnpLock) {
+            subscriptions.forEach((serviceId, lastRenewed) -> {
+                logger.debug("Removing subscription for service {}", serviceId);
+                service.removeSubscription(this, serviceId);
+            });
+            subscriptions.clear();
+        }
     }
 
     public @Nullable String getWemoURL(String actionService) {
index 0f0ac64ea5a69f744aeed512edebe734f8c4cf65..e531e3fa82aa5cf320d1d72ecf602ca4ce2ad39f 100644 (file)
@@ -29,7 +29,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
 import org.openhab.binding.wemo.internal.http.WemoHttpCall;
 import org.openhab.core.config.core.Configuration;
 import org.openhab.core.io.transport.upnp.UpnpIOService;
@@ -70,9 +69,8 @@ public class WemoCoffeeHandler extends WemoBaseThingHandler {
 
     private @Nullable ScheduledFuture<?> pollingJob;
 
-    public WemoCoffeeHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService,
-            WemoHttpCall wemoHttpCaller) {
-        super(thing, upnpIOService, upnpService, wemoHttpCaller);
+    public WemoCoffeeHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
+        super(thing, upnpIOService, wemoHttpCaller);
 
         logger.debug("Creating a WemoCoffeeHandler for thing '{}'", getThing().getUID());
     }
index 33d81376222afd5108d7b74b75f704418d8fbf63..43b4627327777371e8da3cc497dab0fa52ba2a53 100644 (file)
@@ -25,7 +25,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
 import org.openhab.binding.wemo.internal.http.WemoHttpCall;
 import org.openhab.core.config.core.Configuration;
 import org.openhab.core.io.transport.upnp.UpnpIOService;
@@ -61,9 +60,8 @@ public class WemoCrockpotHandler extends WemoBaseThingHandler {
 
     private @Nullable ScheduledFuture<?> pollingJob;
 
-    public WemoCrockpotHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService,
-            WemoHttpCall wemoHttpCaller) {
-        super(thing, upnpIOService, upnpService, wemoHttpCaller);
+    public WemoCrockpotHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
+        super(thing, upnpIOService, wemoHttpCaller);
 
         logger.debug("Creating a WemoCrockpotHandler for thing '{}'", getThing().getUID());
     }
index 2fcc33660505e16f61e9ca4d3fe4bff45b9ca408..03be05685a88cea4ec6ffdc3299e03a58a93871a 100644 (file)
@@ -27,7 +27,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
 import org.openhab.binding.wemo.internal.http.WemoHttpCall;
 import org.openhab.core.config.core.Configuration;
 import org.openhab.core.io.transport.upnp.UpnpIOService;
@@ -74,9 +73,8 @@ public class WemoDimmerHandler extends WemoBaseThingHandler {
      */
     private static final int DIM_STEPSIZE = 5;
 
-    public WemoDimmerHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService,
-            WemoHttpCall wemoHttpCaller) {
-        super(thing, upnpIOService, upnpService, wemoHttpCaller);
+    public WemoDimmerHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
+        super(thing, upnpIOService, wemoHttpCaller);
 
         logger.debug("Creating a WemoDimmerHandler for thing '{}'", getThing().getUID());
     }
index 5804401e1a16f0ef7d48d74b13746ffa5eb0ce5a..4aa9eb7c7612ec2d51b65e9a8a264866f048dcf3 100644 (file)
@@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
 import org.openhab.binding.wemo.internal.http.WemoHttpCall;
 import org.openhab.core.io.transport.upnp.UpnpIOService;
 import org.openhab.core.library.types.OnOffType;
@@ -53,8 +52,8 @@ public abstract class WemoHandler extends WemoBaseThingHandler {
 
     private @Nullable ScheduledFuture<?> pollingJob;
 
-    public WemoHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, WemoHttpCall wemoHttpCaller) {
-        super(thing, upnpIOService, upnpService, wemoHttpCaller);
+    public WemoHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
+        super(thing, upnpIOService, wemoHttpCaller);
 
         logger.debug("Creating a WemoHandler for thing '{}'", getThing().getUID());
     }
index 5ac2ac052c1e28b930e915dd6ecf878388aafba9..19b39af43bf9ff001472501142dc74e3c801ff3e 100644 (file)
@@ -30,7 +30,6 @@ import javax.xml.parsers.ParserConfigurationException;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
 import org.openhab.binding.wemo.internal.http.WemoHttpCall;
 import org.openhab.core.config.core.Configuration;
 import org.openhab.core.io.transport.upnp.UpnpIOService;
@@ -75,9 +74,8 @@ public class WemoHolmesHandler extends WemoBaseThingHandler {
 
     private @Nullable ScheduledFuture<?> pollingJob;
 
-    public WemoHolmesHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService,
-            WemoHttpCall wemoHttpCaller) {
-        super(thing, upnpIOService, upnpService, wemoHttpCaller);
+    public WemoHolmesHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
+        super(thing, upnpIOService, wemoHttpCaller);
 
         logger.debug("Creating a WemoHolmesHandler for thing '{}'", getThing().getUID());
     }
index 28d64e10cf4cbc3792cb00832ca97d4bfce25beb..bd4713a35779da41a182144d099bc411a3fa940a 100644 (file)
@@ -20,7 +20,6 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
 import org.openhab.binding.wemo.internal.InsightParser;
 import org.openhab.binding.wemo.internal.WemoBindingConstants;
 import org.openhab.binding.wemo.internal.WemoPowerBank;
@@ -52,9 +51,8 @@ public class WemoInsightHandler extends WemoHandler {
     private int currentPowerSlidingSeconds;
     private int currentPowerDeltaTrigger;
 
-    public WemoInsightHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService,
-            WemoHttpCall wemoHttpCaller) {
-        super(thing, upnpIOService, upnpService, wemoHttpCaller);
+    public WemoInsightHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
+        super(thing, upnpIOService, wemoHttpCaller);
     }
 
     @Override
index 71926ae0cebfdb1574202ec05e0fd64ffef391b0..64305d3d22426dbd316300de3b5e423ee2274d39 100644 (file)
@@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
 import org.openhab.binding.wemo.internal.http.WemoHttpCall;
 import org.openhab.core.config.core.Configuration;
 import org.openhab.core.io.transport.upnp.UpnpIOService;
@@ -71,9 +70,8 @@ public class WemoLightHandler extends WemoBaseThingHandler {
 
     private @Nullable ScheduledFuture<?> pollingJob;
 
-    public WemoLightHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService,
-            WemoHttpCall wemoHttpcaller) {
-        super(thing, upnpIOService, upnpService, wemoHttpcaller);
+    public WemoLightHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpcaller) {
+        super(thing, upnpIOService, wemoHttpcaller);
 
         logger.debug("Creating a WemoLightHandler for thing '{}'", getThing().getUID());
     }
index d355e7b486293d1c11300b2d52d9bf67c2e4c072..a2e620e827173bd37d36578562f3450cc4db5fc5 100644 (file)
@@ -26,7 +26,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
 import org.openhab.binding.wemo.internal.http.WemoHttpCall;
 import org.openhab.core.config.core.Configuration;
 import org.openhab.core.io.transport.upnp.UpnpIOService;
@@ -63,9 +62,8 @@ public class WemoMakerHandler extends WemoBaseThingHandler {
 
     private @Nullable ScheduledFuture<?> pollingJob;
 
-    public WemoMakerHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService,
-            WemoHttpCall wemoHttpcaller) {
-        super(thing, upnpIOService, upnpService, wemoHttpcaller);
+    public WemoMakerHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpcaller) {
+        super(thing, upnpIOService, wemoHttpcaller);
 
         logger.debug("Creating a WemoMakerHandler for thing '{}'", getThing().getUID());
     }
index 98ed807d28ff8e268870500dd70e64deff430975..e1bc7eb116db33d1ce3a964003c5a2ca168b9800 100644 (file)
@@ -17,7 +17,6 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
 import org.openhab.binding.wemo.internal.WemoBindingConstants;
 import org.openhab.binding.wemo.internal.http.WemoHttpCall;
 import org.openhab.core.io.transport.upnp.UpnpIOService;
@@ -41,9 +40,8 @@ public class WemoMotionHandler extends WemoHandler {
     private final Logger logger = LoggerFactory.getLogger(WemoMotionHandler.class);
     private final Map<String, String> stateMap = new ConcurrentHashMap<String, String>();
 
-    public WemoMotionHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService,
-            WemoHttpCall wemoHttpCaller) {
-        super(thing, upnpIOService, upnpService, wemoHttpCaller);
+    public WemoMotionHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
+        super(thing, upnpIOService, wemoHttpCaller);
     }
 
     @Override
index 0b742b7ba639b3e36d63cba7e53a9b2386b1dec5..62f283678f32feee6df4bae0f4231daaf0e73b26 100644 (file)
@@ -17,7 +17,6 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.jupnp.UpnpService;
 import org.openhab.binding.wemo.internal.WemoBindingConstants;
 import org.openhab.binding.wemo.internal.http.WemoHttpCall;
 import org.openhab.core.io.transport.upnp.UpnpIOService;
@@ -40,9 +39,8 @@ public class WemoSwitchHandler extends WemoHandler {
     private final Logger logger = LoggerFactory.getLogger(WemoSwitchHandler.class);
     private final Map<String, String> stateMap = new ConcurrentHashMap<String, String>();
 
-    public WemoSwitchHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService,
-            WemoHttpCall wemoHttpCaller) {
-        super(thing, upnpIOService, upnpService, wemoHttpCaller);
+    public WemoSwitchHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
+        super(thing, upnpIOService, wemoHttpCaller);
     }
 
     @Override
index ca9db9d7b1af47c7ee4e39d7533135d76499cf19..17d53091400ec7e2e3c5591efd1066a5d1b88449 100644 (file)
@@ -111,7 +111,7 @@ public class WemoHandlerOSGiTest extends GenericWemoOSGiTest {
         Thing thing = createThing(THING_TYPE_UID, DEFAULT_TEST_CHANNEL, DEFAULT_TEST_CHANNEL_TYPE);
 
         waitForAssert(() -> {
-            assertThat(thing.getStatus(), is(ThingStatus.OFFLINE));
+            assertThat(thing.getStatus(), is(ThingStatus.UNKNOWN));
         });
 
         // The device is registered as UPnP Device after the initialization, this will ensure that the polling job will
index 55bbebe8ee256f297cbc679a06a5ec9ee017be5b..83d1f7713799cb3c7cef07edc3f3e1b923649254 100644 (file)
@@ -143,7 +143,7 @@ public class WemoInsightHandlerTest {
         String channelToWatch;
 
         public MockWemoInsightHandler(Thing thing, String channelToWatch) {
-            super(thing, null, null, new WemoHttpCall());
+            super(thing, null, new WemoHttpCall());
             this.channelToWatch = channelToWatch;
         }