]> git.basschouten.com Git - openhab-addons.git/blob
b907052019c888052ca3e2c10a386e82fc7f8ee1
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.mqtt.generic;
14
15 import java.math.BigDecimal;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.mqtt.generic.mapping.ColorMode;
20
21 /**
22  * A user can add custom channels to an MQTT Thing.
23  * <p>
24  * This class contains the channel configuration.
25  * <p>
26  * You may want to extend this for channel configurations of MQTT extensions.
27  *
28  * @author David Graeff - Initial contribution
29  */
30 @NonNullByDefault
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 = "";
35     public String stopCommandTopic = "";
36
37     /**
38      * If true, the channel state is not updated on a new message.
39      * Instead a postCommand() call is performed. If the message is
40      * not possible to send as a command (i.e. UNDEF), it will ignore
41      * this.
42      */
43     public boolean postCommand = false;
44     public @Nullable Integer qos;
45     public boolean retained = false;
46     /** If true, the state topic will not update a state, but trigger a channel instead. */
47     public boolean trigger = false;
48     public String unit = "";
49
50     public String transformationPattern = "";
51     public String transformationPatternOut = "";
52     public String formatBeforePublish = "%s";
53     public String allowedStates = "";
54
55     public @Nullable BigDecimal min;
56     public @Nullable BigDecimal max;
57     public @Nullable BigDecimal step;
58     public @Nullable String on;
59     public @Nullable String off;
60     public @Nullable String stop;
61     public @Nullable String onState;
62     public @Nullable String offState;
63     public @Nullable String nullValue;
64
65     public int onBrightness = 10;
66     public String colorMode = ColorMode.HSB.toString();
67     public boolean invert = false;
68     public boolean transformExtentsToString = false;
69 }