Search in sources :

Example 11 with NikobusCommand

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());
}
Also used : NikobusCommand(org.openhab.binding.nikobus.internal.core.NikobusCommand) Test(org.junit.Test)

Example 12 with NikobusCommand

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);
}
Also used : Command(org.openhab.core.types.Command) NikobusCommand(org.openhab.binding.nikobus.internal.core.NikobusCommand) NikobusCommand(org.openhab.binding.nikobus.internal.core.NikobusCommand) Test(org.junit.Test)

Example 13 with NikobusCommand

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"));
}
Also used : Command(org.openhab.core.types.Command) NikobusCommand(org.openhab.binding.nikobus.internal.core.NikobusCommand) ArrayList(java.util.ArrayList) NikobusCommand(org.openhab.binding.nikobus.internal.core.NikobusCommand) Test(org.junit.Test)

Aggregations

NikobusCommand (org.openhab.binding.nikobus.internal.core.NikobusCommand)13 Test (org.junit.Test)8 Command (org.openhab.core.types.Command)6 NikobusModule (org.openhab.binding.nikobus.internal.core.NikobusModule)2 PercentType (org.openhab.core.library.types.PercentType)2 ConfigurationException (org.osgi.service.cm.ConfigurationException)2 ArrayList (java.util.ArrayList)1 State (org.openhab.core.types.State)1