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.digitalstrom.internal.lib.structure.devices.deviceparameters.constants;
15 import java.util.HashMap;
19 * The {@link OutputModeEnum} lists all available digitalSTROM-device output modes.
21 * @author Michael Ochel - Initial contribution
22 * @author Matthias Siegele - Initial contribution
23 * @see <a href="http://developer.digitalstrom.org/Architecture/ds-basics.pdf">Table 36: Output Mode Register, page
26 public enum OutputModeEnum {
28 * | Output Mode | Description |
29 * ------------------------------------------------------------------------------
30 * | 0 | No output or output disabled |
32 * | 17 | RMS (root mean square) dimmer |
33 * | 18 | RMS dimmer with characteristic curve |
34 * | 19 | Phase control dimmer |
35 * | 20 | Phase control dimmer with characteristic curve |
36 * | 21 | Reverse phase control dimmer |
37 * | 22 | Reverse phase control dimmer with characteristic curve |
38 * | 23 | PWM (pulse width modulation) |
39 * | 24 | PWM with characteristic curve |
40 * | 30 | PWM to control heating control valve | (from dS web configurator, it dosn't stand in the ds-basic.pdf from
42 * | 33 | Positioning control |
43 * | 34 | combined 2 stage switch [Both relais switch combined in tow steps depending on the output value. Output >
44 * 33% - relais 1 is on. Output > 66% - relais 1 and 2 are on.] | (from ds web configurator, it dosn't stand in the
45 * ds-basic.pdf from 19.08.2015)
46 * | 35 | single switch | (from ds web configurator, it dosn't stand in the ds-basic.pdf from 19.08.2015)
47 * | 38 | combined 3 stage switch [Both relais switch combined in tow steps depending on the output value. Output >
48 * 25% - relais 1 is on. Output > 50% - relais 1 is off and relais 2 is on. Output > 75% - relais 1 and 2 are on.] |
49 * (from ds web configurator, it dosn't stand in the
50 * ds-basic.pdf from 19.08.2015)
51 * | 39 | Relay with switched mode scene table configuration |
52 * | 40 | Relay with wiped mode scene table configuration |
53 * | 41 | Relay with saving mode scene table configuration |
54 * | 42 | Positioning control for uncalibrated shutter |
55 * | 43 | combined switch | (from dS web configurator, it dosn't stand in the ds-basic.pdf from 19.08.2015)
56 * | 49 | dimmed 0-10V [dimming with 0-10V control power] | (from dS web configurator, it dosn't stand in the
57 * ds-basic.pdf from 02.06.2015)
58 * | 51 | dimmed 1-10V [dimming with 1-10V control power] | (from dS web configurator, it dosn't stand in the
59 * ds-basic.pdf from 02.06.2015)
60 * | 64 | temperature controlled switch for heating though the dSS | (from dS web configurator, it dosn't stand in
61 * the ds-basic.pdf from 19.08.2015)
62 * | 65 | temperature controlled pwm for heating though the dSS | (from dS web configurator, it dosn't stand in the
63 * ds-basic.pdf from 19.08.2015)
78 COMBINED_2_STAGE_SWITCH(34),
80 COMBINED_3_STAGE_SWITCH(38),
88 TEMPRETURE_SWITCHED(54),
91 private final int mode;
93 static final Map<Integer, OutputModeEnum> OUTPUT_MODES = new HashMap<>();
96 for (OutputModeEnum out : OutputModeEnum.values()) {
97 OUTPUT_MODES.put(out.getMode(), out);
102 * Returns true, if the output mode id contains in digitalSTROM, otherwise false.
104 * @param modeID to be checked
105 * @return true, if contains, otherwise false
107 public static boolean containsMode(Integer modeID) {
108 return OUTPUT_MODES.keySet().contains(modeID);
112 * Returns true, if the output mode is a dimmable output mode, otherwise false.
114 * @param outputMode to check
115 * @return true, if outputMode is dimmable, otherwise false
117 public static boolean outputModeIsDimmable(OutputModeEnum outputMode) {
118 if (outputMode == null) {
121 switch (outputMode) {
138 * Returns true, if the output mode is a switchable output mode, otherwise false.
140 * @param outputMode to check
141 * @return true, if outputMode is switchable, otherwise false
143 public static boolean outputModeIsSwitch(OutputModeEnum outputMode) {
144 if (outputMode == null) {
147 switch (outputMode) {
150 case COMBINED_SWITCH:
161 * Returns true, if the output mode is a shade control output mode, otherwise false.
163 * @param outputMode to check
164 * @return true, if outputMode is for shade control, otherwise false
166 public static boolean outputModeIsShade(OutputModeEnum outputMode) {
167 if (outputMode == null) {
170 switch (outputMode) {
172 case POSITION_CON_US:
180 * Returns true, if the output mode is a temperature controlled output mode, otherwise false.<br>
183 * This output mode will be automatically controlled through the digitalSTROM-Server and can't be set manually.
185 * @param outputMode to check
186 * @return true, if outputMode is temperature controlled, otherwise false
188 public static boolean outputModeIsTemperationControlled(OutputModeEnum outputMode) {
189 if (outputMode == null) {
192 switch (outputMode) {
194 case TEMPRETURE_SWITCHED:
202 * Returns the {@link OutputModeEnum} for the given modeID, otherwise null.
204 * @param modeID of the {@link OutputModeEnum}
205 * @return OutputModeEnum or null
207 public static OutputModeEnum getMode(Integer modeID) {
208 return OUTPUT_MODES.get(modeID);
211 private OutputModeEnum(int outputMode) {
212 this.mode = outputMode;
216 * Returns the id of this {@link OutputModeEnum} object.
220 public int getMode() {