Search in sources :

Example 11 with SHCMessage

use of org.openhab.binding.smarthomatic.internal.SHCMessage 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 12 with SHCMessage

use of org.openhab.binding.smarthomatic.internal.SHCMessage 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 13 with SHCMessage

use of org.openhab.binding.smarthomatic.internal.SHCMessage 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 14 with SHCMessage

use of org.openhab.binding.smarthomatic.internal.SHCMessage 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)

Example 15 with SHCMessage

use of org.openhab.binding.smarthomatic.internal.SHCMessage in project openhab1-addons by openhab.

the class TestSHCMessage method testGenericBattTyp.

/**
     * test data for the generic messages battery: 66 %
     */
@Test
public void testGenericBattTyp() {
    String message = " PKT:SID=10;PC=164;MT=8;MGID=0;MID=5;MD=840000000004;9f44b737";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(66, ((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)

Aggregations

Test (org.junit.Test)40 SHCMessage (org.openhab.binding.smarthomatic.internal.SHCMessage)40 DecimalType (org.openhab.core.library.types.DecimalType)40 OnOffType (org.openhab.core.library.types.OnOffType)40 Type (org.openhab.core.types.Type)40