[wemo] Fix stability issues (#14163)

* Stabilize UPnP subscription handling
* Remove unused UpnpService
* Fix integration test

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2023-01-28 09:35:30 +01:00
parent 58a979d209
commit da15059292
15 changed files with 59 additions and 130 deletions

View File

@ -110,7 +110,7 @@ public class WemoBindingConstants {
public static final String DEVICE_ID = "deviceID"; public static final String DEVICE_ID = "deviceID";
public static final String POLLING_INTERVAL = "pollingInterval"; public static final String POLLING_INTERVAL = "pollingInterval";
public static final int DEFAULT_REFRESH_INTERVAL_SECONDS = 60; 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 int LINK_DISCOVERY_SERVICE_INITIAL_DELAY = 5;
public static final String HTTP_CALL_CONTENT_HEADER = "text/xml; charset=utf-8"; public static final String HTTP_CALL_CONTENT_HEADER = "text/xml; charset=utf-8";

View File

@ -21,7 +21,6 @@ import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.jupnp.UpnpService;
import org.openhab.binding.wemo.internal.discovery.WemoLinkDiscoveryService; import org.openhab.binding.wemo.internal.discovery.WemoLinkDiscoveryService;
import org.openhab.binding.wemo.internal.handler.WemoBridgeHandler; import org.openhab.binding.wemo.internal.handler.WemoBridgeHandler;
import org.openhab.binding.wemo.internal.handler.WemoCoffeeHandler; 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; public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = WemoBindingConstants.SUPPORTED_THING_TYPES;
private final UpnpIOService upnpIOService; private final UpnpIOService upnpIOService;
private final UpnpService upnpService;
private @Nullable WemoHttpCallFactory wemoHttpCallFactory; private @Nullable WemoHttpCallFactory wemoHttpCallFactory;
@Override @Override
@ -79,9 +77,8 @@ public class WemoHandlerFactory extends BaseThingHandlerFactory {
private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
@Activate @Activate
public WemoHandlerFactory(final @Reference UpnpIOService upnpIOService, @Reference UpnpService upnpService) { public WemoHandlerFactory(final @Reference UpnpIOService upnpIOService) {
this.upnpIOService = upnpIOService; this.upnpIOService = upnpIOService;
this.upnpService = upnpService;
} }
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC) @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())) { } else if (WemoBindingConstants.THING_TYPE_INSIGHT.equals(thing.getThingTypeUID())) {
logger.debug("Creating a WemoInsightHandler for thing '{}' with UDN '{}'", thing.getUID(), logger.debug("Creating a WemoInsightHandler for thing '{}' with UDN '{}'", thing.getUID(),
thing.getConfiguration().get(UDN)); 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()) } else if (WemoBindingConstants.THING_TYPE_SOCKET.equals(thing.getThingTypeUID())
|| WemoBindingConstants.THING_TYPE_LIGHTSWITCH.equals(thing.getThingTypeUID())) { || WemoBindingConstants.THING_TYPE_LIGHTSWITCH.equals(thing.getThingTypeUID())) {
logger.debug("Creating a WemoSwitchHandler for thing '{}' with UDN '{}'", thing.getUID(), logger.debug("Creating a WemoSwitchHandler for thing '{}' with UDN '{}'", thing.getUID(),
thing.getConfiguration().get(UDN)); 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())) { } else if (WemoBindingConstants.THING_TYPE_MOTION.equals(thing.getThingTypeUID())) {
logger.debug("Creating a WemoMotionHandler for thing '{}' with UDN '{}'", thing.getUID(), logger.debug("Creating a WemoMotionHandler for thing '{}' with UDN '{}'", thing.getUID(),
thing.getConfiguration().get(UDN)); 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)) { } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_MAKER)) {
logger.debug("Creating a WemoMakerHandler for thing '{}' with UDN '{}'", thing.getUID(), logger.debug("Creating a WemoMakerHandler for thing '{}' with UDN '{}'", thing.getUID(),
thing.getConfiguration().get(UDN)); 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)) { } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_COFFEE)) {
logger.debug("Creating a WemoCoffeeHandler for thing '{}' with UDN '{}'", thing.getUID(), logger.debug("Creating a WemoCoffeeHandler for thing '{}' with UDN '{}'", thing.getUID(),
thing.getConfiguration().get(UDN)); 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)) { } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_DIMMER)) {
logger.debug("Creating a WemoDimmerHandler for thing '{}' with UDN '{}'", thing.getUID(), logger.debug("Creating a WemoDimmerHandler for thing '{}' with UDN '{}'", thing.getUID(),
thing.getConfiguration().get("udn")); 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)) { } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_CROCKPOT)) {
logger.debug("Creating a WemoCockpotHandler for thing '{}' with UDN '{}'", thing.getUID(), logger.debug("Creating a WemoCockpotHandler for thing '{}' with UDN '{}'", thing.getUID(),
thing.getConfiguration().get("udn")); 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)) { } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_PURIFIER)) {
logger.debug("Creating a WemoHolmesHandler for thing '{}' with UDN '{}'", thing.getUID(), logger.debug("Creating a WemoHolmesHandler for thing '{}' with UDN '{}'", thing.getUID(),
thing.getConfiguration().get("udn")); 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)) { } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_HUMIDIFIER)) {
logger.debug("Creating a WemoHolmesHandler for thing '{}' with UDN '{}'", thing.getUID(), logger.debug("Creating a WemoHolmesHandler for thing '{}' with UDN '{}'", thing.getUID(),
thing.getConfiguration().get("udn")); 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)) { } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_HEATER)) {
logger.debug("Creating a WemoHolmesHandler for thing '{}' with UDN '{}'", thing.getUID(), logger.debug("Creating a WemoHolmesHandler for thing '{}' with UDN '{}'", thing.getUID(),
thing.getConfiguration().get("udn")); 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)) { } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_MZ100)) {
return new WemoLightHandler(thing, upnpIOService, upnpService, wemoHttpcaller); return new WemoLightHandler(thing, upnpIOService, wemoHttpcaller);
} else { } else {
logger.warn("ThingHandler not found for {}", thingTypeUID); logger.warn("ThingHandler not found for {}", thingTypeUID);
return null; return null;

View File

@ -19,16 +19,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; 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.WemoBindingConstants;
import org.openhab.binding.wemo.internal.http.WemoHttpCall; import org.openhab.binding.wemo.internal.http.WemoHttpCall;
import org.openhab.core.io.transport.upnp.UpnpIOParticipant; import org.openhab.core.io.transport.upnp.UpnpIOParticipant;
@ -51,26 +47,21 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault @NonNullByDefault
public abstract class WemoBaseThingHandler extends BaseThingHandler implements UpnpIOParticipant { 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_START = 49151;
private static final int PORT_RANGE_END = 49157; private static final int PORT_RANGE_END = 49157;
private final Logger logger = LoggerFactory.getLogger(WemoBaseThingHandler.class); private final Logger logger = LoggerFactory.getLogger(WemoBaseThingHandler.class);
private final UpnpIOService service; private final UpnpIOService service;
private final UpnpService upnpService; private final Object upnpLock = new Object();
protected WemoHttpCall wemoHttpCaller; protected WemoHttpCall wemoHttpCaller;
private @Nullable String host; private @Nullable String host;
private Map<String, Instant> subscriptions = new ConcurrentHashMap<String, Instant>(); private Map<String, Instant> subscriptions = new ConcurrentHashMap<String, Instant>();
private @Nullable ScheduledFuture<?> subscriptionRenewalJob;
public WemoBaseThingHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, public WemoBaseThingHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
WemoHttpCall wemoHttpCaller) {
super(thing); super(thing);
this.service = upnpIOService; this.service = upnpIOService;
this.upnpService = upnpService;
this.wemoHttpCaller = wemoHttpCaller; this.wemoHttpCaller = wemoHttpCaller;
} }
@ -83,7 +74,6 @@ public abstract class WemoBaseThingHandler extends BaseThingHandler implements U
@Override @Override
public void dispose() { public void dispose() {
cancelSubscriptionRenewalJob();
removeSubscriptions(); removeSubscriptions();
logger.debug("Unregistering UPnP participant for {}", getThing().getUID()); logger.debug("Unregistering UPnP participant for {}", getThing().getUID());
service.unregisterParticipant(this); service.unregisterParticipant(this);
@ -98,16 +88,14 @@ public abstract class WemoBaseThingHandler extends BaseThingHandler implements U
public void onStatusChanged(boolean status) { public void onStatusChanged(boolean status) {
if (status) { if (status) {
logger.debug("UPnP device {} for {} is present", getUDN(), getThing().getUID()); logger.debug("UPnP device {} for {} is present", getUDN(), getThing().getUID());
if (service.isRegistered(this)) {
// After successful discovery, try to subscribe again.
renewSubscriptions();
}
} else { } else {
logger.info("UPnP device {} for {} is absent", getUDN(), getThing().getUID()); logger.info("UPnP device {} for {} is absent", getUDN(), getThing().getUID());
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR);
// Expire subscriptions. // Expire subscriptions.
for (Entry<String, Instant> subscription : subscriptions.entrySet()) { synchronized (upnpLock) {
subscription.setValue(Instant.MIN); 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"); logger.debug("Subscription to service {} for {} {}", service, getUDN(), succeeded ? "succeeded" : "failed");
if (succeeded) { 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) { protected void addSubscription(String serviceId) {
if (subscriptions.containsKey(serviceId)) { synchronized (upnpLock) {
logger.debug("{} already subscribed to {}", getUDN(), serviceId); if (subscriptions.containsKey(serviceId)) {
return; 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");
} }
if (subscriptions.isEmpty()) {
logger.debug("Adding first GENA subscription for {}, scheduling renewal job", getUDN());
scheduleSubscriptionRenewalJob();
}
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); 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() { private void removeSubscriptions() {
if (subscriptions.isEmpty()) {
return;
}
logger.debug("Removing GENA subscriptions for {}, participant is {}", getUDN(), logger.debug("Removing GENA subscriptions for {}, participant is {}", getUDN(),
service.isRegistered(this) ? "registered" : "not registered"); service.isRegistered(this) ? "registered" : "not registered");
subscriptions.forEach((serviceId, lastRenewed) -> { synchronized (upnpLock) {
logger.debug("Removing subscription for service {}", serviceId); subscriptions.forEach((serviceId, lastRenewed) -> {
service.removeSubscription(this, serviceId); logger.debug("Removing subscription for service {}", serviceId);
}); service.removeSubscription(this, serviceId);
subscriptions.clear(); });
subscriptions.clear();
}
} }
public @Nullable String getWemoURL(String actionService) { public @Nullable String getWemoURL(String actionService) {

View File

@ -29,7 +29,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.jupnp.UpnpService;
import org.openhab.binding.wemo.internal.http.WemoHttpCall; import org.openhab.binding.wemo.internal.http.WemoHttpCall;
import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.Configuration;
import org.openhab.core.io.transport.upnp.UpnpIOService; import org.openhab.core.io.transport.upnp.UpnpIOService;
@ -70,9 +69,8 @@ public class WemoCoffeeHandler extends WemoBaseThingHandler {
private @Nullable ScheduledFuture<?> pollingJob; private @Nullable ScheduledFuture<?> pollingJob;
public WemoCoffeeHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, public WemoCoffeeHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
WemoHttpCall wemoHttpCaller) { super(thing, upnpIOService, wemoHttpCaller);
super(thing, upnpIOService, upnpService, wemoHttpCaller);
logger.debug("Creating a WemoCoffeeHandler for thing '{}'", getThing().getUID()); logger.debug("Creating a WemoCoffeeHandler for thing '{}'", getThing().getUID());
} }

View File

@ -25,7 +25,6 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.jupnp.UpnpService;
import org.openhab.binding.wemo.internal.http.WemoHttpCall; import org.openhab.binding.wemo.internal.http.WemoHttpCall;
import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.Configuration;
import org.openhab.core.io.transport.upnp.UpnpIOService; import org.openhab.core.io.transport.upnp.UpnpIOService;
@ -61,9 +60,8 @@ public class WemoCrockpotHandler extends WemoBaseThingHandler {
private @Nullable ScheduledFuture<?> pollingJob; private @Nullable ScheduledFuture<?> pollingJob;
public WemoCrockpotHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, public WemoCrockpotHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
WemoHttpCall wemoHttpCaller) { super(thing, upnpIOService, wemoHttpCaller);
super(thing, upnpIOService, upnpService, wemoHttpCaller);
logger.debug("Creating a WemoCrockpotHandler for thing '{}'", getThing().getUID()); logger.debug("Creating a WemoCrockpotHandler for thing '{}'", getThing().getUID());
} }

View File

@ -27,7 +27,6 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.jupnp.UpnpService;
import org.openhab.binding.wemo.internal.http.WemoHttpCall; import org.openhab.binding.wemo.internal.http.WemoHttpCall;
import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.Configuration;
import org.openhab.core.io.transport.upnp.UpnpIOService; import org.openhab.core.io.transport.upnp.UpnpIOService;
@ -74,9 +73,8 @@ public class WemoDimmerHandler extends WemoBaseThingHandler {
*/ */
private static final int DIM_STEPSIZE = 5; private static final int DIM_STEPSIZE = 5;
public WemoDimmerHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, public WemoDimmerHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
WemoHttpCall wemoHttpCaller) { super(thing, upnpIOService, wemoHttpCaller);
super(thing, upnpIOService, upnpService, wemoHttpCaller);
logger.debug("Creating a WemoDimmerHandler for thing '{}'", getThing().getUID()); logger.debug("Creating a WemoDimmerHandler for thing '{}'", getThing().getUID());
} }

View File

@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.jupnp.UpnpService;
import org.openhab.binding.wemo.internal.http.WemoHttpCall; import org.openhab.binding.wemo.internal.http.WemoHttpCall;
import org.openhab.core.io.transport.upnp.UpnpIOService; import org.openhab.core.io.transport.upnp.UpnpIOService;
import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.OnOffType;
@ -53,8 +52,8 @@ public abstract class WemoHandler extends WemoBaseThingHandler {
private @Nullable ScheduledFuture<?> pollingJob; private @Nullable ScheduledFuture<?> pollingJob;
public WemoHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, WemoHttpCall wemoHttpCaller) { public WemoHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
super(thing, upnpIOService, upnpService, wemoHttpCaller); super(thing, upnpIOService, wemoHttpCaller);
logger.debug("Creating a WemoHandler for thing '{}'", getThing().getUID()); logger.debug("Creating a WemoHandler for thing '{}'", getThing().getUID());
} }

View File

@ -30,7 +30,6 @@ import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.jupnp.UpnpService;
import org.openhab.binding.wemo.internal.http.WemoHttpCall; import org.openhab.binding.wemo.internal.http.WemoHttpCall;
import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.Configuration;
import org.openhab.core.io.transport.upnp.UpnpIOService; import org.openhab.core.io.transport.upnp.UpnpIOService;
@ -75,9 +74,8 @@ public class WemoHolmesHandler extends WemoBaseThingHandler {
private @Nullable ScheduledFuture<?> pollingJob; private @Nullable ScheduledFuture<?> pollingJob;
public WemoHolmesHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, public WemoHolmesHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
WemoHttpCall wemoHttpCaller) { super(thing, upnpIOService, wemoHttpCaller);
super(thing, upnpIOService, upnpService, wemoHttpCaller);
logger.debug("Creating a WemoHolmesHandler for thing '{}'", getThing().getUID()); logger.debug("Creating a WemoHolmesHandler for thing '{}'", getThing().getUID());
} }

View File

@ -20,7 +20,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.jupnp.UpnpService;
import org.openhab.binding.wemo.internal.InsightParser; import org.openhab.binding.wemo.internal.InsightParser;
import org.openhab.binding.wemo.internal.WemoBindingConstants; import org.openhab.binding.wemo.internal.WemoBindingConstants;
import org.openhab.binding.wemo.internal.WemoPowerBank; import org.openhab.binding.wemo.internal.WemoPowerBank;
@ -52,9 +51,8 @@ public class WemoInsightHandler extends WemoHandler {
private int currentPowerSlidingSeconds; private int currentPowerSlidingSeconds;
private int currentPowerDeltaTrigger; private int currentPowerDeltaTrigger;
public WemoInsightHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, public WemoInsightHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
WemoHttpCall wemoHttpCaller) { super(thing, upnpIOService, wemoHttpCaller);
super(thing, upnpIOService, upnpService, wemoHttpCaller);
} }
@Override @Override

View File

@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.jupnp.UpnpService;
import org.openhab.binding.wemo.internal.http.WemoHttpCall; import org.openhab.binding.wemo.internal.http.WemoHttpCall;
import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.Configuration;
import org.openhab.core.io.transport.upnp.UpnpIOService; import org.openhab.core.io.transport.upnp.UpnpIOService;
@ -71,9 +70,8 @@ public class WemoLightHandler extends WemoBaseThingHandler {
private @Nullable ScheduledFuture<?> pollingJob; private @Nullable ScheduledFuture<?> pollingJob;
public WemoLightHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, public WemoLightHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpcaller) {
WemoHttpCall wemoHttpcaller) { super(thing, upnpIOService, wemoHttpcaller);
super(thing, upnpIOService, upnpService, wemoHttpcaller);
logger.debug("Creating a WemoLightHandler for thing '{}'", getThing().getUID()); logger.debug("Creating a WemoLightHandler for thing '{}'", getThing().getUID());
} }

View File

@ -26,7 +26,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.jupnp.UpnpService;
import org.openhab.binding.wemo.internal.http.WemoHttpCall; import org.openhab.binding.wemo.internal.http.WemoHttpCall;
import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.Configuration;
import org.openhab.core.io.transport.upnp.UpnpIOService; import org.openhab.core.io.transport.upnp.UpnpIOService;
@ -63,9 +62,8 @@ public class WemoMakerHandler extends WemoBaseThingHandler {
private @Nullable ScheduledFuture<?> pollingJob; private @Nullable ScheduledFuture<?> pollingJob;
public WemoMakerHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, public WemoMakerHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpcaller) {
WemoHttpCall wemoHttpcaller) { super(thing, upnpIOService, wemoHttpcaller);
super(thing, upnpIOService, upnpService, wemoHttpcaller);
logger.debug("Creating a WemoMakerHandler for thing '{}'", getThing().getUID()); logger.debug("Creating a WemoMakerHandler for thing '{}'", getThing().getUID());
} }

View File

@ -17,7 +17,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.jupnp.UpnpService;
import org.openhab.binding.wemo.internal.WemoBindingConstants; import org.openhab.binding.wemo.internal.WemoBindingConstants;
import org.openhab.binding.wemo.internal.http.WemoHttpCall; import org.openhab.binding.wemo.internal.http.WemoHttpCall;
import org.openhab.core.io.transport.upnp.UpnpIOService; 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 Logger logger = LoggerFactory.getLogger(WemoMotionHandler.class);
private final Map<String, String> stateMap = new ConcurrentHashMap<String, String>(); private final Map<String, String> stateMap = new ConcurrentHashMap<String, String>();
public WemoMotionHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, public WemoMotionHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
WemoHttpCall wemoHttpCaller) { super(thing, upnpIOService, wemoHttpCaller);
super(thing, upnpIOService, upnpService, wemoHttpCaller);
} }
@Override @Override

View File

@ -17,7 +17,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.jupnp.UpnpService;
import org.openhab.binding.wemo.internal.WemoBindingConstants; import org.openhab.binding.wemo.internal.WemoBindingConstants;
import org.openhab.binding.wemo.internal.http.WemoHttpCall; import org.openhab.binding.wemo.internal.http.WemoHttpCall;
import org.openhab.core.io.transport.upnp.UpnpIOService; 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 Logger logger = LoggerFactory.getLogger(WemoSwitchHandler.class);
private final Map<String, String> stateMap = new ConcurrentHashMap<String, String>(); private final Map<String, String> stateMap = new ConcurrentHashMap<String, String>();
public WemoSwitchHandler(Thing thing, UpnpIOService upnpIOService, UpnpService upnpService, public WemoSwitchHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
WemoHttpCall wemoHttpCaller) { super(thing, upnpIOService, wemoHttpCaller);
super(thing, upnpIOService, upnpService, wemoHttpCaller);
} }
@Override @Override

View File

@ -111,7 +111,7 @@ public class WemoHandlerOSGiTest extends GenericWemoOSGiTest {
Thing thing = createThing(THING_TYPE_UID, DEFAULT_TEST_CHANNEL, DEFAULT_TEST_CHANNEL_TYPE); Thing thing = createThing(THING_TYPE_UID, DEFAULT_TEST_CHANNEL, DEFAULT_TEST_CHANNEL_TYPE);
waitForAssert(() -> { 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 // The device is registered as UPnP Device after the initialization, this will ensure that the polling job will

View File

@ -143,7 +143,7 @@ public class WemoInsightHandlerTest {
String channelToWatch; String channelToWatch;
public MockWemoInsightHandler(Thing thing, String channelToWatch) { public MockWemoInsightHandler(Thing thing, String channelToWatch) {
super(thing, null, null, new WemoHttpCall()); super(thing, null, new WemoHttpCall());
this.channelToWatch = channelToWatch; this.channelToWatch = channelToWatch;
} }