use of org.openhab.binding.smarthomatic.internal.SHCMessage in project openhab1-addons by openhab.
the class TestSHCMessage method testDimmerColorMax.
/**
* test data is: Dimmer Color: 63 (max)
*/
@Test
public void testDimmerColorMax() {
String message = " PKT:SID=12;PC=203;MT=8;MGID=60;MID=10;MD=FC0000000003;cc022ece";
SHCMessage shcMessage = new SHCMessage(message, packet);
List<Type> values = shcMessage.getData().getOpenHABTypes();
assertEquals(63, ((DecimalType) values.get(0)).intValue());
}
use of org.openhab.binding.smarthomatic.internal.SHCMessage in project openhab1-addons by openhab.
the class TestSHCMessage method testGenericBattMax.
/**
* test data for the generic messages battery: 127
*/
@Test
public void testGenericBattMax() {
String message = " PKT:SID=10;PC=164;MT=8;MGID=0;MID=5;MD=FE0000000004;60b90a98";
SHCMessage shcMessage = new SHCMessage(message, packet);
List<Type> values = shcMessage.getData().getOpenHABTypes();
assertEquals(127, ((DecimalType) values.get(0)).intValue());
}
use of org.openhab.binding.smarthomatic.internal.SHCMessage in project openhab1-addons by openhab.
the class TestSHCMessage method testGPIODigitalPortAllMixed.
/**
* test data is: GPIO DigitalPort: 10100101b
*/
@Test
public void testGPIODigitalPortAllMixed() {
String message = " PKT:SID=150;PC=1688;MT=8;MGID=1;MID=1;MD=a50000000004;584ea808";
SHCMessage shcMessage = new SHCMessage(message, packet);
List<Type> values = shcMessage.getData().getOpenHABTypes();
assertEquals(8, values.size());
assertEquals(OnOffType.ON, values.get(0));
assertEquals(OnOffType.OFF, values.get(1));
assertEquals(OnOffType.ON, values.get(2));
assertEquals(OnOffType.OFF, values.get(3));
assertEquals(OnOffType.OFF, values.get(4));
assertEquals(OnOffType.ON, values.get(5));
assertEquals(OnOffType.OFF, values.get(6));
assertEquals(OnOffType.ON, values.get(7));
}
use of org.openhab.binding.smarthomatic.internal.SHCMessage in project openhab1-addons by openhab.
the class TestSHCMessage method testGenericVersionMinMax1.
/**
* test data for the generic messages version: 0.255.0-255 TODO: Hash
* parsing isn't working with the max hast value of 4294967295
*/
@Test
public void testGenericVersionMinMax1() {
String message = " PKT:SID=10;PC=165;MT=8;MGID=0;MID=1;MD=00FF00000000FF;849eb439";
SHCMessage shcMessage = new SHCMessage(message, packet);
List<Type> values = shcMessage.getData().getOpenHABTypes();
assertEquals("Major", 0, ((DecimalType) values.get(0)).intValue());
assertEquals("Minor", 255, ((DecimalType) values.get(1)).intValue());
assertEquals("Patch", 0, ((DecimalType) values.get(2)).intValue());
assertEquals("Hash", 255, ((DecimalType) values.get(3)).intValue());
}
use of org.openhab.binding.smarthomatic.internal.SHCMessage in project openhab1-addons by openhab.
the class TestSHCMessage method testGPIODigitalPortAllOn.
/**
* test data is: GPIO DigitalPort: 11111111b
*/
@Test
public void testGPIODigitalPortAllOn() {
String message = " PKT:SID=150;PC=1688;MT=8;MGID=1;MID=1;MD=ff0000000004;6ed826ac";
SHCMessage shcMessage = new SHCMessage(message, packet);
List<Type> values = shcMessage.getData().getOpenHABTypes();
assertEquals(8, values.size());
for (Type type : values) {
assertEquals(OnOffType.ON, type);
}
}
Aggregations