本文整理汇总了Java中org.eclipse.smarthome.core.thing.Thing.setStatusInfo方法的典型用法代码示例。如果您正苦于以下问题:Java Thing.setStatusInfo方法的具体用法?Java Thing.setStatusInfo怎么用?Java Thing.setStatusInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.smarthome.core.thing.Thing
的用法示例。
在下文中一共展示了Thing.setStatusInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
/**
* Initializes the thing.
*/
@Override
public void initialize() {
if (this.getThing().getThingTypeUID().equals(PL546E_STANDALONE_THING_TYPE)) {
logger.debug("About to initialize thing {}", BindingConstants.DEVICE_PL546E_STANDALONE);
Thing thing = this.getThing();
AvmFritzConfiguration config = this.getConfigAs(AvmFritzConfiguration.class);
this.soloIp = config.getIpAddress();
logger.debug("discovered PL546E initialized: {}", config);
this.refreshInterval = config.getPollingInterval();
this.connection = new FritzahaWebInterface(config, this);
if (config.getPassword() != null) {
this.onUpdate();
} else {
thing.setStatusInfo(new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
"no password set"));
}
}
}
示例2: updateThingFromDevice
import org.eclipse.smarthome.core.thing.Thing; //导入方法依赖的package包/类
/**
* Updates things from device model.
*
* @param thing Thing to be updated.
* @param device Device model with new data.
*/
private void updateThingFromDevice(Thing thing, DeviceModel device) {
if (thing == null || device == null) {
throw new IllegalArgumentException("thing or device is null, cannot perform update");
}
if (device.getPresent() == 1) {
thing.setStatusInfo(new ThingStatusInfo(ThingStatus.ONLINE, ThingStatusDetail.NONE, null));
thing.setProperty(PROPERTY_FIRMWARE_VERSION, device.getFirmwareVersion());
if (device.isTempSensor() && device.getTemperature() != null) {
updateThingChannelState(thing, CHANNEL_TEMP, new DecimalType(device.getTemperature().getCelsius()));
}
if (device.isPowermeter() && device.getPowermeter() != null) {
updateThingChannelState(thing, CHANNEL_ENERGY, new DecimalType(device.getPowermeter().getEnergy()));
updateThingChannelState(thing, CHANNEL_POWER, new DecimalType(device.getPowermeter().getPower()));
}
if (device.isSwitchableOutlet() && device.getSwitch() != null) {
updateThingChannelState(thing, CHANNEL_MODE, new StringType(device.getSwitch().getMode()));
updateThingChannelState(thing, CHANNEL_LOCKED,
BigDecimal.ZERO.equals(device.getSwitch().getLock()) ? OpenClosedType.OPEN
: OpenClosedType.CLOSED);
updateThingChannelState(thing, CHANNEL_DEVICE_LOCKED,
BigDecimal.ZERO.equals(device.getSwitch().getDevicelock()) ? OpenClosedType.OPEN
: OpenClosedType.CLOSED);
if (device.getSwitch().getState() == null) {
updateThingChannelState(thing, CHANNEL_SWITCH, UnDefType.UNDEF);
} else {
updateThingChannelState(thing, CHANNEL_SWITCH,
SwitchModel.ON.equals(device.getSwitch().getState()) ? OnOffType.ON : OnOffType.OFF);
}
}
if (device.isHeatingThermostat() && device.getHkr() != null) {
updateThingChannelState(thing, CHANNEL_MODE, new StringType(device.getHkr().getMode()));
updateThingChannelState(thing, CHANNEL_LOCKED,
BigDecimal.ZERO.equals(device.getHkr().getLock()) ? OpenClosedType.OPEN
: OpenClosedType.CLOSED);
updateThingChannelState(thing, CHANNEL_DEVICE_LOCKED,
BigDecimal.ZERO.equals(device.getHkr().getDevicelock()) ? OpenClosedType.OPEN
: OpenClosedType.CLOSED);
updateThingChannelState(thing, CHANNEL_ACTUALTEMP,
new DecimalType(HeatingModel.toCelsius(device.getHkr().getTist())));
updateThingChannelState(thing, CHANNEL_SETTEMP,
new DecimalType(HeatingModel.toCelsius(device.getHkr().getTsoll())));
updateThingChannelState(thing, CHANNEL_ECOTEMP,
new DecimalType(HeatingModel.toCelsius(device.getHkr().getAbsenk())));
updateThingChannelState(thing, CHANNEL_COMFORTTEMP,
new DecimalType(HeatingModel.toCelsius(device.getHkr().getKomfort())));
updateThingChannelState(thing, CHANNEL_RADIATOR_MODE,
new StringType(device.getHkr().getRadiatorMode()));
if (device.getHkr().getNextchange() != null) {
if (device.getHkr().getNextchange().getEndperiod() == 0) {
updateThingChannelState(thing, CHANNEL_NEXTCHANGE, UnDefType.UNDEF);
} else {
final Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date(device.getHkr().getNextchange().getEndperiod() * 1000L));
updateThingChannelState(thing, CHANNEL_NEXTCHANGE, new DateTimeType(calendar));
}
if (HeatingModel.TEMP_FRITZ_UNDEFINED.equals(device.getHkr().getNextchange().getTchange())) {
updateThingChannelState(thing, CHANNEL_NEXTTEMP, UnDefType.UNDEF);
} else {
updateThingChannelState(thing, CHANNEL_NEXTTEMP,
new DecimalType(HeatingModel.toCelsius(device.getHkr().getNextchange().getTchange())));
}
}
if (device.getHkr().getBatterylow() == null) {
updateThingChannelState(thing, CHANNEL_BATTERY, UnDefType.UNDEF);
} else {
updateThingChannelState(thing, CHANNEL_BATTERY,
HeatingModel.BATTERY_ON.equals(device.getHkr().getBatterylow()) ? OnOffType.ON
: OnOffType.OFF);
}
}
} else {
thing.setStatusInfo(new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "Device not present"));
}
}