use of org.eclipse.smarthome.binding.wemo.handler.WemoBridgeHandler in project smarthome by eclipse.
the class WemoHandlerFactory method createHandler.
@Override
protected ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (thingTypeUID != null) {
logger.debug("Trying to create a handler for ThingType '{}", thingTypeUID);
if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_BRIDGE)) {
logger.debug("Creating a WemoBridgeHandler for thing '{}' with UDN '{}'", thing.getUID(), thing.getConfiguration().get(UDN));
WemoBridgeHandler handler = new WemoBridgeHandler((Bridge) thing);
registerDeviceDiscoveryService(handler);
return handler;
} 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);
} else if (WemoBindingConstants.SUPPORTED_DEVICE_THING_TYPES.contains(thing.getThingTypeUID())) {
logger.debug("Creating a WemoHandler for thing '{}' with UDN '{}'", thing.getUID(), thing.getConfiguration().get(UDN));
return new WemoHandler(thing, upnpIOService);
} 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);
} else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_MZ100)) {
return new WemoLightHandler(thing, upnpIOService);
} else {
logger.warn("ThingHandler not found for {}", thingTypeUID);
return null;
}
}
return null;
}
Aggregations