2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.rfxcom.internal.messages;
15 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
16 import static org.openhab.binding.rfxcom.internal.RFXComTestHelper.commandChannelUID;
17 import static org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType.HOME_CONFORT;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.junit.jupiter.api.Test;
21 import org.openhab.binding.rfxcom.internal.config.RFXComGenericDeviceConfiguration;
22 import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
23 import org.openhab.binding.rfxcom.internal.messages.RFXComHomeConfortMessage.SubType;
24 import org.openhab.core.library.types.OnOffType;
25 import org.openhab.core.types.Command;
26 import org.openhab.core.util.HexUtils;
29 * Test for RFXCom-binding
31 * @author Martin van Wingerden - Initial contribution
32 * @author Mike Jagdis - added message handling and real test
35 public class RFXComHomeConfortMessageTest {
36 private void testMessage(SubType subType, Command command, String deviceId, String data) throws RFXComException {
37 RFXComGenericDeviceConfiguration config = new RFXComGenericDeviceConfiguration();
39 config.deviceId = deviceId;
40 config.subType = subType.toString();
42 RFXComHomeConfortMessage message = (RFXComHomeConfortMessage) RFXComMessageFactoryImpl.INSTANCE
43 .createMessage(HOME_CONFORT, config, commandChannelUID, command);
45 assertArrayEquals(HexUtils.hexToBytes(data), message.decodeMessage());
49 public void testMessage1() throws RFXComException {
50 testMessage(SubType.TEL_010, OnOffType.ON, "1118739.A.4", "0C1B0000111213410401000000");