use of org.eclipse.smarthome.core.thing.ThingStatusInfo in project smarthome by eclipse.
the class ThingEventFactory method createStatusInfoEvent.
private Event createStatusInfoEvent(String topic, String payload) throws Exception {
String[] topicElements = getTopicElements(topic);
if (topicElements.length != 4) {
throw new IllegalArgumentException("ThingStatusInfoEvent creation failed, invalid topic: " + topic);
}
ThingUID thingUID = new ThingUID(topicElements[2]);
ThingStatusInfo thingStatusInfo = deserializePayload(payload, ThingStatusInfo.class);
return new ThingStatusInfoEvent(topic, payload, thingUID, thingStatusInfo);
}
use of org.eclipse.smarthome.core.thing.ThingStatusInfo in project smarthome by eclipse.
the class ThingEventFactory method createStatusInfoChangedEvent.
private Event createStatusInfoChangedEvent(String topic, String payload) throws Exception {
String[] topicElements = getTopicElements(topic);
if (topicElements.length != 4) {
throw new IllegalArgumentException("ThingStatusInfoChangedEvent creation failed, invalid topic: " + topic);
}
ThingUID thingUID = new ThingUID(topicElements[2]);
ThingStatusInfo[] thingStatusInfo = deserializePayload(payload, ThingStatusInfo[].class);
return new ThingStatusInfoChangedEvent(topic, payload, thingUID, thingStatusInfo[0], thingStatusInfo[1]);
}
use of org.eclipse.smarthome.core.thing.ThingStatusInfo in project smarthome by eclipse.
the class SceneHandler method onSceneAdded.
@Override
public void onSceneAdded(InternalScene scene) {
logger.debug("Scene {} added", scene.getID());
if (this.bridgeHandler != null) {
ThingStatusInfo statusInfo = this.bridgeHandler.getThing().getStatusInfo();
updateStatus(statusInfo.getStatus(), statusInfo.getStatusDetail(), statusInfo.getDescription());
logger.debug("Set status on {}", getThing().getStatus());
}
this.scene = scene;
onSceneStateChanged(scene.isActive());
}
use of org.eclipse.smarthome.core.thing.ThingStatusInfo in project smarthome by eclipse.
the class MagicColorLightHandlerTest 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 MagicOnOffLightHandlerTest 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)));
}
Aggregations