Search in sources :

Example 31 with SHCMessage

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

the class TestSHCMessage method testWeatherTempMin.

/**
     * test data is: weather temperature: -32768 = 0x8000 (min)
     */
@Test
public void testWeatherTempMin() {
    String message = " PKT:SID=11;PC=68026;MT=8;MGID=10;MID=1;MD=800000000000;da125fde";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(-32768, ((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 32 with SHCMessage

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

the class TestSHCMessage method testDimmerBrightnessTyp.

/**
     * test data is: Dimmer Brightness: 13 (typ)
     */
@Test
public void testDimmerBrightnessTyp() {
    String message = " PKT:SID=13;PC=301;MT=8;MGID=60;MID=1;MD=1A0000000004;57608c20";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(13, ((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 33 with SHCMessage

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

the class TestSHCMessage method testDimmerColorAnimationMax.

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

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

the class TestSHCMessage method testGPIODigitalPortAllZero.

/**
     * test data is: GPIO DigitalPort: 00000000b
     */
@Test
public void testGPIODigitalPortAllZero() {
    String message = " PKT:SID=150;PC=1688;MT=8;MGID=1;MID=1;MD=000000000004;14f131ec";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(8, values.size());
    for (Type type : values) {
        assertEquals(OnOffType.OFF, type);
    }
}
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 35 with SHCMessage

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

the class TestSHCMessage method testWeatherTempHumMinMax1.

/**
     * test data is: weather temperature & humidity: 102.3 (0x3FF) temperatur:
     * -327.68 (0x8000)
     */
@Test
public void testWeatherTempHumMinMax1() {
    String message = " PKT:SID=10;PC=17531;MT=8;MGID=10;MID=2;MD=FFE000000000;28908fc3";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(1023, ((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)

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