use of org.eclipse.smarthome.core.thing.ThingTypeUID in project smarthome by eclipse.
the class LIRCHandlerFactory method createHandler.
@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;
}
use of org.eclipse.smarthome.core.thing.ThingTypeUID in project smarthome by eclipse.
the class SonosHandlerFactory method createHandler.
@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);
// 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;
}
use of org.eclipse.smarthome.core.thing.ThingTypeUID in project smarthome by eclipse.
the class TradfriHandlerFactory method createHandler.
@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);
}
return null;
}
use of org.eclipse.smarthome.core.thing.ThingTypeUID in project smarthome by eclipse.
the class DiscoveryConsoleCommandExtension method execute.
@Override
public void execute(String[] args, Console console) {
if (args.length > 0) {
String subCommand = args[0];
switch(subCommand) {
case SUBCMD_START:
if (args.length > 1) {
String arg1 = args[1];
if (arg1.contains(":")) {
ThingTypeUID thingTypeUID = new ThingTypeUID(arg1);
runDiscoveryForThingType(console, thingTypeUID);
} else {
runDiscoveryForBinding(console, arg1);
}
} else {
console.println("Specify thing type id or binding id to discover: discovery " + "start <thingTypeUID|bindingID> (e.g. \"hue:bridge\" or \"hue\")");
}
return;
case SUBCMD_BACKGROUND_DISCOVERY_ENABLE:
if (args.length > 1) {
String discoveryServiceName = args[1];
configureBackgroundDiscovery(console, discoveryServiceName, true);
} else {
console.println("Specify discovery service PID to configure background discovery: discovery " + "enableBackgroundDiscovery <PID> (e.g. \"hue.discovery\")");
}
return;
case SUBCMD_BACKGROUND_DISCOVERY_DISABLE:
if (args.length > 1) {
String discoveryServiceName = args[1];
configureBackgroundDiscovery(console, discoveryServiceName, false);
} else {
console.println("Specify discovery service PID to configure background discovery: discovery " + "disableBackgroundDiscovery <PID> (e.g. \"hue.discovery\")");
}
return;
default:
break;
}
} else {
console.println(getUsages().get(0));
}
}
use of org.eclipse.smarthome.core.thing.ThingTypeUID in project smarthome by eclipse.
the class InboxConsoleCommandExtension method printInboxEntries.
private void printInboxEntries(Console console, List<DiscoveryResult> discoveryResults) {
if (discoveryResults.isEmpty()) {
console.println("No inbox entries found.");
}
for (DiscoveryResult discoveryResult : discoveryResults) {
ThingTypeUID thingTypeUID = discoveryResult.getThingTypeUID();
ThingUID thingUID = discoveryResult.getThingUID();
String label = discoveryResult.getLabel();
DiscoveryResultFlag flag = discoveryResult.getFlag();
ThingUID bridgeId = discoveryResult.getBridgeUID();
Map<String, Object> properties = discoveryResult.getProperties();
String representationProperty = discoveryResult.getRepresentationProperty();
String timestamp = new Date(discoveryResult.getTimestamp()).toString();
String timeToLive = discoveryResult.getTimeToLive() == DiscoveryResult.TTL_UNLIMITED ? "UNLIMITED" : "" + discoveryResult.getTimeToLive();
console.println(String.format("%s [%s]: %s [thingId=%s, bridgeId=%s, properties=%s, representationProperty=%s, timestamp=%s, timeToLive=%s]", flag.name(), thingTypeUID, label, thingUID, bridgeId, properties, representationProperty, timestamp, timeToLive));
}
}
Aggregations