use of org.openhab.binding.myq.internal.handler.MyQAccountHandler in project openhab-addons by openhab.
the class MyQDiscoveryService method startScan.
@Override
public void startScan() {
MyQAccountHandler accountHandler = this.accountHandler;
if (accountHandler != null) {
List<DeviceDTO> devices = accountHandler.devicesCache();
if (devices != null) {
devices.forEach(device -> {
ThingTypeUID thingTypeUID = new ThingTypeUID(BINDING_ID, device.deviceFamily);
if (SUPPORTED_DISCOVERY_THING_TYPES_UIDS.contains(thingTypeUID)) {
ThingUID thingUID = new ThingUID(thingTypeUID, accountHandler.getThing().getUID(), device.serialNumber.toLowerCase());
DiscoveryResult result = DiscoveryResultBuilder.create(thingUID).withLabel("MyQ " + device.name).withProperty(Thing.PROPERTY_SERIAL_NUMBER, thingUID.getId()).withRepresentationProperty(Thing.PROPERTY_SERIAL_NUMBER).withBridge(accountHandler.getThing().getUID()).build();
thingDiscovered(result);
}
});
}
}
}
Aggregations