use of org.eclipse.smarthome.core.thing.Thing in project smarthome by eclipse.
the class ThingManager method unregisterAndDisposeChildHandlers.
private void unregisterAndDisposeChildHandlers(Bridge bridge, ThingHandlerFactory thingHandlerFactory) {
addThingsToBridge(bridge);
for (Thing child : bridge.getThings()) {
ThingHandler handler = child.getHandler();
if (handler != null) {
logger.debug("Unregister and dispose child '{}' of bridge '{}'.", child.getUID(), bridge.getUID());
unregisterAndDisposeHandler(thingHandlerFactory, child, handler);
}
}
}
use of org.eclipse.smarthome.core.thing.Thing in project smarthome by eclipse.
the class ThingRegistryImpl method onRemoveElement.
@Override
protected void onRemoveElement(Thing thing) {
// needed because the removed element was taken from the storage and lost its dynamic state
preserveDynamicState(thing);
ThingUID bridgeUID = thing.getBridgeUID();
if (bridgeUID != null) {
Thing bridge = this.get(bridgeUID);
if (bridge instanceof BridgeImpl) {
((BridgeImpl) bridge).removeThing(thing);
}
}
}
use of org.eclipse.smarthome.core.thing.Thing in project smarthome by eclipse.
the class ThingRegistryImpl method getChannel.
@Override
public Channel getChannel(ChannelUID channelUID) {
ThingUID thingUID = channelUID.getThingUID();
Thing thing = get(thingUID);
if (thing != null) {
return thing.getChannel(channelUID.getId());
}
return null;
}
use of org.eclipse.smarthome.core.thing.Thing in project smarthome by eclipse.
the class ThingConsoleCommandExtension method removeAllThings.
private void removeAllThings(Console console, Collection<Thing> things) {
int numberOfThings = things.size();
for (Thing thing : things) {
managedThingProvider.remove(thing.getUID());
}
console.println(numberOfThings + " things successfully removed.");
}
use of org.eclipse.smarthome.core.thing.Thing in project smarthome by eclipse.
the class ThingConsoleCommandExtension method printThings.
private void printThings(Console console, Collection<Thing> things) {
if (things.isEmpty()) {
console.println("No things found.");
}
for (Thing thing : things) {
String id = thing.getUID().toString();
String thingType = thing instanceof Bridge ? "Bridge" : "Thing";
ThingStatusInfo status = thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing, null);
ThingUID bridgeUID = thing.getBridgeUID();
String label = thing.getLabel();
console.println(String.format("%s (Type=%s, Status=%s, Label=%s, Bridge=%s)", id, thingType, status, label, bridgeUID));
}
}
Aggregations