Search in sources :

Example 36 with SHCMessage

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

the class TestSHCMessage method testEnvBrightnessTyp.

/**
     * test data is: environment brightness: 37 % (typ)
     */
@Test
public void testEnvBrightnessTyp() {
    String message = " PKT:SID=10;PC=123;MT=8;MGID=11;MID=1;MD=4a0000000006;d6a695c8";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(37, ((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 37 with SHCMessage

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

the class TestSHCMessage method testGenericVersionMin.

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

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

the class TestSHCMessage method testWeatherTempHumTyp.

/**
     * test data is: weather temperature & humidity: hum: 53.4 temperatur: 22.40
     */
@Test
public void testWeatherTempHumTyp() {
    String message = " PKT:SID=10;PC=17531;MT=8;MGID=10;MID=2;MD=858230000000;33985fff";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(534, ((DecimalType) values.get(0)).intValue());
    assertEquals(2240, ((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 39 with SHCMessage

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

the class TestSHCMessage method testGPIOAnalogPortAllMax.

/**
     * test data is: GPIO AnalogPort:
     * FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
     */
@Test
public void testGPIOAnalogPortAllMax() {
    String message = " PKT:SID=11;PC=2238;MT=8;MGID=1;MID=10;MD=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;bceeea75";
    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.ON, values.get(i));
        assertEquals(2047, ((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 40 with SHCMessage

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

the class TestSHCMessage method testGenericBattMin.

/**
     * test data for the generic messages battery: 0 %
     */
@Test
public void testGenericBattMin() {
    String message = " PKT:SID=10;PC=164;MT=8;MGID=0;MID=5;MD=000000000004;c6415f25";
    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