Search in sources :

Example 36 with ThingTypeUID

use of org.eclipse.smarthome.core.thing.ThingTypeUID in project smarthome by eclipse.

the class SceneDiscoveryService method getThingUID.

private ThingUID getThingUID(InternalScene scene) {
    ThingUID bridgeUID = bridgeHandler.getThing().getUID();
    ThingTypeUID thingTypeUID = new ThingTypeUID(BINDING_ID, sceneType);
    if (getSupportedThingTypes().contains(thingTypeUID)) {
        String thingSceneId = scene.getID();
        ThingUID thingUID = new ThingUID(thingTypeUID, bridgeUID, thingSceneId);
        return thingUID;
    } else {
        return null;
    }
}
Also used : ThingUID(org.eclipse.smarthome.core.thing.ThingUID) ThingTypeUID(org.eclipse.smarthome.core.thing.ThingTypeUID)

Example 37 with ThingTypeUID

use of org.eclipse.smarthome.core.thing.ThingTypeUID in project smarthome by eclipse.

the class BlueZHandlerFactory method createHandler.

@Override
protected ThingHandler createHandler(Thing thing) {
    ThingTypeUID thingTypeUID = thing.getThingTypeUID();
    if (thingTypeUID.equals(BlueZAdapterConstants.THING_TYPE_BLUEZ)) {
        BlueZBridgeHandler handler = new BlueZBridgeHandler((Bridge) thing);
        registerBluetoothAdapter(handler);
        return handler;
    } else {
        return null;
    }
}
Also used : ThingTypeUID(org.eclipse.smarthome.core.thing.ThingTypeUID) BlueZBridgeHandler(org.eclipse.smarthome.binding.bluetooth.bluez.handler.BlueZBridgeHandler)

Example 38 with ThingTypeUID

use of org.eclipse.smarthome.core.thing.ThingTypeUID in project smarthome by eclipse.

the class AstroHandlerFactory method createHandler.

@Override
protected ThingHandler createHandler(Thing thing) {
    ThingTypeUID thingTypeUID = thing.getThingTypeUID();
    AstroThingHandler thingHandler = null;
    if (thingTypeUID.equals(THING_TYPE_SUN)) {
        thingHandler = new SunHandler(thing);
    } else if (thingTypeUID.equals(THING_TYPE_MOON)) {
        thingHandler = new MoonHandler(thing);
    }
    if (thingHandler != null) {
        ASTRO_THING_HANDLERS.put(thing.getUID().toString(), thingHandler);
    }
    return thingHandler;
}
Also used : AstroThingHandler(org.eclipse.smarthome.binding.astro.handler.AstroThingHandler) SunHandler(org.eclipse.smarthome.binding.astro.handler.SunHandler) ThingTypeUID(org.eclipse.smarthome.core.thing.ThingTypeUID) MoonHandler(org.eclipse.smarthome.binding.astro.handler.MoonHandler)

Example 39 with ThingTypeUID

use of org.eclipse.smarthome.core.thing.ThingTypeUID in project smarthome by eclipse.

the class ZoneTemperatureControlDiscoveryService method getThingUID.

private ThingUID getThingUID(TemperatureControlStatus tempControlStatus) {
    ThingTypeUID thingTypeUID = new ThingTypeUID(BINDING_ID, thingTypeID);
    if (getSupportedThingTypes().contains(thingTypeUID)) {
        String thingID = tempControlStatus.getZoneID().toString();
        ThingUID thingUID = new ThingUID(thingTypeUID, bridgeUID, thingID);
        return thingUID;
    } else {
        return null;
    }
}
Also used : ThingUID(org.eclipse.smarthome.core.thing.ThingUID) ThingTypeUID(org.eclipse.smarthome.core.thing.ThingTypeUID)

Example 40 with ThingTypeUID

use of org.eclipse.smarthome.core.thing.ThingTypeUID in project smarthome by eclipse.

the class TradfriDiscoveryServiceTest method setUp.

@Before
public void setUp() {
    initMocks(this);
    when(handler.getThing()).thenReturn(BridgeBuilder.create(GATEWAY_TYPE_UID, "1").build());
    discovery = new TradfriDiscoveryService(handler);
    listener = new DiscoveryListener() {

        @Override
        public void thingRemoved(DiscoveryService source, ThingUID thingUID) {
        }

        @Override
        public void thingDiscovered(DiscoveryService source, DiscoveryResult result) {
            discoveryResult = result;
        }

        @Override
        public Collection<ThingUID> removeOlderResults(DiscoveryService source, long timestamp, Collection<ThingTypeUID> thingTypeUIDs, ThingUID bridgeUID) {
            return null;
        }
    };
    discovery.addDiscoveryListener(listener);
}
Also used : DiscoveryResult(org.eclipse.smarthome.config.discovery.DiscoveryResult) ThingUID(org.eclipse.smarthome.core.thing.ThingUID) Collection(java.util.Collection) ThingTypeUID(org.eclipse.smarthome.core.thing.ThingTypeUID) DiscoveryService(org.eclipse.smarthome.config.discovery.DiscoveryService) TradfriDiscoveryService(org.eclipse.smarthome.binding.tradfri.internal.discovery.TradfriDiscoveryService) DiscoveryListener(org.eclipse.smarthome.config.discovery.DiscoveryListener) TradfriDiscoveryService(org.eclipse.smarthome.binding.tradfri.internal.discovery.TradfriDiscoveryService) Before(org.junit.Before)

Aggregations

ThingTypeUID (org.eclipse.smarthome.core.thing.ThingTypeUID)63 ThingUID (org.eclipse.smarthome.core.thing.ThingUID)27 Test (org.junit.Test)27 JavaOSGiTest (org.eclipse.smarthome.test.java.JavaOSGiTest)25 Thing (org.eclipse.smarthome.core.thing.Thing)12 DiscoveryResult (org.eclipse.smarthome.config.discovery.DiscoveryResult)11 Locale (java.util.Locale)10 HashMap (java.util.HashMap)9 Collection (java.util.Collection)5 DiscoveryService (org.eclipse.smarthome.config.discovery.DiscoveryService)5 Before (org.junit.Before)5 Configuration (org.eclipse.smarthome.config.core.Configuration)4 DiscoveryListener (org.eclipse.smarthome.config.discovery.DiscoveryListener)4 ApiOperation (io.swagger.annotations.ApiOperation)3 ApiResponses (io.swagger.annotations.ApiResponses)3 Nullable (org.eclipse.jdt.annotation.Nullable)3 ThingRegistry (org.eclipse.smarthome.core.thing.ThingRegistry)3 BaseThingHandlerFactory (org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory)3 Firmware (org.eclipse.smarthome.core.thing.binding.firmware.Firmware)3 ArrayList (java.util.ArrayList)2