Search in sources :

Example 1 with WemoHandler

use of org.eclipse.smarthome.binding.wemo.handler.WemoHandler 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;
}
Also used : WemoBridgeHandler(org.eclipse.smarthome.binding.wemo.handler.WemoBridgeHandler) WemoMakerHandler(org.eclipse.smarthome.binding.wemo.handler.WemoMakerHandler) WemoCoffeeHandler(org.eclipse.smarthome.binding.wemo.handler.WemoCoffeeHandler) WemoHandler(org.eclipse.smarthome.binding.wemo.handler.WemoHandler) WemoLightHandler(org.eclipse.smarthome.binding.wemo.handler.WemoLightHandler) ThingTypeUID(org.eclipse.smarthome.core.thing.ThingTypeUID)

Aggregations

WemoBridgeHandler (org.eclipse.smarthome.binding.wemo.handler.WemoBridgeHandler)1 WemoCoffeeHandler (org.eclipse.smarthome.binding.wemo.handler.WemoCoffeeHandler)1 WemoHandler (org.eclipse.smarthome.binding.wemo.handler.WemoHandler)1 WemoLightHandler (org.eclipse.smarthome.binding.wemo.handler.WemoLightHandler)1 WemoMakerHandler (org.eclipse.smarthome.binding.wemo.handler.WemoMakerHandler)1 ThingTypeUID (org.eclipse.smarthome.core.thing.ThingTypeUID)1