Search in sources :

Example 1 with DeviceHandler

use of org.eclipse.smarthome.binding.digitalstrom.handler.DeviceHandler in project smarthome by eclipse.

the class DigitalSTROMHandlerFactory method createHandler.

@Override
protected ThingHandler createHandler(Thing thing) {
    ThingTypeUID thingTypeUID = thing.getThingTypeUID();
    if (thingTypeUID == null) {
        return null;
    }
    if (BridgeHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) {
        BridgeHandler handler = new BridgeHandler((Bridge) thing);
        if (bridgeHandlers == null) {
            bridgeHandlers = new HashMap<ThingUID, BridgeHandler>();
        }
        bridgeHandlers.put(thing.getUID(), handler);
        DiscoveryServiceManager discoveryServiceManager = new DiscoveryServiceManager(handler);
        discoveryServiceManager.registerDiscoveryServices(bundleContext);
        discoveryServiceManagers.put(handler.getThing().getUID().getAsString(), discoveryServiceManager);
        return handler;
    }
    if (DeviceHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) {
        return new DeviceHandler(thing);
    }
    if (CircuitHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) {
        return new CircuitHandler(thing);
    }
    if (ZoneTemperatureControlHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) {
        return new ZoneTemperatureControlHandler(thing);
    }
    if (SceneHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) {
        return new SceneHandler(thing);
    }
    return null;
}
Also used : BridgeHandler(org.eclipse.smarthome.binding.digitalstrom.handler.BridgeHandler) CircuitHandler(org.eclipse.smarthome.binding.digitalstrom.handler.CircuitHandler) DiscoveryServiceManager(org.eclipse.smarthome.binding.digitalstrom.internal.discovery.DiscoveryServiceManager) ZoneTemperatureControlHandler(org.eclipse.smarthome.binding.digitalstrom.handler.ZoneTemperatureControlHandler) ThingUID(org.eclipse.smarthome.core.thing.ThingUID) ThingTypeUID(org.eclipse.smarthome.core.thing.ThingTypeUID) DeviceHandler(org.eclipse.smarthome.binding.digitalstrom.handler.DeviceHandler) SceneHandler(org.eclipse.smarthome.binding.digitalstrom.handler.SceneHandler)

Aggregations

BridgeHandler (org.eclipse.smarthome.binding.digitalstrom.handler.BridgeHandler)1 CircuitHandler (org.eclipse.smarthome.binding.digitalstrom.handler.CircuitHandler)1 DeviceHandler (org.eclipse.smarthome.binding.digitalstrom.handler.DeviceHandler)1 SceneHandler (org.eclipse.smarthome.binding.digitalstrom.handler.SceneHandler)1 ZoneTemperatureControlHandler (org.eclipse.smarthome.binding.digitalstrom.handler.ZoneTemperatureControlHandler)1 DiscoveryServiceManager (org.eclipse.smarthome.binding.digitalstrom.internal.discovery.DiscoveryServiceManager)1 ThingTypeUID (org.eclipse.smarthome.core.thing.ThingTypeUID)1 ThingUID (org.eclipse.smarthome.core.thing.ThingUID)1