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.openhab.binding.enocean.internal.config.EnOceanChannelTransformationConfig;
18 import org.openhab.binding.enocean.internal.eep.Base._4BSMessage;
19 import org.openhab.binding.enocean.internal.messages.ERP1Message;
20 import org.openhab.core.config.core.Configuration;
21 import org.openhab.core.transform.actions.Transformation;
22 import org.openhab.core.types.Command;
23 import org.openhab.core.types.State;
24 import org.openhab.core.util.HexUtils;
28 * @author Daniel Weber - Initial contribution
30 public class A5_3F_7F_Universal extends _4BSMessage {
32 // This class is currently not used => instead use Generic4BS
34 public A5_3F_7F_Universal() {
38 public A5_3F_7F_Universal(ERP1Message packet) {
43 protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command,
44 Function<String, State> getCurrentStateFunc, Configuration config) {
47 EnOceanChannelTransformationConfig transformationInfo = config
48 .as(EnOceanChannelTransformationConfig.class);
49 String c = Transformation.transform(transformationInfo.transformationType,
50 transformationInfo.transformationFunction, command.toString());
52 if (c != null && !c.equals(command.toString())) {
53 setData(HexUtils.hexToBytes(c));
56 } catch (Exception e) {
57 logger.debug("Command {} could not transformed", command.toString());