Search in sources :

Example 1 with LightwaveRfSetHeatingTemperatureCommand

use of org.openhab.binding.lightwaverf.internal.command.LightwaveRfSetHeatingTemperatureCommand in project openhab1-addons by openhab.

the class LightwaverfConvertorTest method testConvertToLightwaveRfMessageSetTempCommand.

@Test
public void testConvertToLightwaveRfMessageSetTempCommand() throws Exception {
    LightwaverfConvertor convertor = new LightwaverfConvertor();
    LightwaveRFCommand command = convertor.convertToLightwaveRfMessage("2", null, LightwaveRfType.HEATING_SET_TEMP, new DecimalType(21.5));
    LightwaveRFCommand expected = new LightwaveRfSetHeatingTemperatureCommand("200,!R2DhF*tP21.5");
    assertEquals(expected.getLightwaveRfCommandString(), command.getLightwaveRfCommandString());
}
Also used : LightwaveRfSetHeatingTemperatureCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRfSetHeatingTemperatureCommand) DecimalType(org.openhab.core.library.types.DecimalType) LightwaveRFCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRFCommand) Test(org.junit.Test)

Example 2 with LightwaveRfSetHeatingTemperatureCommand

use of org.openhab.binding.lightwaverf.internal.command.LightwaveRfSetHeatingTemperatureCommand in project openhab1-addons by openhab.

the class LightwaveRFSenderThreadTest method test.

@Test
public void test() throws Exception {
    LightwaveRfSetHeatingTemperatureCommand tempCommand = new LightwaveRfSetHeatingTemperatureCommand("768,!R3DhF*tP18.0");
    final LightwaveRfCommandOk okCommand = new LightwaveRfCommandOk("768,OK");
    final LightwaveRFSenderThread senderThread = new LightwaveRFSenderThread(mockSocket, "192.168.1.1", 8000, 120000);
    executor.schedule(new Runnable() {

        @Override
        public void run() {
            senderThread.okMessageReceived(okCommand);
        }
    }, 1000, TimeUnit.MILLISECONDS);
    senderThread.sendLightwaveCommand(tempCommand);
    senderThread.run();
    verify(mockSocket, times(1)).send(any(DatagramPacket.class));
}
Also used : LightwaveRfSetHeatingTemperatureCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRfSetHeatingTemperatureCommand) DatagramPacket(java.net.DatagramPacket) LightwaveRfCommandOk(org.openhab.binding.lightwaverf.internal.command.LightwaveRfCommandOk) Test(org.junit.Test)

Example 3 with LightwaveRfSetHeatingTemperatureCommand

use of org.openhab.binding.lightwaverf.internal.command.LightwaveRfSetHeatingTemperatureCommand in project openhab1-addons by openhab.

the class LightwaveRfWifiLinkTest method testSetHeating.

@Test
@Ignore(value = "This is a functional test to ensure the code is working")
public void testSetHeating() throws Exception {
    LightwaveRfWifiLink wifiLink = new LightwaveRfWifiLink(LIGHTWAVE_IP, TRANSMIT_PORT, RECEIVE_PORT, CONVERTOR, TIME_BETWEEN_COMMANDS, TIMEOUT_OK);
    wifiLink.start();
    LightwaveRFCommand command = new LightwaveRfSetHeatingTemperatureCommand(100, "4", 17);
    wifiLink.sendLightwaveCommand(command);
    Thread.sleep(THREAD_SLEEP);
}
Also used : LightwaveRfSetHeatingTemperatureCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRfSetHeatingTemperatureCommand) LightwaveRFCommand(org.openhab.binding.lightwaverf.internal.command.LightwaveRFCommand) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 LightwaveRfSetHeatingTemperatureCommand (org.openhab.binding.lightwaverf.internal.command.LightwaveRfSetHeatingTemperatureCommand)3 LightwaveRFCommand (org.openhab.binding.lightwaverf.internal.command.LightwaveRFCommand)2 DatagramPacket (java.net.DatagramPacket)1 Ignore (org.junit.Ignore)1 LightwaveRfCommandOk (org.openhab.binding.lightwaverf.internal.command.LightwaveRfCommandOk)1 DecimalType (org.openhab.core.library.types.DecimalType)1