Search in sources :

Example 16 with SHCMessage

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

the class TestSHCMessage method testWeatherBaroTempTyp.

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

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

the class TestSHCMessage method testWeatherTempTyp.

/**
     * test data is: weather temperature: 22.10
     */
@Test
public void testWeatherTempTyp() {
    String message = " PKT:SID=11;PC=68026;MT=8;MGID=10;MID=1;MD=08a200000000;3bd82894";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(2210, ((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 18 with SHCMessage

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

the class TestSHCMessage method testGPIOAnalogPortAllZero.

/**
     * test data is: GPIO AnalogPort:
     * 00000000000000000000000000000000000000000000
     */
@Test
public void testGPIOAnalogPortAllZero() {
    String message = " PKT:SID=11;PC=2238;MT=8;MGID=1;MID=10;MD=00000000000000000000000000000000000000000000;055a1dca";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(16, values.size());
    for (int i = 0; i < values.size(); i += 2) {
        assertEquals(OnOffType.OFF, values.get(i));
        assertEquals(0, ((DecimalType) values.get(i + 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 19 with SHCMessage

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

the class TestSHCMessage method testDimmerBrightnessMax.

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

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

the class TestSHCMessage method testDimmerBrightnessMin.

/**
     * test data is: Dimmer Brightness: 0 (min)
     */
@Test
public void testDimmerBrightnessMin() {
    String message = " PKT:SID=13;PC=301;MT=8;MGID=60;MID=1;MD=000000000004;3519983e";
    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)

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