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.A5_3F;
15 import java.util.function.Function;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.enocean.internal.config.EnOceanChannelTransformationConfig;
20 import org.openhab.binding.enocean.internal.eep.Base._4BSMessage;
21 import org.openhab.binding.enocean.internal.messages.ERP1Message;
22 import org.openhab.core.config.core.Configuration;
23 import org.openhab.core.transform.actions.Transformation;
24 import org.openhab.core.types.Command;
25 import org.openhab.core.types.State;
26 import org.openhab.core.util.HexUtils;
30 * @author Daniel Weber - Initial contribution
33 public class A5_3F_7F_Universal extends _4BSMessage {
35 // This class is currently not used => instead use Generic4BS
37 public A5_3F_7F_Universal() {
41 public A5_3F_7F_Universal(ERP1Message packet) {
46 protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command,
47 Function<String, State> getCurrentStateFunc, @Nullable Configuration config) {
49 logger.error("Command {} could not transformed without proper configuration", command.toString());
53 EnOceanChannelTransformationConfig transformationInfo = config.as(EnOceanChannelTransformationConfig.class);
54 String c = Transformation.transform(transformationInfo.transformationType,
55 transformationInfo.transformationFunction, command.toString());
57 if (c != null && !c.equals(command.toString())) {
58 setData(HexUtils.hexToBytes(c));
60 } catch (IllegalArgumentException e) {
61 logger.debug("Command {} could not transformed", command.toString());