Java Code Examples for org.eclipse.smarthome.core.thing.Thing#getThingTypeUID()
The following examples show how to use
org.eclipse.smarthome.core.thing.Thing#getThingTypeUID() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OwHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 6 votes |
@Override protected @Nullable ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (OwserverBridgeHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { OwserverBridgeHandler owserverBridgeHandler = new OwserverBridgeHandler((Bridge) thing); registerDiscoveryService(owserverBridgeHandler); return owserverBridgeHandler; } else if (TemperatureSensorThingHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { return new TemperatureSensorThingHandler(thing, dynamicStateDescriptionProvider); } else if (IButtonThingHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { return new IButtonThingHandler(thing, dynamicStateDescriptionProvider); } else if (DigitalIOThingHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { return new DigitalIOThingHandler(thing, dynamicStateDescriptionProvider); } else if (BasicMultisensorThingHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { return new BasicMultisensorThingHandler(thing, dynamicStateDescriptionProvider); } else if (AdvancedMultisensorThingHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { return new AdvancedMultisensorThingHandler(thing, dynamicStateDescriptionProvider); } else if (CounterSensorThingHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { return new CounterSensorThingHandler(thing, dynamicStateDescriptionProvider); } else if (EDSSensorThingHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { return new EDSSensorThingHandler(thing, dynamicStateDescriptionProvider); } return null; }
Example 2
Source File: OpenWeatherMapHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 6 votes |
@Override protected @Nullable ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (THING_TYPE_WEATHER_API.equals(thingTypeUID)) { OpenWeatherMapAPIHandler handler = new OpenWeatherMapAPIHandler((Bridge) thing, httpClient, localeProvider); // register discovery service OpenWeatherMapDiscoveryService discoveryService = new OpenWeatherMapDiscoveryService(handler, locationProvider, localeProvider, i18nProvider); discoveryServiceRegs.put(handler.getThing().getUID(), bundleContext .registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<>())); return handler; } else if (THING_TYPE_WEATHER_AND_FORECAST.equals(thingTypeUID)) { return new OpenWeatherMapWeatherAndForecastHandler(thing); } else if (THING_TYPE_UVINDEX.equals(thingTypeUID)) { return new OpenWeatherMapUVIndexHandler(thing); } return null; }
Example 3
Source File: MqttBrokerHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 6 votes |
@Override protected @Nullable ThingHandler createHandler(Thing thing) { if (mqttService == null) { throw new IllegalStateException("MqttService must be bound, before ThingHandlers can be created"); } if (!(thing instanceof Bridge)) { throw new IllegalStateException("A bridge type is expected"); } final ThingTypeUID thingTypeUID = thing.getThingTypeUID(); final AbstractBrokerHandler handler; if (thingTypeUID.equals(MqttBindingConstants.BRIDGE_TYPE_SYSTEMBROKER)) { handler = new SystemBrokerHandler((Bridge) thing, mqttService); } else if (thingTypeUID.equals(MqttBindingConstants.BRIDGE_TYPE_BROKER)) { handler = new BrokerHandler((Bridge) thing); } else { throw new IllegalStateException("Not supported " + thingTypeUID.toString()); } createdHandler(handler); return handler; }
Example 4
Source File: WeatherUndergroundHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 6 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(THING_TYPE_WEATHER)) { return new WeatherUndergroundHandler(thing, localeProvider, unitProvider); } if (thingTypeUID.equals(THING_TYPE_BRIDGE)) { WeatherUndergroundBridgeHandler handler = new WeatherUndergroundBridgeHandler((Bridge) thing); registerDiscoveryService(handler.getThing().getUID()); return handler; } return null; }
Example 5
Source File: SonosHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 6 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (SonosBindingConstants.SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) { logger.debug("Creating a ZonePlayerHandler for thing '{}' with UDN '{}'", thing.getUID(), thing.getConfiguration().get(UDN)); ZonePlayerHandler handler = new ZonePlayerHandler(thing, upnpIOService, opmlUrl, stateDescriptionProvider); // register the speaker as an audio sink String callbackUrl = createCallbackUrl(); SonosAudioSink audioSink = new SonosAudioSink(handler, audioHTTPServer, callbackUrl); @SuppressWarnings("unchecked") ServiceRegistration<AudioSink> reg = (ServiceRegistration<AudioSink>) getBundleContext() .registerService(AudioSink.class.getName(), audioSink, new Hashtable<String, Object>()); audioSinkRegistrations.put(thing.getUID().toString(), reg); return handler; } return null; }
Example 6
Source File: TradfriHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 6 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (GATEWAY_TYPE_UID.equals(thingTypeUID)) { TradfriGatewayHandler handler = new TradfriGatewayHandler((Bridge) thing); registerDiscoveryService(handler); return handler; } else if (THING_TYPE_DIMMER.equals(thingTypeUID) || THING_TYPE_REMOTE_CONTROL.equals(thingTypeUID)) { return new TradfriControllerHandler(thing); } else if (THING_TYPE_MOTION_SENSOR.equals(thingTypeUID)) { return new TradfriSensorHandler(thing); } else if (SUPPORTED_LIGHT_TYPES_UIDS.contains(thingTypeUID)) { return new TradfriLightHandler(thing); } else if (SUPPORTED_PLUG_TYPES_UIDS.contains(thingTypeUID)) { return new TradfriPlugHandler(thing); } return null; }
Example 7
Source File: WemoHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID != null) { logger.debug("Trying to create a handler for ThingType '{}", thingTypeUID); WemoHttpCall wemoHttpcaller = new WemoHttpCall(); 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, wemoHttpcaller); 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, wemoHttpcaller); } 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, 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, wemoHttpcaller); } else if (thingTypeUID.equals(WemoBindingConstants.THING_TYPE_MZ100)) { return new WemoLightHandler(thing, upnpIOService, wemoHttpcaller); } else { logger.warn("ThingHandler not found for {}", thingTypeUID); return null; } } return null; }
Example 8
Source File: AstroHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); AstroThingHandler thingHandler = null; if (thingTypeUID.equals(THING_TYPE_SUN)) { thingHandler = new SunHandler(thing, scheduler); } else if (thingTypeUID.equals(THING_TYPE_MOON)) { thingHandler = new MoonHandler(thing, scheduler); } if (thingHandler != null) { ASTRO_THING_HANDLERS.put(thing.getUID().toString(), thingHandler); } return thingHandler; }
Example 9
Source File: BlueGigaHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(BlueGigaAdapterConstants.THING_TYPE_BLUEGIGA)) { BlueGigaBridgeHandler handler = new BlueGigaBridgeHandler((Bridge) thing, serialPortManager); registerBluetoothAdapter(handler); return handler; } else { return null; } }
Example 10
Source File: LIRCHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (LIRCBindingConstants.SUPPORTED_BRIDGE_TYPES.contains(thingTypeUID)) { LIRCBridgeHandler handler = new LIRCBridgeHandler((Bridge) thing); registerDeviceDiscoveryService(handler); return handler; } else if (thingTypeUID.equals(THING_TYPE_REMOTE)) { return new LIRCRemoteHandler(thing); } return null; }
Example 11
Source File: DigitalSTROMHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); 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; }
Example 12
Source File: BlueZHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@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; } }
Example 13
Source File: FSInternetRadioHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(THING_TYPE_RADIO)) { return new FSInternetRadioHandler(thing, httpClient); } return null; }
Example 14
Source File: IpCameraHandlerFactory.java From IpCamera with Eclipse Public License 2.0 | 5 votes |
@Override protected @Nullable ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (IpCameraHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { return new IpCameraHandler(thing); } else if (IpCameraGroupHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { return new IpCameraGroupHandler(thing); } return null; }
Example 15
Source File: MqttThingHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override protected @Nullable ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(MqttBindingConstants.GENERIC_MQTT_THING)) { return new GenericThingHandler(thing, stateDescriptionProvider, this, 1500); } else if (thingTypeUID.equals(MqttBindingConstants.HOMIE300_MQTT_THING)) { return new HomieThingHandler(thing, typeProvider, 1500, 200); } else if (thingTypeUID.equals(MqttBindingConstants.HOMEASSISTANT_MQTT_THING)) { return new HomeAssistantThingHandler(thing, typeProvider, 1500, 200); } return null; }
Example 16
Source File: BlukiiHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(BlukiiBindingConstants.THING_TYPE_BEACON)) { return new BlukiiHandler(thing); } return null; }
Example 17
Source File: NtpHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (THING_TYPE_NTP.equals(thingTypeUID)) { return new NtpHandler(thing, localeProvider); } return null; }
Example 18
Source File: MeteoBlueHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(THING_TYPE_WEATHER)) { return new MeteoBlueHandler(thing); } if (thingTypeUID.equals(THING_TYPE_BRIDGE)) { return new MeteoBlueBridgeHandler((Bridge) thing); } return null; }
Example 19
Source File: GreeAirHandlerFactory.java From openhab-greeair-binding with Apache License 2.0 | 5 votes |
@Override // protected @Nullable ThingHandler createHandler(Thing thing) { protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(GREE_THING_TYPE)) { return new GreeAirHandler(thing); } return null; }
Example 20
Source File: MagicHandlerFactory.java From smarthome with Eclipse Public License 2.0 | 4 votes |
@Override protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(THING_TYPE_EXTENSIBLE_THING)) { return new MagicExtensibleThingHandler(thing); } if (thingTypeUID.equals(THING_TYPE_ON_OFF_LIGHT)) { return new MagicOnOffLightHandler(thing); } if (thingTypeUID.equals(THING_TYPE_DIMMABLE_LIGHT)) { return new MagicDimmableLightHandler(thing); } if (thingTypeUID.equals(THING_TYPE_COLOR_LIGHT)) { return new MagicColorLightHandler(thing); } if (thingTypeUID.equals(THING_TYPE_CONTACT_SENSOR)) { return new MagicContactHandler(thing); } if (thingTypeUID.equals(THING_TYPE_CONFIG_THING)) { return new MagicConfigurableThingHandler(thing); } if (thingTypeUID.equals(THING_TYPE_DELAYED_THING)) { return new MagicDelayedOnlineHandler(thing); } if (thingTypeUID.equals(THING_TYPE_LOCATION)) { return new MagicLocationThingHandler(thing); } if (thingTypeUID.equals(THING_TYPE_THERMOSTAT)) { return new MagicThermostatThingHandler(thing); } if (thingTypeUID.equals(THING_TYPE_FIRMWARE_UPDATE)) { return new MagicFirmwareUpdateThingHandler(thing); } if (thingTypeUID.equals(THING_TYPE_BRIDGED_THING)) { return new MagicBridgedThingHandler(thing); } if (thingTypeUID.equals(THING_TYPE_CHATTY_THING)) { return new MagicChattyThingHandler(thing); } if (thingTypeUID.equals(THING_TYPE_ROLLERSHUTTER)) { return new MagicRolllershutterHandler(thing); } if (thingTypeUID.equals(THING_TYPE_PLAYER)) { return new MagicPlayerHandler(thing); } if (thingTypeUID.equals(THING_TYPE_IMAGE)) { return new MagicImageHandler(thing); } if (thingTypeUID.equals(THING_TYPE_ACTION_MODULE)) { MagicActionModuleThingHandler handler = new MagicActionModuleThingHandler(thing); return handler; } if (thingTypeUID.equals(THING_TYPE_ONLINE_OFFLINE)) { return new MagicOnlineOfflineHandler(thing); } if (thingTypeUID.equals(THING_TYPE_BRIDGE_1) || thingTypeUID.equals(THING_TYPE_BRIDGE_2)) { return new MagicBridgeHandler((Bridge) thing); } return null; }