Search in sources :

Example 1 with NumberWithUnit

use of org.opencean.core.common.values.NumberWithUnit in project openhab1-addons by openhab.

the class TemperatureSensorTest method testReceiveTempertureUpdate.

@Test
public void testReceiveTempertureUpdate() {
    parameterAddress = new EnoceanParameterAddress(EnoceanId.fromString(EnoceanBindingProviderMock.DEVICE_ID), Parameter.TEMPERATURE);
    provider.setParameterAddress(parameterAddress);
    binding.addBindingProvider(provider);
    provider.setItem(new NumberItem("dummie"));
    BigDecimal temperature = new BigDecimal("20.3");
    binding.valueChanged(parameterAddress, new NumberWithUnit(Unit.DEGREE_CELSIUS, temperature));
    assertEquals("Update State", new DecimalType(temperature), publisher.getUpdateState());
}
Also used : NumberItem(org.openhab.core.library.items.NumberItem) NumberWithUnit(org.opencean.core.common.values.NumberWithUnit) EnoceanParameterAddress(org.opencean.core.address.EnoceanParameterAddress) DecimalType(org.openhab.core.library.types.DecimalType) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

BigDecimal (java.math.BigDecimal)1 Test (org.junit.Test)1 EnoceanParameterAddress (org.opencean.core.address.EnoceanParameterAddress)1 NumberWithUnit (org.opencean.core.common.values.NumberWithUnit)1 NumberItem (org.openhab.core.library.items.NumberItem)1 DecimalType (org.openhab.core.library.types.DecimalType)1