Search in sources :

Example 26 with Type

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

the class TestSHCMessage method testWeatherBaroTempMin.

/**
     * test data is: weather barometric pressure: 0 temp: -32768
     */
@Test
public void testWeatherBaroTempMin() {
    String message = " PKT:SID=11;PC=68029;MT=8;MGID=10;MID=3;MD=000040000000;30bd729d";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(0, ((DecimalType) values.get(0)).intValue());
    assertEquals(-32768, ((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 27 with Type

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

the class TestSHCMessage method testGenericVersionMinMax2.

/**
     * test data for the generic messages version: 255.0.255-0
     */
@Test
public void testGenericVersionMinMax2() {
    String message = " PKT:SID=10;PC=165;MT=8;MGID=0;MID=1;MD=FF00FF00000000;a72a6224";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals("Major", 255, ((DecimalType) values.get(0)).intValue());
    assertEquals("Minor", 0, ((DecimalType) values.get(1)).intValue());
    assertEquals("Patch", 255, ((DecimalType) values.get(2)).intValue());
    assertEquals("Hash", 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)

Example 28 with Type

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

the class TestSHCMessage method testEnvDistanceMax.

/**
     * test data is: enviroment distance: 16383 cm (max)
     */
@Test
public void testEnvDistanceMax() {
    String message = " PKT:SID=11;PC=68047;MT=8;MGID=11;MID=2;MD=FFFC00000000;2a1d0241";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(16383, ((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 29 with Type

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

the class TestSHCMessage method testEnvBrightnessMax.

/**
     * test data is: environment brightness: 100 % (max)
     */
@Test
public void testEnvBrightnessMax() {
    String message = " PKT:SID=10;PC=123;MT=8;MGID=11;MID=1;MD=FE0000000006;1739bc80";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(127, ((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 30 with Type

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

the class TestSHCMessage method testDimmerColorAnimationMin.

/**
     * test data is: Dimmer Color Animation: (min)
     */
@Test
public void testDimmerColorAnimationMin() {
    String message = "PKT:SID=12;PC=9417;MT=10;MGID=60;MID=11;MD=0000000000000000000000000000000000;1c733ace";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals("Repeat", 0, ((DecimalType) values.get(0)).intValue());
    assertEquals("AutoReverse", OnOffType.OFF, (values.get(1)));
    assertEquals("Time0", 0, ((DecimalType) values.get(2)).intValue());
    assertEquals("Color0", 0, ((DecimalType) values.get(3)).intValue());
    assertEquals("Time1", 0, ((DecimalType) values.get(4)).intValue());
    assertEquals("Color1", 0, ((DecimalType) values.get(5)).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

Type (org.openhab.core.types.Type)72 DecimalType (org.openhab.core.library.types.DecimalType)69 OnOffType (org.openhab.core.library.types.OnOffType)68 Test (org.junit.Test)60 SHCMessage (org.openhab.binding.smarthomatic.internal.SHCMessage)40 IncreaseDecreaseType (org.openhab.core.library.types.IncreaseDecreaseType)27 StringType (org.openhab.core.library.types.StringType)27 DateTimeType (org.openhab.core.library.types.DateTimeType)26 HSBType (org.openhab.core.library.types.HSBType)26 OpenClosedType (org.openhab.core.library.types.OpenClosedType)26 PercentType (org.openhab.core.library.types.PercentType)26 StopMoveType (org.openhab.core.library.types.StopMoveType)26 UpDownType (org.openhab.core.library.types.UpDownType)26 DPT (tuwien.auto.calimero.dptxlator.DPT)20 Command (org.openhab.core.types.Command)2 UnDefType (org.openhab.core.types.UnDefType)2 Calendar (java.util.Calendar)1 Locale (java.util.Locale)1 StringTokenizer (java.util.StringTokenizer)1 IllegalClassException (org.apache.commons.lang.IllegalClassException)1