Search in sources :

Example 81 with DecimalType

use of org.openhab.core.library.types.DecimalType in project openhab1-addons by openhab.

the class TestSHCMessage method testWeatherBaroTempMax.

/**
     * test data is: weather barometric pressure: 131071 temp: 32767
     */
@Test
public void testWeatherBaroTempMax() {
    String message = " PKT:SID=11;PC=68029;MT=8;MGID=10;MID=3;MD=FFFFBFFFFFFF;a6819187";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(131071, ((DecimalType) values.get(0)).intValue());
    assertEquals(32767, ((DecimalType) values.get(1)).intValue());
}
Also used : Type(org.openhab.core.types.Type) OnOffType(org.openhab.core.library.types.OnOffType) DecimalType(org.openhab.core.library.types.DecimalType) SHCMessage(org.openhab.binding.smarthomatic.internal.SHCMessage) Test(org.junit.Test)

Example 82 with DecimalType

use of org.openhab.core.library.types.DecimalType in project openhab1-addons by openhab.

the class TestSHCMessage method testDimmerColorMin.

/**
     * test data is: Dimmer Color: 0 (min)
     */
@Test
public void testDimmerColorMin() {
    String message = " PKT:SID=12;PC=203;MT=8;MGID=60;MID=10;MD=000000000003;85c7de93";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(0, ((DecimalType) values.get(0)).intValue());
}
Also used : Type(org.openhab.core.types.Type) OnOffType(org.openhab.core.library.types.OnOffType) DecimalType(org.openhab.core.library.types.DecimalType) SHCMessage(org.openhab.binding.smarthomatic.internal.SHCMessage) Test(org.junit.Test)

Example 83 with DecimalType

use of org.openhab.core.library.types.DecimalType in project openhab1-addons by openhab.

the class TestSHCMessage method testEnvDistanceTyp.

/**
     * test data is: environment distance: 117 cm (typ)
     */
@Test
public void testEnvDistanceTyp() {
    String message = " PKT:SID=11;PC=68047;MT=8;MGID=11;MID=2;MD=01d400000000;aabb6194";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(117, ((DecimalType) values.get(0)).intValue());
}
Also used : Type(org.openhab.core.types.Type) OnOffType(org.openhab.core.library.types.OnOffType) DecimalType(org.openhab.core.library.types.DecimalType) SHCMessage(org.openhab.binding.smarthomatic.internal.SHCMessage) Test(org.junit.Test)

Example 84 with DecimalType

use of org.openhab.core.library.types.DecimalType in project openhab1-addons by openhab.

the class TestSHCMessage method testEnvDistanceMin.

/**
     * test data is: enviroment distance: 0 cm (min)
     */
@Test
public void testEnvDistanceMin() {
    String message = " PKT:SID=11;PC=68047;MT=8;MGID=11;MID=2;MD=000000000000;f0922327";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(0, ((DecimalType) values.get(0)).intValue());
}
Also used : Type(org.openhab.core.types.Type) OnOffType(org.openhab.core.library.types.OnOffType) DecimalType(org.openhab.core.library.types.DecimalType) SHCMessage(org.openhab.binding.smarthomatic.internal.SHCMessage) Test(org.junit.Test)

Example 85 with DecimalType

use of org.openhab.core.library.types.DecimalType in project openhab1-addons by openhab.

the class TestSHCMessage method testDimmerAnimationMin.

/**
     * test data is: Dimmer Animation: 0 (min)
     */
@Test
public void testDimmerAnimationMin() {
    String message = " PKT:SID=13;PC=534;MT=10;MGID=60;MID=2;MD=0000000000000000000000000000000000;8e4c4091";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals("AnimationMode", 0, ((DecimalType) values.get(0)).intValue());
    assertEquals("TimeoutSec", 0, ((DecimalType) values.get(1)).intValue());
    assertEquals("StartBrightness", 0, ((DecimalType) values.get(2)).intValue());
    assertEquals("EndBrightness", 0, ((DecimalType) values.get(3)).intValue());
}
Also used : Type(org.openhab.core.types.Type) OnOffType(org.openhab.core.library.types.OnOffType) DecimalType(org.openhab.core.library.types.DecimalType) SHCMessage(org.openhab.binding.smarthomatic.internal.SHCMessage) Test(org.junit.Test)

Aggregations

DecimalType (org.openhab.core.library.types.DecimalType)222 Test (org.junit.Test)70 StringType (org.openhab.core.library.types.StringType)69 OnOffType (org.openhab.core.library.types.OnOffType)63 PercentType (org.openhab.core.library.types.PercentType)43 State (org.openhab.core.types.State)40 Type (org.openhab.core.types.Type)39 NumberItem (org.openhab.core.library.items.NumberItem)38 SHCMessage (org.openhab.binding.smarthomatic.internal.SHCMessage)37 DateTimeType (org.openhab.core.library.types.DateTimeType)29 BigDecimal (java.math.BigDecimal)23 Calendar (java.util.Calendar)23 HSBType (org.openhab.core.library.types.HSBType)20 SwitchItem (org.openhab.core.library.items.SwitchItem)18 IOException (java.io.IOException)16 StringItem (org.openhab.core.library.items.StringItem)16 ConfigurationException (org.osgi.service.cm.ConfigurationException)16 RollershutterItem (org.openhab.core.library.items.RollershutterItem)15 ContactItem (org.openhab.core.library.items.ContactItem)14 DimmerItem (org.openhab.core.library.items.DimmerItem)14