use of org.eclipse.smarthome.core.thing.ThingStatusInfo in project smarthome by eclipse.
the class FSInternetRadioHandlerJavaTest method verifyCommunicationError.
private void verifyCommunicationError(String exceptionMessage) {
ArgumentCaptor<ThingStatusInfo> captor = ArgumentCaptor.forClass(ThingStatusInfo.class);
verify(callback, atLeast(1)).statusUpdated(isA(Thing.class), captor.capture());
ThingStatusInfo status = captor.getValue();
assertThat(status.getStatus(), is(ThingStatus.OFFLINE));
assertThat(status.getStatusDetail(), is(ThingStatusDetail.COMMUNICATION_ERROR));
assertThat(status.getDescription().contains(exceptionMessage), is(true));
}
use of org.eclipse.smarthome.core.thing.ThingStatusInfo in project smarthome by eclipse.
the class MagicDimmableLightHandlerTest method initializeShouldCallTheCallback.
@Test
public void initializeShouldCallTheCallback() {
handler.initialize();
ArgumentCaptor<ThingStatusInfo> statusInfoCaptor = ArgumentCaptor.forClass(ThingStatusInfo.class);
verify(callback).statusUpdated(eq(thing), statusInfoCaptor.capture());
ThingStatusInfo thingStatusInfo = statusInfoCaptor.getValue();
Assert.assertThat(thingStatusInfo.getStatus(), is(equalTo(ThingStatus.ONLINE)));
}
use of org.eclipse.smarthome.core.thing.ThingStatusInfo in project smarthome by eclipse.
the class CircuitHandler method onDeviceAdded.
@Override
public void onDeviceAdded(GeneralDeviceInformation device) {
if (device instanceof Circuit) {
this.circuit = (Circuit) device;
if (this.circuit.isPresent()) {
ThingStatusInfo statusInfo = this.dssBridgeHandler.getThing().getStatusInfo();
updateStatus(statusInfo.getStatus(), statusInfo.getStatusDetail(), statusInfo.getDescription());
logger.debug("Set status to {}", getThing().getStatus());
checkCircuitInfoProperties(this.circuit);
// load first channel values
onCircuitStateInitial(this.circuit);
return;
}
}
onDeviceRemoved(device);
}
use of org.eclipse.smarthome.core.thing.ThingStatusInfo in project smarthome by eclipse.
the class DeviceHandler method onDeviceAdded.
@Override
public synchronized void onDeviceAdded(GeneralDeviceInformation device) {
if (device instanceof Device) {
this.device = (Device) device;
if (this.device.isPresent()) {
ThingStatusInfo statusInfo = this.dssBridgeHandler.getThing().getStatusInfo();
updateStatus(statusInfo.getStatus(), statusInfo.getStatusDetail(), statusInfo.getDescription());
logger.debug("Set status to {}", getThing().getStatus());
// load scene configurations persistently into the thing
for (Short i : this.device.getSavedScenes()) {
onSceneConfigAdded(i);
}
logger.debug("Load saved scene specification into device");
this.device.saveConfigSceneSpecificationIntoDevice(getThing().getProperties());
checkDeviceInfoProperties(this.device);
// load sensor priorities into the device and load sensor channels of the thing
if (!this.device.isShade()) {
loadSensorChannels();
// check and load output channel of the thing
checkOutputChannel();
} else if (this.device.isBlind()) {
// load channel for set the angle of jalousie devices
String channelTypeID = DsChannelTypeProvider.getOutputChannelTypeID(((Device) device).getFunctionalColorGroup(), ((Device) device).getOutputMode());
loadOutputChannel(new ChannelTypeUID(BINDING_ID, channelTypeID), DsChannelTypeProvider.getItemType(channelTypeID));
}
// load first channel values
onDeviceStateInitial(this.device);
return;
}
}
onDeviceRemoved(device);
}
use of org.eclipse.smarthome.core.thing.ThingStatusInfo in project smarthome by eclipse.
the class AutomaticInboxProcessorTest method testThingWhenNoRepresentationPropertySet.
@Test
public void testThingWhenNoRepresentationPropertySet() {
inbox.add(DiscoveryResultBuilder.create(THING_UID).withProperty(DEVICE_ID_KEY, DEVICE_ID).build());
List<DiscoveryResult> results = inbox.stream().filter(withFlag(DiscoveryResultFlag.NEW)).collect(Collectors.toList());
assertThat(results.size(), is(1));
assertThat(results.get(0).getThingUID(), is(equalTo(THING_UID)));
when(thing.getProperties()).thenReturn(Collections.emptyMap());
when(thingStatusInfoChangedEvent.getStatusInfo()).thenReturn(new ThingStatusInfo(ThingStatus.ONLINE, ThingStatusDetail.NONE, null));
when(thingStatusInfoChangedEvent.getThingUID()).thenReturn(THING_UID);
inboxAutoIgnore.receive(thingStatusInfoChangedEvent);
results = inbox.stream().filter(withFlag(DiscoveryResultFlag.IGNORED)).collect(Collectors.toList());
assertThat(results.size(), is(0));
}
Aggregations