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.mqtt.generic;
15 import java.math.BigDecimal;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.mqtt.generic.mapping.ColorMode;
22 * A user can add custom channels to an MQTT Thing.
24 * This class contains the channel configuration.
26 * You may want to extend this for channel configurations of MQTT extensions.
28 * @author David Graeff - Initial contribution
31 public class ChannelConfig {
32 /** This is either a state topic or a trigger topic, depending on {@link #trigger}. */
33 public String stateTopic = "";
34 public String commandTopic = "";
37 * If true, the channel state is not updated on a new message.
38 * Instead a postCommand() call is performed.
40 public boolean postCommand = false;
41 public @Nullable Integer qos;
42 public boolean retained = false;
43 /** If true, the state topic will not update a state, but trigger a channel instead. */
44 public boolean trigger = false;
45 public String unit = "";
47 public String transformationPattern = "";
48 public String transformationPatternOut = "";
49 public String formatBeforePublish = "%s";
50 public String allowedStates = "";
52 public @Nullable BigDecimal min;
53 public @Nullable BigDecimal max;
54 public @Nullable BigDecimal step;
55 public @Nullable String on;
56 public @Nullable String off;
57 public @Nullable String stop;
59 public int onBrightness = 10;
60 public String colorMode = ColorMode.HSB.toString();