use of org.eclipse.smarthome.core.thing.ThingUID in project smarthome by eclipse.
the class ThingBuilderTest method testWithChannel_wrongThing.
@Test(expected = IllegalArgumentException.class)
public void testWithChannel_wrongThing() {
ThingBuilder thingBuilder = ThingBuilder.create(THING_TYPE_UID, THING_UID);
thingBuilder.withChannel(ChannelBuilder.create(new ChannelUID(new ThingUID(THING_TYPE_UID, "wrong"), "channel1"), "").build());
}
use of org.eclipse.smarthome.core.thing.ThingUID in project smarthome by eclipse.
the class BridgeMDNSDiscoveryParticipant method createResult.
@Override
public DiscoveryResult createResult(ServiceInfo service) {
if (service.getApplication().contains("dssweb")) {
ThingUID uid = getThingUID(service);
if (uid != null) {
String hostAddress = service.getName() + "." + service.getDomain() + ".";
Map<String, Object> properties = new HashMap<>(2);
properties.put(DigitalSTROMBindingConstants.HOST, hostAddress);
return DiscoveryResultBuilder.create(uid).withProperties(properties).withRepresentationProperty(uid.getId()).withLabel("digitalSTROM-Server").build();
}
}
return null;
}
use of org.eclipse.smarthome.core.thing.ThingUID in project smarthome by eclipse.
the class ZoneTemperatureControlDiscoveryService method internalConfigChanged.
private void internalConfigChanged(TemperatureControlStatus tempControlStatus) {
if (tempControlStatus == null) {
return;
}
if (tempControlStatus.getIsConfigured()) {
logger.debug("found configured zone TemperatureControlStatus = {}", tempControlStatus);
ThingUID thingUID = getThingUID(tempControlStatus);
if (thingUID != null) {
Map<String, Object> properties = new HashMap<>();
properties.put(DigitalSTROMBindingConstants.ZONE_ID, tempControlStatus.getZoneID());
String zoneName = tempControlStatus.getZoneName();
if (StringUtils.isBlank(zoneName)) {
zoneName = tempControlStatus.getZoneID().toString();
}
DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withProperties(properties).withBridge(bridgeUID).withLabel(zoneName).build();
thingDiscovered(discoveryResult);
}
}
}
use of org.eclipse.smarthome.core.thing.ThingUID in project smarthome by eclipse.
the class LifxLightDiscovery method createDiscoveryResult.
private DiscoveryResult createDiscoveryResult(DiscoveredLight light) throws IllegalArgumentException {
Products product = light.product;
if (product == null) {
throw new IllegalArgumentException("Product of discovered light is null");
}
String macAsLabel = light.macAddress.getAsLabel();
ThingUID thingUID = new ThingUID(product.getThingTypeUID(), macAsLabel);
String label = light.label;
if (StringUtils.isBlank(label)) {
label = product.getName();
}
logger.trace("Discovered a LIFX light: {}", label);
DiscoveryResultBuilder builder = DiscoveryResultBuilder.create(thingUID);
builder.withRepresentationProperty(LifxBindingConstants.PROPERTY_MAC_ADDRESS);
builder.withLabel(label);
builder.withProperty(LifxBindingConstants.CONFIG_PROPERTY_DEVICE_ID, macAsLabel);
builder.withProperty(LifxBindingConstants.PROPERTY_MAC_ADDRESS, macAsLabel);
builder.withProperty(LifxBindingConstants.PROPERTY_PRODUCT_ID, product.getProduct());
builder.withProperty(LifxBindingConstants.PROPERTY_PRODUCT_NAME, product.getName());
builder.withProperty(LifxBindingConstants.PROPERTY_PRODUCT_VERSION, light.productVersion);
builder.withProperty(LifxBindingConstants.PROPERTY_VENDOR_ID, product.getVendor());
builder.withProperty(LifxBindingConstants.PROPERTY_VENDOR_NAME, product.getVendorName());
return builder.build();
}
use of org.eclipse.smarthome.core.thing.ThingUID in project smarthome by eclipse.
the class NtpDiscovery method discoverNtp.
/**
* Add a ntp Thing for the local time in the discovery inbox
*/
private void discoverNtp() {
Map<String, Object> properties = new HashMap<>(4);
properties.put(PROPERTY_TIMEZONE, TimeZone.getDefault().getID());
ThingUID uid = new ThingUID(THING_TYPE_NTP, "local");
DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties).withLabel("Local Time").build();
thingDiscovered(result);
}
Aggregations