本文整理汇总了Java中org.eclipse.smarthome.core.thing.ThingUID类的典型用法代码示例。如果您正苦于以下问题:Java ThingUID类的具体用法?Java ThingUID怎么用?Java ThingUID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ThingUID类属于org.eclipse.smarthome.core.thing包,在下文中一共展示了ThingUID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createResult
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public DiscoveryResult createResult(RemoteDevice device) {
ThingUID uid = getThingUID(device);
if (uid != null) {
Map<String, Object> properties = new HashMap<>(2);
properties.put(HOST, device.getIdentity().getDescriptorURL().getHost());
properties.put(NAME, device.getDetails().getModelDetails().getModelName());
DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties)
.withLabel(device.getDetails().getFriendlyName()).withRepresentationProperty(PLAYER_TYPE).build();
// Debug
// System.out.println(device.getDetails().getFriendlyName());
// System.out.println(uid.toString());
// System.out.println(device.getDetails().getManufacturerDetails().getManufacturer());
// System.out.println(device.getDetails().getModelDetails().getModelName());
// System.out.println(device.getIdentity().getDescriptorURL().getHost().toString());
// System.out.println(device.getIdentity().getUdn().getIdentifierString());
// System.out.println(device.getType().getType() + "\n");
logger.info("Found HEOS device with UID: {}", uid.getAsString());
return result;
}
return null;
}
示例2: getThingUID
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public ThingUID getThingUID(RemoteDevice device) {
DeviceDetails details = device.getDetails();
if (details != null) {
ModelDetails modelDetails = details.getModelDetails();
ManufacturerDetails modelManufacturerDetails = details.getManufacturerDetails();
if (modelDetails != null && modelManufacturerDetails != null) {
String modelName = modelDetails.getModelName();
String modelManufacturer = modelManufacturerDetails.getManufacturer();
if (modelName != null && modelManufacturer != null) {
if (modelManufacturer.equals("Denon")) {
if (modelName.startsWith("HEOS") || modelName.endsWith("H")) {
if (device.getType().getType().startsWith("ACT")) {
return new ThingUID(THING_TYPE_BRIDGE,
device.getIdentity().getUdn().getIdentifierString());
}
}
}
}
}
}
return null;
}
示例3: getThingUID
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public ThingUID getThingUID(RemoteDevice device) {
if (device != null) {
String manufacturer = device.getDetails().getManufacturerDetails().getManufacturer();
if (manufacturer != null && manufacturer.toLowerCase().contains("loxone")) {
String model = device.getDetails().getModelDetails().getModelName();
if (model != null && model.toLowerCase().contentEquals("loxone miniserver")) {
String serial = device.getDetails().getSerialNumber();
if (serial == null) {
serial = device.getIdentity().getUdn().getIdentifierString();
}
if (serial != null) {
return new ThingUID(LoxoneBindingConstants.THING_TYPE_MINISERVER, serial);
}
}
}
}
return null;
}
开发者ID:ppieczul,项目名称:org.openhab.binding.loxone,代码行数:20,代码来源:LoxoneMiniserverDiscoveryParticipant.java
示例4: detectThing
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
private void detectThing(DatagramPacket packet) throws IOException {
String data = Util
.decrypt(new ByteArrayInputStream(Arrays.copyOfRange(packet.getData(), 0, packet.getLength())), true);
logger.debug("Detecting HS110 by data: {}", data);
String inetAddress = packet.getAddress().getHostAddress();
String id = HS110.parseDeviceId(data);
logger.debug("HS110 with id {} found on {} ", id, inetAddress);
ThingUID thingUID = new ThingUID(HS110BindingConstants.THING_TYPE_HS110, id);
String label = "HS110 at " + inetAddress;
Map<String, Object> properties = new TreeMap<>();
properties.put(HS110BindingConstants.CONFIG_IP, inetAddress);
DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withLabel(label)
.withProperties(properties).build();
thingDiscovered(discoveryResult);
}
示例5: getChannel
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
if (endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID) == null) {
return null;
}
ZclIasZoneCluster cluster = (ZclIasZoneCluster) endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID);
if (cluster == null) {
logger.error("{}: Error opening ias zone cluster", endpoint.getIeeeAddress());
return null;
}
Integer zoneTypeId = cluster.getZoneType(Integer.MAX_VALUE);
ZoneTypeEnum zoneType = ZoneTypeEnum.getByValue(zoneTypeId);
if (zoneType != ZoneTypeEnum.MOTION_SENSOR) {
return null;
}
return createChannel(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_IAS_MOTION_INTRUSION,
ZigBeeBindingConstants.ITEM_TYPE_SWITCH, "Motion Intrusion");
}
示例6: getChannel
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
if (endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID) == null) {
return null;
}
ZclIasZoneCluster cluster = (ZclIasZoneCluster) endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID);
if (cluster == null) {
logger.error("{}: Error opening ias zone cluster", endpoint.getIeeeAddress());
return null;
}
Integer zoneTypeId = cluster.getZoneType(Integer.MAX_VALUE);
ZoneTypeEnum zoneType = ZoneTypeEnum.getByValue(zoneTypeId);
if (zoneType != ZoneTypeEnum.CONTACT_SWITCH) {
return null;
}
return createChannel(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_IAS_CONTACT_PORTAL1,
ZigBeeBindingConstants.ITEM_TYPE_SWITCH, "Contact Portal 1");
}
示例7: getChannel
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
if (endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID) == null) {
return null;
}
ZclIasZoneCluster cluster = (ZclIasZoneCluster) endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID);
if (cluster == null) {
logger.error("{}: Error opening ias zone cluster", endpoint.getIeeeAddress());
return null;
}
Integer zoneTypeId = cluster.getZoneType(Integer.MAX_VALUE);
ZoneTypeEnum zoneType = ZoneTypeEnum.getByValue(zoneTypeId);
if (zoneType != ZoneTypeEnum.MOTION_SENSOR) {
return null;
}
return createChannel(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_IAS_MOTION_PRESENCE,
ZigBeeBindingConstants.ITEM_TYPE_SWITCH, "Motion Presence");
}
示例8: getChannel
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
clusterColorControl = (ZclColorControlCluster) endpoint.getInputCluster(ZclColorControlCluster.CLUSTER_ID);
if (clusterColorControl == null) {
return null;
}
try {
if (!clusterColorControl.discoverAttributes(false).get()) {
logger.warn(
"{}: Cannot determine whether device supports RGB color. Assuming it does by now (checking again later)",
endpoint.getIeeeAddress());
} else if (!clusterColorControl.getSupportedAttributes().contains(ZclColorControlCluster.ATTR_CURRENTHUE)
&& !clusterColorControl.getSupportedAttributes().contains(ZclColorControlCluster.ATTR_CURRENTX)) {
return null;
}
} catch (InterruptedException | ExecutionException e) {
logger.warn(
"{}: Exception checking whether device supports RGB color. Assuming it does by now (checking again later)",
endpoint.getIeeeAddress(), e);
}
return createChannel(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_COLOR_COLOR,
ZigBeeBindingConstants.ITEM_TYPE_COLOR, "Color");
}
示例9: onWMBusMessageReceivedInternal
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
private void onWMBusMessageReceivedInternal(WMBusMessage wmBusDevice) {
// try to find this device in the list of supported devices
ThingUID thingUID = getThingUID(wmBusDevice);
if (thingUID != null) {
// device known -> create discovery result
ThingUID bridgeUID = bridgeHandler.getThing().getUID();
Map<String, Object> properties = new HashMap<>(1);
properties.put(PROPERTY_HKV_ID, wmBusDevice.getSecondaryAddress().getDeviceId().toString());
// TODO label according to uid
DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withProperties(properties)
.withRepresentationProperty(wmBusDevice.getSecondaryAddress().getDeviceId().toString())
.withBridge(bridgeUID)
.withLabel("Techem Heizkostenverteiler #" + wmBusDevice.getSecondaryAddress().getDeviceId())
.build();
thingDiscovered(discoveryResult);
} else {
// device unknown -> log message
logger.debug("discovered unsupported WMBus device of type '{}' with id {}", wmBusDevice.getSecondaryAddress().getDeviceType(), wmBusDevice.getSecondaryAddress().getDeviceId());
}
}
示例10: createThing
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Thing createThing(ThingTypeUID thingTypeUID, Configuration configuration, ThingUID thingUID,
ThingUID bridgeUID) {
logger.trace("Create Thing for Type {}", thingUID.toString());
if (MegaDBindingConstants.THING_TYPE_UID_BRIDGE.equals(thingTypeUID)) {
logger.trace("Create Bride: {}", thingTypeUID);
return super.createThing(thingTypeUID, configuration, thingUID, null);
} else {
if (supportsThingType(thingTypeUID)) {
logger.trace("Create Thing: {}", thingTypeUID);
return super.createThing(thingTypeUID, configuration, thingUID, bridgeUID);
}
}
throw new IllegalArgumentException("The thing type " + thingTypeUID + " is not supported by the binding.");
}
示例11: onDeviceStateChanged
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public void onDeviceStateChanged(ThingUID bridge, BticinoDevice device) {
if (deviceWhereAddress.equals(device.getWhereAddress())) {
updateStatus(ThingStatus.ONLINE);
if (device.isUpdated() || forceRefresh) {
forceRefresh = false;
logger.debug("Updating states of {} ({}) id: {}", device.getType(),
device.getWhereAddress(), getThing().getUID());
switch (device.getType()) {
case VIDEO_CAMERA_ENTRANCE_PANEL:
case INDOOR_CAMERA:
case DOOR_LOCK_ACTUATOR:
break;
default:
logger.debug("Unhandled Device {}.", device.getType());
break;
}
} else
logger.debug("No changes for {} ({}) id: {}", device.getType(),
device.getWhereAddress(), getThing().getUID());
}
}
示例12: createThing
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public Thing createThing(ThingTypeUID thingTypeUID, Configuration configuration, ThingUID thingUID,
ThingUID bridgeUID) {
if (IP_2WIRE_INTERFACE_THING_TYPE.equals(thingTypeUID)) {
ThingUID bticinoBridgeUID = getBridgeThingUID(thingTypeUID, thingUID, configuration);
logger.debug("createThing: {}", bticinoBridgeUID);
return super.createThing(thingTypeUID, configuration, bticinoBridgeUID, null);
}
else if (supportsThingType(thingTypeUID)) {
ThingUID deviceUID = getBtcinoDeviceUID(thingTypeUID, thingUID, configuration, bridgeUID);
logger.debug("createThing: {}", deviceUID);
return super.createThing(thingTypeUID, configuration, deviceUID, bridgeUID);
}
throw new IllegalArgumentException("The thing type " + thingTypeUID + " is not supported by the binding.");
}
示例13: getThingUID
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public ThingUID getThingUID(RemoteDevice device) {
if (device != null) {
if(device.getDetails().getManufacturerDetails().getManufacturer() != null) {
if (device.getDetails().getManufacturerDetails().getManufacturer()
.toUpperCase().contains("SONOS")) {
logger.debug(
"Discovered a Sonos Zone Player thing with UDN '{}'",
device.getIdentity().getUdn().getIdentifierString());
return new ThingUID(ZONEPLAYER_THING_TYPE_UID, device
.getIdentity().getUdn().getIdentifierString());
}
}
}
return null;
}
示例14: submitDiscoveryResults
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
/**
* Submit the discovered Devices to the Smarthome inbox,
*
* @param ip The Device IP
*/
private void submitDiscoveryResults(String ip) {
// uid must not contains dots
ThingUID uid = new ThingUID(THING_TYPE_DEVICE, ip.replace('.', '_') );
if(uid!=null) {
Map<String, Object> properties = new HashMap<>(1);
properties.put(PARAMETER_HOSTNAME ,ip);
DiscoveryResult result = DiscoveryResultBuilder.create(uid)
.withProperties(properties)
.withLabel("Network Device (" + ip +")").build();
thingDiscovered(result);
}
}
示例15: createResult
import org.eclipse.smarthome.core.thing.ThingUID; //导入依赖的package包/类
@Override
public DiscoveryResult createResult(ServiceInfo service) {
final ThingUID uid = getThingUID(service);
if (uid == null) {
return null;
}
final Map<String, Object> properties = new HashMap<>(2);
String host = service.getHostAddresses()[0];
properties.put(ChromecastBindingConstants.HOST, host);
int port = service.getPort();
properties.put(ChromecastBindingConstants.PORT, port);
logger.debug("Chromecast Found: {} {}", host, port);
String friendlyName = service.getPropertyString("fn"); // friendly name;
final DiscoveryResult result = DiscoveryResultBuilder.create(uid).withThingType(getThingType(service))
.withProperties(properties).withLabel(friendlyName).build();
return result;
}