use of org.openhab.binding.nikobus.internal.core.NikobusCommand in project openhab1-addons by openhab.
the class ModuleChannelGroupTest method canRequestGroup1Status.
@Test
public void canRequestGroup1Status() throws Exception {
NikobusCommand cmd = group1.getStatusRequestCommand();
assertEquals("$10126C946CE5A0", cmd.getCommand());
assertEquals("$1C6C94", cmd.getAck());
}
use of org.openhab.binding.nikobus.internal.core.NikobusCommand in project openhab1-addons by openhab.
the class ModuleChannelGroupTest method canProcessGroup2StatusUpdate.
@Test
public void canProcessGroup2StatusUpdate() {
ModuleChannel item = group2.addChannel("test11", 11, new ArrayList<Class<? extends Command>>());
item.setState(OnOffType.OFF);
group2.processNikobusCommand(new NikobusCommand("$0517"), binding);
group2.processNikobusCommand(new NikobusCommand("$1C6C940000000000FF00557CF8"), binding);
Mockito.verify(binding, Mockito.times(1)).postUpdate("test11", OnOffType.ON);
group2.processNikobusCommand(new NikobusCommand("$0517"), binding);
group2.processNikobusCommand(new NikobusCommand("$1C6C9400000000FF00FF557CF8"), binding);
Mockito.verify(binding, Mockito.times(1)).postUpdate("test11", OnOffType.OFF);
}
use of org.openhab.binding.nikobus.internal.core.NikobusCommand in project openhab1-addons by openhab.
the class ModuleChannelGroupTest method canProcessGroup1StatusUpdateDimmer.
@Test
public void canProcessGroup1StatusUpdateDimmer() {
List<Class<? extends Command>> acceptedCommands = new ArrayList<Class<? extends Command>>();
acceptedCommands.add(PercentType.class);
ModuleChannel item = group3.addChannel("test2", 1, acceptedCommands);
item.setState(OnOffType.OFF);
group3.processNikobusCommand(new NikobusCommand("$0512"), binding);
group3.processNikobusCommand(new NikobusCommand("$1C5FCB03400000000000E36D38"), binding);
Mockito.verify(binding, Mockito.times(1)).postUpdate("test2", PercentType.valueOf("26"));
group3.processNikobusCommand(new NikobusCommand("$0512"), binding);
group3.processNikobusCommand(new NikobusCommand("$1C5FCB037F000000000009E2C0"), binding);
Mockito.verify(binding, Mockito.times(1)).postUpdate("test2", PercentType.valueOf("50"));
group3.processNikobusCommand(new NikobusCommand("$0512"), binding);
group3.processNikobusCommand(new NikobusCommand("$1C5FCB03D90000000000652B76"), binding);
Mockito.verify(binding, Mockito.times(1)).postUpdate("test2", PercentType.valueOf("86"));
group3.processNikobusCommand(new NikobusCommand("$0512"), binding);
group3.processNikobusCommand(new NikobusCommand("$1C5FCB03A70000000000A0143B"), binding);
Mockito.verify(binding, Mockito.times(1)).postUpdate("test2", PercentType.valueOf("66"));
}
Aggregations