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.enocean.internal.eep.D2_01;
15 import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.CHANNEL_REPEATERMODE;
17 import java.util.function.Function;
19 import org.openhab.binding.enocean.internal.EnOceanBindingConstants;
20 import org.openhab.binding.enocean.internal.messages.ERP1Message;
21 import org.openhab.binding.enocean.internal.messages.ERP1Message.RORG;
22 import org.openhab.core.config.core.Configuration;
23 import org.openhab.core.library.types.StringType;
24 import org.openhab.core.types.Command;
25 import org.openhab.core.types.RefreshType;
26 import org.openhab.core.types.State;
30 * @author Daniel Weber - Initial contribution
32 public class D2_01_12_NodON extends D2_01 {
34 public D2_01_12_NodON() {
38 public D2_01_12_NodON(ERP1Message packet) {
43 protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command,
44 Function<String, State> getCurrentStateFunc, Configuration config) {
45 if (channelId.equalsIgnoreCase(CHANNEL_REPEATERMODE)) {
46 if (command instanceof RefreshType) {
47 senderId = null; // make this message invalid as we do not support refresh of repeter status
48 } else if (command instanceof StringType) {
49 switch (((StringType) command).toString()) {
50 case EnOceanBindingConstants.REPEATERMODE_LEVEL_1:
51 setRORG(RORG.MSC).setData((byte) 0x00, (byte) 0x46, (byte) 0x08, (byte) 0x01, (byte) 0x01);
53 case EnOceanBindingConstants.REPEATERMODE_LEVEL_2:
54 setRORG(RORG.MSC).setData((byte) 0x00, (byte) 0x46, (byte) 0x08, (byte) 0x01, (byte) 0x02);
57 setRORG(RORG.MSC).setData((byte) 0x00, (byte) 0x46, (byte) 0x08, (byte) 0x00, (byte) 0x00);
61 super.convertFromCommandImpl(channelId, channelTypeId, command, getCurrentStateFunc, config);