Search in sources :

Example 1 with SHCMessage

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

the class TestSHCMessage method testWeatherTempHumMinMax2.

/**
     * test data is: weather temperature & humidity: 0 (0x000) temperatur: 32767
     * (0x7FFF)
     */
@Test
public void testWeatherTempHumMinMax2() {
    String message = " PKT:SID=10;PC=17531;MT=8;MGID=10;MID=2;MD=001FFFC00000;785c34de";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(0, ((DecimalType) values.get(0)).intValue());
    assertEquals(32767, ((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 2 with SHCMessage

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

the class TestSHCMessage method testWeatherTempMax.

/**
     * test data is: weather temperature: 32767 = 0x7FFF (max)
     */
@Test
public void testWeatherTempMax() {
    String message = " PKT:SID=11;PC=68026;MT=8;MGID=10;MID=1;MD=7FFF00000000;dbd5c390";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals(32767, ((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 3 with SHCMessage

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

the class TestSHCMessage method testDimmerAnimationTyp.

/**
     * test data is: Dimmer Animation: 13 (typ)
     */
@Test
public void testDimmerAnimationTyp() {
    String message = " PKT:SID=13;PC=534;MT=10;MGID=60;MID=2;MD=40f4006000000000000000000000000000;5817ba52";
    SHCMessage shcMessage = new SHCMessage(message, packet);
    List<Type> values = shcMessage.getData().getOpenHABTypes();
    assertEquals("AnimationMode", 1, ((DecimalType) values.get(0)).intValue());
    assertEquals("TimeoutSec", 976, ((DecimalType) values.get(1)).intValue());
    assertEquals("StartBrightness", 0, ((DecimalType) values.get(2)).intValue());
    assertEquals("EndBrightness", 96, ((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 4 with SHCMessage

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

the class TestSHCMessage method testWeatherBaroTempMax.

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

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

the class TestSHCMessage method testDimmerColorMin.

/**
     * test data is: Dimmer Color: 0 (min)
     */
@Test
public void testDimmerColorMin() {
    String message = " PKT:SID=12;PC=203;MT=8;MGID=60;MID=10;MD=000000000003;85c7de93";
    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