mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[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:
parent
58a979d209
commit
da15059292
@ -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";
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
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");
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user