use of org.openhab.core.library.types.PercentType in project openhab1-addons by openhab.
the class AbstractDynamoDBItemSerializationTest method testPercentTypeWithColorItem.
@Test
public void testPercentTypeWithColorItem() throws IOException {
DynamoDBItem<?> dbitem = testStateGeneric(new PercentType(new BigDecimal(3.2)), new BigDecimal(3.2));
testAsHistoricGeneric(dbitem, new ColorItem("foo"), new PercentType(new BigDecimal(3.2)));
}
use of org.openhab.core.library.types.PercentType in project openhab1-addons by openhab.
the class AbstractDynamoDBItemSerializationTest method testPercentTypeWithNumberItem.
@Test
public void testPercentTypeWithNumberItem() throws IOException {
DynamoDBItem<?> dbitem = testStateGeneric(new PercentType(new BigDecimal(3.2)), new BigDecimal(3.2));
// note: comes back as DecimalType instead of the original PercentType
testAsHistoricGeneric(dbitem, new NumberItem("foo"), new DecimalType(new BigDecimal(3.2)));
}
use of org.openhab.core.library.types.PercentType in project openhab1-addons by openhab.
the class AbstractDynamoDBItemSerializationTest method testOnOffTypeWithColorItem.
@Test
public void testOnOffTypeWithColorItem() throws IOException {
DynamoDBItem<?> dbitemOff = testStateGeneric(OnOffType.OFF, BigDecimal.ZERO);
testAsHistoricGeneric(dbitemOff, new ColorItem("foo"), new PercentType(BigDecimal.ZERO));
DynamoDBItem<?> dbitemOn = testStateGeneric(OnOffType.ON, BigDecimal.ONE);
testAsHistoricGeneric(dbitemOn, new ColorItem("foo"), new PercentType(BigDecimal.ONE));
}
use of org.openhab.core.library.types.PercentType in project openhab1-addons by openhab.
the class LightwaveRfHeatingInfoResponse method getState.
@Override
public State getState(LightwaveRfType type) {
switch(type) {
case HEATING_BATTERY:
return new DecimalType(getBatteryLevel());
case SIGNAL:
return new DecimalType(getSignal());
case HEATING_CURRENT_TEMP:
return new DecimalType(getCurrentTemperature());
case HEATING_SET_TEMP:
return new DecimalType(getCurrentTargetTemperature());
case HEATING_MODE:
return new StringType(getState());
case HEATING_OUTPUT:
return new PercentType(getOutput());
case UPDATETIME:
Calendar cal = Calendar.getInstance();
cal.setTime(getTime());
return new DateTimeType(cal);
case VERSION:
return new StringType(getVersion());
default:
return null;
}
}
use of org.openhab.core.library.types.PercentType in project openhab1-addons by openhab.
the class OpenhabHSBData method getCommandValue.
@Override
public HSBType getCommandValue() {
DecimalType h = new DecimalType(data.getHue());
PercentType s = new PercentType((int) data.getSaturation());
PercentType b = new PercentType((int) data.getBrightness());
return new HSBType(h, s, b);
}
Aggregations