]> git.basschouten.com Git - openhab-addons.git/blob
fe1d7afca8f9cb9915587ff4bef403ea3d0c5638
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.comfoair.internal;
14
15 import java.util.ArrayList;
16 import java.util.Collection;
17 import java.util.HashMap;
18 import java.util.List;
19 import java.util.Map;
20 import java.util.Set;
21
22 import org.eclipse.jdt.annotation.NonNullByDefault;
23 import org.eclipse.jdt.annotation.Nullable;
24 import org.openhab.binding.comfoair.internal.datatypes.ComfoAirDataType;
25 import org.openhab.binding.comfoair.internal.datatypes.DataTypeBoolean;
26 import org.openhab.binding.comfoair.internal.datatypes.DataTypeMessage;
27 import org.openhab.binding.comfoair.internal.datatypes.DataTypeNumber;
28 import org.openhab.binding.comfoair.internal.datatypes.DataTypeRPM;
29 import org.openhab.binding.comfoair.internal.datatypes.DataTypeTemperature;
30 import org.openhab.binding.comfoair.internal.datatypes.DataTypeTime;
31 import org.openhab.binding.comfoair.internal.datatypes.DataTypeVolt;
32 import org.openhab.core.library.types.DecimalType;
33 import org.openhab.core.types.Command;
34 import org.openhab.core.types.State;
35
36 /**
37  * Represents all valid commands which could be processed by this binding
38  *
39  * @author Holger Hees - Initial Contribution
40  * @author Hans Böhm - Refactoring
41  */
42 @NonNullByDefault
43 public enum ComfoAirCommandType {
44     /**
45      * Below all valid commands to change or read parameters from ComfoAir
46      *
47      * @param key
48      *            command name
49      * @param dataType
50      *            data type (can be: DataTypeBoolean.getInstance(), DataTypeMessage.getInstance(),
51      *            DataTypeNumber.getInstance(), DataTypeRPM.getInstance(), DataTypeTemperature.getInstance(),
52      *            DataTypeTime.getInstance(), DataTypeVolt.getInstance())
53      * @param possibleValues
54      *            possible values for write command, if it can only take certain values
55      * @param changeCommand
56      *            byte number for ComfoAir write command
57      * @param changeDataSize
58      *            size of bytes list for ComfoAir write command
59      * @param changeDataPos
60      *            position in bytes list to change
61      * @param changeAffected
62      *            list of affected commands (can be empty)
63      *            is mandatory for read-write command
64      * @param readCommand
65      *            request byte number for ComfoAir read command
66      * @param readReplyCommand
67      *            reply byte list size for ComfoAir read command (list of values only)
68      * @param readReplyDataPos
69      *            list of byte positions in reply bytes list from ComfoAir
70      * @param readReplyDataBits
71      *            byte value on readReplyDataPos position to be considered by command (used with
72      *            DataTypeBoolean.class dataType)
73      */
74     ACTIVATE(ComfoAirBindingConstants.CG_CONTROL_PREFIX + ComfoAirBindingConstants.CHANNEL_ACTIVATE,
75             DataTypeBoolean.getInstance(), new int[] { 0x03 }, Constants.REQUEST_SET_RS232, 1, 0,
76             Constants.EMPTY_TYPE_ARRAY),
77     MENU20_MODE(ComfoAirBindingConstants.CG_MENUP1_PREFIX + ComfoAirBindingConstants.CHANNEL_MENU20_MODE,
78             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 6 },
79             0x01),
80     MENU21_MODE(ComfoAirBindingConstants.CG_MENUP1_PREFIX + ComfoAirBindingConstants.CHANNEL_MENU21_MODE,
81             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 6 },
82             0x02),
83     MENU22_MODE(ComfoAirBindingConstants.CG_MENUP1_PREFIX + ComfoAirBindingConstants.CHANNEL_MENU22_MODE,
84             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 6 },
85             0x04),
86     MENU23_MODE(ComfoAirBindingConstants.CG_MENUP1_PREFIX + ComfoAirBindingConstants.CHANNEL_MENU23_MODE,
87             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 6 },
88             0x08),
89     MENU24_MODE(ComfoAirBindingConstants.CG_MENUP1_PREFIX + ComfoAirBindingConstants.CHANNEL_MENU24_MODE,
90             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 6 },
91             0x10),
92     MENU25_MODE(ComfoAirBindingConstants.CG_MENUP1_PREFIX + ComfoAirBindingConstants.CHANNEL_MENU25_MODE,
93             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 6 },
94             0x20),
95     MENU26_MODE(ComfoAirBindingConstants.CG_MENUP1_PREFIX + ComfoAirBindingConstants.CHANNEL_MENU26_MODE,
96             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 6 },
97             0x40),
98     MENU27_MODE(ComfoAirBindingConstants.CG_MENUP1_PREFIX + ComfoAirBindingConstants.CHANNEL_MENU27_MODE,
99             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 6 },
100             0x80),
101     MENU28_MODE(ComfoAirBindingConstants.CG_MENUP1_PREFIX + ComfoAirBindingConstants.CHANNEL_MENU28_MODE,
102             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 7 },
103             0x01),
104     MENU29_MODE(ComfoAirBindingConstants.CG_MENUP1_PREFIX + ComfoAirBindingConstants.CHANNEL_MENU29_MODE,
105             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 7 },
106             0x02),
107     BATHROOM_START_DELAY(ComfoAirBindingConstants.CG_MENUP2_PREFIX + ComfoAirBindingConstants.CHANNEL_BR_START_DELAY,
108             DataTypeTime.getInstance(), Constants.REQUEST_SET_DELAYS, 8, 0, new ComfoAirCommandType[] { MENU21_MODE },
109             Constants.REQUEST_GET_DELAYS, Constants.REPLY_GET_DELAYS, new int[] { 0 }),
110     BATHROOM_END_DELAY(ComfoAirBindingConstants.CG_MENUP2_PREFIX + ComfoAirBindingConstants.CHANNEL_BR_END_DELAY,
111             DataTypeTime.getInstance(), Constants.REQUEST_SET_DELAYS, 8, 1, new ComfoAirCommandType[] { MENU22_MODE },
112             Constants.REQUEST_GET_DELAYS, Constants.REPLY_GET_DELAYS, new int[] { 1 }),
113     L1_END_DELAY(ComfoAirBindingConstants.CG_MENUP2_PREFIX + ComfoAirBindingConstants.CHANNEL_L1_END_DELAY,
114             DataTypeTime.getInstance(), Constants.REQUEST_SET_DELAYS, 8, 2, new ComfoAirCommandType[] { MENU27_MODE },
115             Constants.REQUEST_GET_DELAYS, Constants.REPLY_GET_DELAYS, new int[] { 2 }),
116     PULSE_VENTILATION(ComfoAirBindingConstants.CG_MENUP2_PREFIX + ComfoAirBindingConstants.CHANNEL_PULSE_VENTILATION,
117             DataTypeTime.getInstance(), Constants.REQUEST_SET_DELAYS, 8, 3, new ComfoAirCommandType[] { MENU23_MODE },
118             Constants.REQUEST_GET_DELAYS, Constants.REPLY_GET_DELAYS, new int[] { 3 }),
119     FILTER_WEEKS(ComfoAirBindingConstants.CG_MENUP2_PREFIX + ComfoAirBindingConstants.CHANNEL_FILTER_WEEKS,
120             DataTypeTime.getInstance(), Constants.REQUEST_SET_DELAYS, 8, 4, new ComfoAirCommandType[] { MENU24_MODE },
121             Constants.REQUEST_GET_DELAYS, Constants.REPLY_GET_DELAYS, new int[] { 4 }),
122     RF_SHORT_DELAY(ComfoAirBindingConstants.CG_MENUP2_PREFIX + ComfoAirBindingConstants.CHANNEL_RF_SHORT_DELAY,
123             DataTypeTime.getInstance(), Constants.REQUEST_SET_DELAYS, 8, 5, new ComfoAirCommandType[] { MENU25_MODE },
124             Constants.REQUEST_GET_DELAYS, Constants.REPLY_GET_DELAYS, new int[] { 5 }),
125     RF_LONG_DELAY(ComfoAirBindingConstants.CG_MENUP2_PREFIX + ComfoAirBindingConstants.CHANNEL_RF_LONG_DELAY,
126             DataTypeTime.getInstance(), Constants.REQUEST_SET_DELAYS, 8, 6, new ComfoAirCommandType[] { MENU26_MODE },
127             Constants.REQUEST_GET_DELAYS, Constants.REPLY_GET_DELAYS, new int[] { 6 }),
128     COOKERHOOD_DELAY(ComfoAirBindingConstants.CG_MENUP2_PREFIX + ComfoAirBindingConstants.CHANNEL_COOKERHOOD_DELAY,
129             DataTypeTime.getInstance(), Constants.REQUEST_SET_DELAYS, 8, 7, new ComfoAirCommandType[] { MENU20_MODE },
130             Constants.REQUEST_GET_DELAYS, Constants.REPLY_GET_DELAYS, new int[] { 7 }),
131     CHIMNEY_STATE(ComfoAirBindingConstants.CG_MENUP9_PREFIX + ComfoAirBindingConstants.CHANNEL_CHIMNEY_STATE,
132             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 8 },
133             0x01),
134     BYPASS_STATE(ComfoAirBindingConstants.CG_MENUP9_PREFIX + ComfoAirBindingConstants.CHANNEL_BYPASS_STATE,
135             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 8 },
136             0x02),
137     GHX_STATE(ComfoAirBindingConstants.CG_MENUP9_PREFIX + ComfoAirBindingConstants.CHANNEL_GHX_STATE,
138             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 8 },
139             0x04),
140     HEATER_STATE(ComfoAirBindingConstants.CG_MENUP9_PREFIX + ComfoAirBindingConstants.CHANNEL_HEATER_STATE,
141             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 8 },
142             0x08),
143     V_CONTROL_STATE(ComfoAirBindingConstants.CG_MENUP9_PREFIX + ComfoAirBindingConstants.CHANNEL_VCONTROL_STATE,
144             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 8 },
145             0x10),
146     FROST_STATE(ComfoAirBindingConstants.CG_MENUP9_PREFIX + ComfoAirBindingConstants.CHANNEL_FROST_STATE,
147             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 8 },
148             0x20),
149     COOKERHOOD_STATE(ComfoAirBindingConstants.CG_MENUP9_PREFIX + ComfoAirBindingConstants.CHANNEL_COOKERHOOD_STATE,
150             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 8 },
151             0x40),
152     ENTHALPY_STATE(ComfoAirBindingConstants.CG_MENUP9_PREFIX + ComfoAirBindingConstants.CHANNEL_ENTHALPY_STATE,
153             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 8 },
154             0x80),
155     FAN_IN_PERCENT(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_IN_PERCENT,
156             DataTypeNumber.getInstance(), Constants.REQUEST_GET_FAN, Constants.REPLY_GET_FAN, new int[] { 0 }),
157     FAN_OUT_PERCENT(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_OUT_PERCENT,
158             DataTypeNumber.getInstance(), Constants.REQUEST_GET_FAN, Constants.REPLY_GET_FAN, new int[] { 1 }),
159     FAN_IN_RPM(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_IN_RPM,
160             DataTypeRPM.getInstance(), Constants.REQUEST_GET_FAN, Constants.REPLY_GET_FAN, new int[] { 2, 3 }),
161     FAN_OUT_RPM(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_OUT_RPM,
162             DataTypeRPM.getInstance(), Constants.REQUEST_GET_FAN, Constants.REPLY_GET_FAN, new int[] { 4, 5 }),
163     FAN_OUT_0(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_OUT_0,
164             DataTypeNumber.getInstance(), Constants.REQUEST_SET_FAN_LEVEL, 9, 0,
165             new ComfoAirCommandType[] { FAN_OUT_PERCENT, FAN_OUT_RPM }, Constants.REQUEST_GET_FAN_LEVEL,
166             Constants.REPLY_GET_FAN_LEVEL, new int[] { 0 }),
167     FAN_OUT_1(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_OUT_1,
168             DataTypeNumber.getInstance(), Constants.REQUEST_SET_FAN_LEVEL, 9, 1,
169             new ComfoAirCommandType[] { FAN_OUT_PERCENT, FAN_OUT_RPM }, Constants.REQUEST_GET_FAN_LEVEL,
170             Constants.REPLY_GET_FAN_LEVEL, new int[] { 1 }),
171     FAN_OUT_2(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_OUT_2,
172             DataTypeNumber.getInstance(), Constants.REQUEST_SET_FAN_LEVEL, 9, 2,
173             new ComfoAirCommandType[] { FAN_OUT_PERCENT, FAN_OUT_RPM }, Constants.REQUEST_GET_FAN_LEVEL,
174             Constants.REPLY_GET_FAN_LEVEL, new int[] { 2 }),
175     FAN_OUT_3(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_OUT_3,
176             DataTypeNumber.getInstance(), Constants.REQUEST_SET_FAN_LEVEL, 9, 6,
177             new ComfoAirCommandType[] { FAN_OUT_PERCENT, FAN_OUT_RPM }, Constants.REQUEST_GET_FAN_LEVEL,
178             Constants.REPLY_GET_FAN_LEVEL, new int[] { 10 }),
179     FAN_IN_0(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_IN_0,
180             DataTypeNumber.getInstance(), Constants.REQUEST_SET_FAN_LEVEL, 9, 3,
181             new ComfoAirCommandType[] { FAN_IN_PERCENT, FAN_IN_RPM }, Constants.REQUEST_GET_FAN_LEVEL,
182             Constants.REPLY_GET_FAN_LEVEL, new int[] { 3 }),
183     FAN_IN_1(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_IN_1,
184             DataTypeNumber.getInstance(), Constants.REQUEST_SET_FAN_LEVEL, 9, 4,
185             new ComfoAirCommandType[] { FAN_IN_PERCENT, FAN_IN_RPM }, Constants.REQUEST_GET_FAN_LEVEL,
186             Constants.REPLY_GET_FAN_LEVEL, new int[] { 4 }),
187     FAN_IN_2(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_IN_2,
188             DataTypeNumber.getInstance(), Constants.REQUEST_SET_FAN_LEVEL, 9, 5,
189             new ComfoAirCommandType[] { FAN_IN_PERCENT, FAN_IN_RPM }, Constants.REQUEST_GET_FAN_LEVEL,
190             Constants.REPLY_GET_FAN_LEVEL, new int[] { 5 }),
191     FAN_IN_3(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_IN_3,
192             DataTypeNumber.getInstance(), Constants.REQUEST_SET_FAN_LEVEL, 9, 7,
193             new ComfoAirCommandType[] { FAN_IN_PERCENT, FAN_IN_RPM }, Constants.REQUEST_GET_FAN_LEVEL,
194             Constants.REPLY_GET_FAN_LEVEL, new int[] { 11 }),
195     FAN_LEVEL(ComfoAirBindingConstants.CG_VENTILATION_PREFIX + ComfoAirBindingConstants.CHANNEL_FAN_LEVEL,
196             DataTypeNumber.getInstance(), new int[] { 0x01, 0x02, 0x03, 0x04 }, Constants.REQUEST_SET_LEVEL, 1, 0,
197             new ComfoAirCommandType[] { FAN_IN_PERCENT, FAN_IN_RPM, FAN_OUT_PERCENT, FAN_OUT_RPM },
198             Constants.REQUEST_GET_FAN_LEVEL, Constants.REPLY_GET_FAN_LEVEL, new int[] { 8 }),
199     LEVEL0_TIME(ComfoAirBindingConstants.CG_TIMES_PREFIX + ComfoAirBindingConstants.CHANNEL_TIME_LEVEL0,
200             DataTypeTime.getInstance(), Constants.REQUEST_GET_HOURS, Constants.REPLY_GET_HOURS, new int[] { 0, 1, 2 }),
201     LEVEL1_TIME(ComfoAirBindingConstants.CG_TIMES_PREFIX + ComfoAirBindingConstants.CHANNEL_TIME_LEVEL1,
202             DataTypeTime.getInstance(), Constants.REQUEST_GET_HOURS, Constants.REPLY_GET_HOURS, new int[] { 3, 4, 5 }),
203     LEVEL2_TIME(ComfoAirBindingConstants.CG_TIMES_PREFIX + ComfoAirBindingConstants.CHANNEL_TIME_LEVEL2,
204             DataTypeTime.getInstance(), Constants.REQUEST_GET_HOURS, Constants.REPLY_GET_HOURS, new int[] { 6, 7, 8 }),
205     LEVEL3_TIME(ComfoAirBindingConstants.CG_TIMES_PREFIX + ComfoAirBindingConstants.CHANNEL_TIME_LEVEL3,
206             DataTypeTime.getInstance(), Constants.REQUEST_GET_HOURS, Constants.REPLY_GET_HOURS,
207             new int[] { 17, 18, 19 }),
208     FREEZE_TIME(ComfoAirBindingConstants.CG_TIMES_PREFIX + ComfoAirBindingConstants.CHANNEL_TIME_FREEZE,
209             DataTypeTime.getInstance(), Constants.REQUEST_GET_HOURS, Constants.REPLY_GET_HOURS, new int[] { 9, 10 }),
210     PREHEATER_TIME(ComfoAirBindingConstants.CG_TIMES_PREFIX + ComfoAirBindingConstants.CHANNEL_TIME_PREHEATER,
211             DataTypeTime.getInstance(), Constants.REQUEST_GET_HOURS, Constants.REPLY_GET_HOURS, new int[] { 11, 12 }),
212     BYPASS_TIME(ComfoAirBindingConstants.CG_TIMES_PREFIX + ComfoAirBindingConstants.CHANNEL_TIME_BYPASS,
213             DataTypeTime.getInstance(), Constants.REQUEST_GET_HOURS, Constants.REPLY_GET_HOURS, new int[] { 13, 14 }),
214     BYPASS_FACTOR(ComfoAirBindingConstants.CG_BYPASS_PREFIX + ComfoAirBindingConstants.CHANNEL_BYPASS_FACTOR,
215             DataTypeNumber.getInstance(), Constants.REQUEST_GET_BYPASS, Constants.REPLY_GET_BYPASS, new int[] { 2 }),
216     BYPASS_LEVEL(ComfoAirBindingConstants.CG_BYPASS_PREFIX + ComfoAirBindingConstants.CHANNEL_BYPASS_LEVEL,
217             DataTypeNumber.getInstance(), Constants.REQUEST_GET_BYPASS, Constants.REPLY_GET_BYPASS, new int[] { 3 }),
218     BYPASS_CORRECTION(ComfoAirBindingConstants.CG_BYPASS_PREFIX + ComfoAirBindingConstants.CHANNEL_BYPASS_CORRECTION,
219             DataTypeNumber.getInstance(), Constants.REQUEST_GET_BYPASS, Constants.REPLY_GET_BYPASS, new int[] { 4 }),
220     BYPASS_SUMMER(ComfoAirBindingConstants.CG_BYPASS_PREFIX + ComfoAirBindingConstants.CHANNEL_BYPASS_SUMMER,
221             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_BYPASS, Constants.REPLY_GET_BYPASS, new int[] { 6 }),
222     ENTHALPY_TEMPERATURE(ComfoAirBindingConstants.CG_ENTHALPY_PREFIX + ComfoAirBindingConstants.CHANNEL_ENTHALPY_TEMP,
223             DataTypeTemperature.getInstance(), Constants.REQUEST_GET_SENSORS, Constants.REPLY_GET_SENSORS,
224             new int[] { 0 }),
225     ENTHALPY_HUMIDITY(ComfoAirBindingConstants.CG_ENTHALPY_PREFIX + ComfoAirBindingConstants.CHANNEL_ENTHALPY_HUMIDITY,
226             DataTypeNumber.getInstance(), Constants.REQUEST_GET_SENSORS, Constants.REPLY_GET_SENSORS, new int[] { 1 }),
227     ENTHALPY_LEVEL(ComfoAirBindingConstants.CG_ENTHALPY_PREFIX + ComfoAirBindingConstants.CHANNEL_ENTHALPY_LEVEL,
228             DataTypeNumber.getInstance(), Constants.REQUEST_GET_SENSORS, Constants.REPLY_GET_SENSORS, new int[] { 4 }),
229     ENTHALPY_TIME(ComfoAirBindingConstants.CG_ENTHALPY_PREFIX + ComfoAirBindingConstants.CHANNEL_ENTHALPY_TIME,
230             DataTypeTime.getInstance(), Constants.REQUEST_GET_SENSORS, Constants.REPLY_GET_SENSORS, new int[] { 5 }),
231     PREHEATER_VALVE(ComfoAirBindingConstants.CG_PREHEATER_PREFIX + ComfoAirBindingConstants.CHANNEL_PREHEATER_VALVE,
232             DataTypeNumber.getInstance(), Constants.REQUEST_GET_PREHEATER, Constants.REPLY_GET_PREHEATER,
233             new int[] { 0 }),
234     PREHEATER_FROST_PROTECT(
235             ComfoAirBindingConstants.CG_PREHEATER_PREFIX + ComfoAirBindingConstants.CHANNEL_PREHEATER_FROST_PROTECT,
236             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_PREHEATER, Constants.REPLY_GET_PREHEATER,
237             new int[] { 1 }),
238     PREHEATER_HEATING(ComfoAirBindingConstants.CG_PREHEATER_PREFIX + ComfoAirBindingConstants.CHANNEL_PREHEATER_HEATING,
239             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_PREHEATER, Constants.REPLY_GET_PREHEATER,
240             new int[] { 2 }),
241     PREHEATER_FROST_TIME(
242             ComfoAirBindingConstants.CG_PREHEATER_PREFIX + ComfoAirBindingConstants.CHANNEL_PREHEATER_FROST_TIME,
243             DataTypeTime.getInstance(), Constants.REQUEST_GET_PREHEATER, Constants.REPLY_GET_PREHEATER,
244             new int[] { 3, 4 }),
245     PREHEATER_OPTION(ComfoAirBindingConstants.CG_PREHEATER_PREFIX + ComfoAirBindingConstants.CHANNEL_PREHEATER_SAFETY,
246             DataTypeNumber.getInstance(), Constants.REQUEST_GET_PREHEATER, Constants.REPLY_GET_PREHEATER,
247             new int[] { 5 }),
248     TARGET_TEMPERATURE(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_TEMP_TARGET,
249             DataTypeTemperature.getInstance(), Constants.REQUEST_SET_TEMPS, 1, 0,
250             new ComfoAirCommandType[] { BYPASS_FACTOR, BYPASS_LEVEL, BYPASS_SUMMER }, Constants.REQUEST_GET_TEMPS,
251             Constants.REPLY_GET_TEMPS, new int[] { 0 }),
252     OUTDOOR_TEMPERATURE_IN(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_TEMP_OUTDOOR_IN,
253             DataTypeTemperature.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 1 }),
254     OUTDOOR_TEMPERATURE_OUT(
255             ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_TEMP_OUTDOOR_OUT,
256             DataTypeTemperature.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 4 }),
257     INDOOR_TEMPERATURE_IN(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_TEMP_INDOOR_IN,
258             DataTypeTemperature.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 2 }),
259     INDOOR_TEMPERATURE_OUT(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_TEMP_INDOOR_OUT,
260             DataTypeTemperature.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 3 }),
261     IS_T1_SENSOR(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_SENSOR_T1,
262             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 5 },
263             0x01),
264     IS_T2_SENSOR(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_SENSOR_T2,
265             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 5 },
266             0x02),
267     IS_T3_SENSOR(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_SENSOR_T3,
268             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 5 },
269             0x04),
270     IS_T4_SENSOR(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_SENSOR_T4,
271             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 5 },
272             0x08),
273     IS_GHX_SENSOR(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_SENSOR_GHX,
274             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 5 },
275             0x10),
276     IS_HEATER_SENSOR(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_SENSOR_HEATER,
277             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 5 },
278             0x20),
279     IS_COOKERHOOD_SENSOR(
280             ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_SENSOR_COOKERHOOD,
281             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 5 },
282             0x40),
283     GHX_TEMPERATURE(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_TEMP_GHX,
284             DataTypeTemperature.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 6 }),
285     HEATER_TEMPERATURE(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_TEMP_HEATER,
286             DataTypeTemperature.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 7 }),
287     COOKERHOOD_TEMPERATURE(ComfoAirBindingConstants.CG_TEMPS_PREFIX + ComfoAirBindingConstants.CHANNEL_TEMP_COOKERHOOD,
288             DataTypeTemperature.getInstance(), Constants.REQUEST_GET_TEMPS, Constants.REPLY_GET_TEMPS, new int[] { 8 }),
289     GHX_SPEED(ComfoAirBindingConstants.CG_GHX_PREFIX + ComfoAirBindingConstants.CHANNEL_GHX_SPEED,
290             DataTypeNumber.getInstance(), Constants.REQUEST_SET_GHX, 5, 2,
291             new ComfoAirCommandType[] { GHX_STATE, GHX_TEMPERATURE }, Constants.REQUEST_GET_GHX,
292             Constants.REPLY_GET_GHX, new int[] { 2 }),
293     GHX_TEMPERATURE_LOW(ComfoAirBindingConstants.CG_GHX_PREFIX + ComfoAirBindingConstants.CHANNEL_GHX_TEMP_LOW,
294             DataTypeTemperature.getInstance(), Constants.REQUEST_SET_GHX, 5, 0, new ComfoAirCommandType[] { GHX_STATE },
295             Constants.REQUEST_GET_GHX, Constants.REPLY_GET_GHX, new int[] { 0 }),
296     GHX_TEMPERATURE_HIGH(ComfoAirBindingConstants.CG_GHX_PREFIX + ComfoAirBindingConstants.CHANNEL_GHX_TEMP_HIGH,
297             DataTypeTemperature.getInstance(), Constants.REQUEST_SET_GHX, 5, 1, new ComfoAirCommandType[] { GHX_STATE },
298             Constants.REQUEST_GET_GHX, Constants.REPLY_GET_GHX, new int[] { 1 }),
299     COOKERHOOD_SPEED(ComfoAirBindingConstants.CG_COOKERHOOD_PREFIX + ComfoAirBindingConstants.CHANNEL_COOKERHOOD_SPEED,
300             DataTypeNumber.getInstance(), Constants.REQUEST_SET_GHX, 5, 3,
301             new ComfoAirCommandType[] { COOKERHOOD_STATE, COOKERHOOD_TEMPERATURE }, Constants.REQUEST_GET_GHX,
302             Constants.REPLY_GET_GHX, new int[] { 3 }),
303     HEATER_POWER(ComfoAirBindingConstants.CG_HEATER_PREFIX + ComfoAirBindingConstants.CHANNEL_HEATER_POWER,
304             DataTypeNumber.getInstance(), Constants.REQUEST_GET_GHX, Constants.REPLY_GET_GHX, new int[] { 4 }),
305     HEATER_POWER_I(ComfoAirBindingConstants.CG_HEATER_PREFIX + ComfoAirBindingConstants.CHANNEL_HEATER_POWER_I,
306             DataTypeNumber.getInstance(), Constants.REQUEST_GET_GHX, Constants.REPLY_GET_GHX, new int[] { 5 }),
307     HEATER_TARGET_TEMPERATURE(
308             ComfoAirBindingConstants.CG_HEATER_PREFIX + ComfoAirBindingConstants.CHANNEL_HEATER_TEMP_TARGET,
309             DataTypeTemperature.getInstance(), Constants.REQUEST_SET_GHX, 5, 4,
310             new ComfoAirCommandType[] { HEATER_STATE, HEATER_POWER, HEATER_TEMPERATURE }, Constants.REQUEST_GET_GHX,
311             Constants.REPLY_GET_GHX, new int[] { 6 }),
312     IS_PREHEATER(ComfoAirBindingConstants.CG_OPTIONS_PREFIX + ComfoAirBindingConstants.CHANNEL_OPTION_PREHEATER,
313             DataTypeBoolean.getInstance(), Constants.REQUEST_SET_STATES, 8, 0,
314             new ComfoAirCommandType[] { OUTDOOR_TEMPERATURE_IN, INDOOR_TEMPERATURE_IN, PREHEATER_FROST_PROTECT,
315                     PREHEATER_FROST_TIME, PREHEATER_HEATING, FROST_STATE, PREHEATER_OPTION, PREHEATER_TIME,
316                     PREHEATER_VALVE },
317             Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 0 }),
318     IS_BYPASS(ComfoAirBindingConstants.CG_OPTIONS_PREFIX + ComfoAirBindingConstants.CHANNEL_OPTION_BYPASS,
319             DataTypeBoolean.getInstance(), Constants.REQUEST_SET_STATES, 8, 1,
320             new ComfoAirCommandType[] { INDOOR_TEMPERATURE_IN, OUTDOOR_TEMPERATURE_OUT }, Constants.REQUEST_GET_STATES,
321             Constants.REPLY_GET_STATES, new int[] { 1 }),
322     RECU_TYPE(ComfoAirBindingConstants.CG_OPTIONS_PREFIX + ComfoAirBindingConstants.CHANNEL_OPTION_RECU_TYPE,
323             DataTypeNumber.getInstance(), new int[] { 0x01, 0x02 }, Constants.REQUEST_SET_STATES, 8, 2,
324             new ComfoAirCommandType[] { FAN_IN_PERCENT, FAN_OUT_PERCENT, INDOOR_TEMPERATURE_IN, INDOOR_TEMPERATURE_OUT,
325                     OUTDOOR_TEMPERATURE_IN, OUTDOOR_TEMPERATURE_OUT },
326             Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 2 }),
327     RECU_SIZE(ComfoAirBindingConstants.CG_OPTIONS_PREFIX + ComfoAirBindingConstants.CHANNEL_OPTION_RECU_SIZE,
328             DataTypeNumber.getInstance(), new int[] { 0x01, 0x02 }, Constants.REQUEST_SET_STATES, 8, 3,
329             new ComfoAirCommandType[] { FAN_IN_PERCENT, FAN_OUT_PERCENT, FAN_IN_0, FAN_IN_1, FAN_IN_2, FAN_IN_3,
330                     FAN_OUT_0, FAN_OUT_1, FAN_OUT_2, FAN_OUT_3 },
331             Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 3 }),
332     IS_CHIMNEY(ComfoAirBindingConstants.CG_OPTIONS_PREFIX + ComfoAirBindingConstants.CHANNEL_OPTION_CHIMNEY,
333             DataTypeBoolean.getInstance(), new int[] { 0x01 }, Constants.REQUEST_SET_STATES, 8, 4,
334             Constants.EMPTY_TYPE_ARRAY, Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 4 },
335             0x01),
336     IS_COOKERHOOD(ComfoAirBindingConstants.CG_OPTIONS_PREFIX + ComfoAirBindingConstants.CHANNEL_OPTION_COOKERHOOD,
337             DataTypeBoolean.getInstance(), new int[] { 0x02 }, Constants.REQUEST_SET_STATES, 8, 4,
338             new ComfoAirCommandType[] { COOKERHOOD_DELAY, COOKERHOOD_STATE, COOKERHOOD_SPEED, COOKERHOOD_TEMPERATURE },
339             Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 4 }, 0x02),
340     IS_HEATER(ComfoAirBindingConstants.CG_OPTIONS_PREFIX + ComfoAirBindingConstants.CHANNEL_OPTION_HEATER,
341             DataTypeBoolean.getInstance(), new int[] { 0x04 }, Constants.REQUEST_SET_STATES, 8, 4,
342             new ComfoAirCommandType[] { HEATER_TARGET_TEMPERATURE, HEATER_POWER, HEATER_STATE, HEATER_POWER_I,
343                     HEATER_TEMPERATURE },
344             Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 4 }, 0x04),
345     IS_ENTHALPY(ComfoAirBindingConstants.CG_OPTIONS_PREFIX + ComfoAirBindingConstants.CHANNEL_OPTION_ENTHALPY,
346             DataTypeNumber.getInstance(), new int[] { 0x00, 0x01, 0x02 }, Constants.REQUEST_SET_STATES, 8, 6,
347             new ComfoAirCommandType[] { ENTHALPY_TEMPERATURE, ENTHALPY_HUMIDITY, ENTHALPY_LEVEL, ENTHALPY_STATE,
348                     ENTHALPY_TIME },
349             Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 9 }),
350     IS_GHX(ComfoAirBindingConstants.CG_OPTIONS_PREFIX + ComfoAirBindingConstants.CHANNEL_OPTION_GHX,
351             DataTypeNumber.getInstance(), new int[] { 0x00, 0x01, 0x02 }, Constants.REQUEST_SET_STATES, 8, 7,
352             new ComfoAirCommandType[] { GHX_SPEED, GHX_TEMPERATURE_LOW, GHX_TEMPERATURE_HIGH, GHX_STATE,
353                     GHX_TEMPERATURE },
354             Constants.REQUEST_GET_STATES, Constants.REPLY_GET_STATES, new int[] { 10 }),
355     SOFTWARE_MAIN_VERSION(ComfoAirBindingConstants.PROPERTY_SOFTWARE_MAIN_VERSION, DataTypeNumber.getInstance(),
356             Constants.REQUEST_GET_FIRMWARE, Constants.REPLY_GET_FIRMWARE, new int[] { 0 }),
357     SOFTWARE_MINOR_VERSION(ComfoAirBindingConstants.PROPERTY_SOFTWARE_MINOR_VERSION, DataTypeNumber.getInstance(),
358             Constants.REQUEST_GET_FIRMWARE, Constants.REPLY_GET_FIRMWARE, new int[] { 1 }),
359     DEVICE_NAME(ComfoAirBindingConstants.PROPERTY_DEVICE_NAME, DataTypeNumber.getInstance(),
360             Constants.REQUEST_GET_FIRMWARE, Constants.REPLY_GET_FIRMWARE,
361             new int[] { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }),
362     ERRORS_CURRENT(ComfoAirBindingConstants.CG_ERRORS_PREFIX + ComfoAirBindingConstants.CHANNEL_ERRORS_CURRENT,
363             DataTypeMessage.getInstance(), Constants.REQUEST_GET_ERRORS, Constants.REPLY_GET_ERRORS,
364             new int[] { 0, 1, 9, 13 }),
365     ERRORS_LAST(ComfoAirBindingConstants.CG_ERRORS_PREFIX + ComfoAirBindingConstants.CHANNEL_ERRORS_LAST,
366             DataTypeMessage.getInstance(), Constants.REQUEST_GET_ERRORS, Constants.REPLY_GET_ERRORS,
367             new int[] { 2, 3, 10, 14 }),
368     ERRORS_PRELAST(ComfoAirBindingConstants.CG_ERRORS_PREFIX + ComfoAirBindingConstants.CHANNEL_ERRORS_PRELAST,
369             DataTypeMessage.getInstance(), Constants.REQUEST_GET_ERRORS, Constants.REPLY_GET_ERRORS,
370             new int[] { 4, 5, 11, 15 }),
371     ERRORS_PREPRELAST(ComfoAirBindingConstants.CG_ERRORS_PREFIX + ComfoAirBindingConstants.CHANNEL_ERRORS_PREPRELAST,
372             DataTypeMessage.getInstance(), Constants.REQUEST_GET_ERRORS, Constants.REPLY_GET_ERRORS,
373             new int[] { 6, 7, 12, 16 }),
374     ERROR_RESET(ComfoAirBindingConstants.CG_RESETS_PREFIX + ComfoAirBindingConstants.CHANNEL_ERROR_RESET,
375             DataTypeNumber.getInstance(), new int[] { 0x01 }, Constants.REQUEST_SET_RESETS, 4, 0,
376             new ComfoAirCommandType[] { ERRORS_CURRENT, ERRORS_LAST, ERRORS_PRELAST, ERRORS_PREPRELAST }),
377     FILTER_ERROR(ComfoAirBindingConstants.CG_ERRORS_PREFIX + ComfoAirBindingConstants.CHANNEL_FILTER_ERROR,
378             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_ERRORS, Constants.REPLY_GET_ERRORS, new int[] { 8 },
379             0x01),
380     FILTER_HOURS(ComfoAirBindingConstants.CG_TIMES_PREFIX + ComfoAirBindingConstants.CHANNEL_TIME_FILTER,
381             DataTypeTime.getInstance(), Constants.REQUEST_GET_HOURS, Constants.REPLY_GET_HOURS, new int[] { 15, 16 }),
382     FILTER_RESET(ComfoAirBindingConstants.CG_RESETS_PREFIX + ComfoAirBindingConstants.CHANNEL_FILTER_RESET,
383             DataTypeNumber.getInstance(), new int[] { 0x01 }, Constants.REQUEST_SET_RESETS, 4, 3,
384             new ComfoAirCommandType[] { FILTER_HOURS, FILTER_ERROR }),
385     ANALOG1_NEGATIVE(ComfoAirBindingConstants.CG_ANALOG1_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_NEGATIVE,
386             DataTypeBoolean.getInstance(), new int[] { 0x01 }, Constants.REQUEST_SET_ANALOGS, 19, 2,
387             Constants.EMPTY_TYPE_ARRAY, Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 2 },
388             0x01),
389     ANALOG2_NEGATIVE(ComfoAirBindingConstants.CG_ANALOG2_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_NEGATIVE,
390             DataTypeBoolean.getInstance(), new int[] { 0x02 }, Constants.REQUEST_SET_ANALOGS, 19, 2,
391             Constants.EMPTY_TYPE_ARRAY, Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 2 },
392             0x02),
393     ANALOG3_NEGATIVE(ComfoAirBindingConstants.CG_ANALOG3_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_NEGATIVE,
394             DataTypeBoolean.getInstance(), new int[] { 0x04 }, Constants.REQUEST_SET_ANALOGS, 19, 2,
395             Constants.EMPTY_TYPE_ARRAY, Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 2 },
396             0x04),
397     ANALOG4_NEGATIVE(ComfoAirBindingConstants.CG_ANALOG4_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_NEGATIVE,
398             DataTypeBoolean.getInstance(), new int[] { 0x08 }, Constants.REQUEST_SET_ANALOGS, 19, 2,
399             Constants.EMPTY_TYPE_ARRAY, Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 2 },
400             0x08),
401     RF_NEGATIVE(ComfoAirBindingConstants.CG_ANALOGRF_PREFIX + ComfoAirBindingConstants.CHANNEL_RF_NEGATIVE,
402             DataTypeBoolean.getInstance(), new int[] { 0x10 }, Constants.REQUEST_SET_ANALOGS, 19, 2,
403             Constants.EMPTY_TYPE_ARRAY, Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 2 },
404             0x10),
405     ANALOG1_MIN(ComfoAirBindingConstants.CG_ANALOG1_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MIN,
406             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 3, Constants.EMPTY_TYPE_ARRAY,
407             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 3 }),
408     ANALOG1_MAX(ComfoAirBindingConstants.CG_ANALOG1_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MAX,
409             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 4, Constants.EMPTY_TYPE_ARRAY,
410             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 4 }),
411     ANALOG1_VALUE(ComfoAirBindingConstants.CG_ANALOG1_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_VALUE,
412             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 5, Constants.EMPTY_TYPE_ARRAY,
413             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 5 }),
414     ANALOG2_MIN(ComfoAirBindingConstants.CG_ANALOG2_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MIN,
415             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 6, Constants.EMPTY_TYPE_ARRAY,
416             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 6 }),
417     ANALOG2_MAX(ComfoAirBindingConstants.CG_ANALOG2_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MAX,
418             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 7, Constants.EMPTY_TYPE_ARRAY,
419             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 7 }),
420     ANALOG2_VALUE(ComfoAirBindingConstants.CG_ANALOG2_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_VALUE,
421             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 8, Constants.EMPTY_TYPE_ARRAY,
422             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 8 }),
423     ANALOG3_MIN(ComfoAirBindingConstants.CG_ANALOG3_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MIN,
424             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 9, Constants.EMPTY_TYPE_ARRAY,
425             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 9 }),
426     ANALOG3_MAX(ComfoAirBindingConstants.CG_ANALOG3_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MAX,
427             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 10, Constants.EMPTY_TYPE_ARRAY,
428             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 10 }),
429     ANALOG3_VALUE(ComfoAirBindingConstants.CG_ANALOG3_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_VALUE,
430             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 11, Constants.EMPTY_TYPE_ARRAY,
431             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 11 }),
432     ANALOG4_MIN(ComfoAirBindingConstants.CG_ANALOG4_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MIN,
433             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 12, Constants.EMPTY_TYPE_ARRAY,
434             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 12 }),
435     ANALOG4_MAX(ComfoAirBindingConstants.CG_ANALOG4_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MAX,
436             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 13, Constants.EMPTY_TYPE_ARRAY,
437             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 13 }),
438     ANALOG4_VALUE(ComfoAirBindingConstants.CG_ANALOG4_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_VALUE,
439             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 14, Constants.EMPTY_TYPE_ARRAY,
440             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 14 }),
441     RF_MIN(ComfoAirBindingConstants.CG_ANALOGRF_PREFIX + ComfoAirBindingConstants.CHANNEL_RF_MIN,
442             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 15, Constants.EMPTY_TYPE_ARRAY,
443             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 15 }),
444     RF_MAX(ComfoAirBindingConstants.CG_ANALOGRF_PREFIX + ComfoAirBindingConstants.CHANNEL_RF_MAX,
445             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 16, Constants.EMPTY_TYPE_ARRAY,
446             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 16 }),
447     RF_VALUE(ComfoAirBindingConstants.CG_ANALOGRF_PREFIX + ComfoAirBindingConstants.CHANNEL_RF_VALUE,
448             DataTypeNumber.getInstance(), Constants.REQUEST_SET_ANALOGS, 19, 17, Constants.EMPTY_TYPE_ARRAY,
449             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 17 }),
450     ANALOG_MODE(ComfoAirBindingConstants.CG_OPTIONS_PREFIX + ComfoAirBindingConstants.CHANNEL_OPTION_PRIORITY,
451             DataTypeNumber.getInstance(), new int[] { 0x00, 0x01 }, Constants.REQUEST_SET_ANALOGS, 19, 18,
452             Constants.EMPTY_TYPE_ARRAY, Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 18 }),
453     ANALOG1_VOLT(ComfoAirBindingConstants.CG_ANALOG1_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_VOLT,
454             DataTypeVolt.getInstance(), Constants.REQUEST_GET_ANALOG_VOLTS, Constants.REPLY_GET_ANALOG_VOLTS,
455             new int[] { 0 }),
456     ANALOG2_VOLT(ComfoAirBindingConstants.CG_ANALOG2_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_VOLT,
457             DataTypeVolt.getInstance(), Constants.REQUEST_GET_ANALOG_VOLTS, Constants.REPLY_GET_ANALOG_VOLTS,
458             new int[] { 1 }),
459     ANALOG3_VOLT(ComfoAirBindingConstants.CG_ANALOG3_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_VOLT,
460             DataTypeVolt.getInstance(), Constants.REQUEST_GET_ANALOG_VOLTS, Constants.REPLY_GET_ANALOG_VOLTS,
461             new int[] { 2 }),
462     ANALOG4_VOLT(ComfoAirBindingConstants.CG_ANALOG4_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_VOLT,
463             DataTypeVolt.getInstance(), Constants.REQUEST_GET_ANALOG_VOLTS, Constants.REPLY_GET_ANALOG_VOLTS,
464             new int[] { 3 }),
465     ANALOG1_MODE(ComfoAirBindingConstants.CG_ANALOG1_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MODE,
466             DataTypeBoolean.getInstance(), new int[] { 0x01 }, Constants.REQUEST_SET_ANALOGS, 19, 1,
467             new ComfoAirCommandType[] { ANALOG1_NEGATIVE, ANALOG1_MIN, ANALOG1_MAX, ANALOG1_VALUE, ANALOG1_VOLT },
468             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 1 }, 0x01),
469     ANALOG2_MODE(ComfoAirBindingConstants.CG_ANALOG2_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MODE,
470             DataTypeBoolean.getInstance(), new int[] { 0x02 }, Constants.REQUEST_SET_ANALOGS, 19, 1,
471             new ComfoAirCommandType[] { ANALOG2_NEGATIVE, ANALOG2_MIN, ANALOG2_MAX, ANALOG2_VALUE, ANALOG2_VOLT },
472             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 1 }, 0x02),
473     ANALOG3_MODE(ComfoAirBindingConstants.CG_ANALOG3_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MODE,
474             DataTypeBoolean.getInstance(), new int[] { 0x04 }, Constants.REQUEST_SET_ANALOGS, 19, 1,
475             new ComfoAirCommandType[] { ANALOG3_NEGATIVE, ANALOG3_MIN, ANALOG3_MAX, ANALOG3_VALUE, ANALOG3_VOLT },
476             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 1 }, 0x04),
477     ANALOG4_MODE(ComfoAirBindingConstants.CG_ANALOG4_PREFIX + ComfoAirBindingConstants.CHANNEL_ANALOG_MODE,
478             DataTypeBoolean.getInstance(), new int[] { 0x08 }, Constants.REQUEST_SET_ANALOGS, 19, 1,
479             new ComfoAirCommandType[] { ANALOG4_NEGATIVE, ANALOG4_MIN, ANALOG4_MAX, ANALOG4_VALUE, ANALOG4_VOLT },
480             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 1 }, 0x08),
481     RF_MODE(ComfoAirBindingConstants.CG_ANALOGRF_PREFIX + ComfoAirBindingConstants.CHANNEL_RF_MODE,
482             DataTypeBoolean.getInstance(), new int[] { 0x10 }, Constants.REQUEST_SET_ANALOGS, 19, 1,
483             new ComfoAirCommandType[] { RF_NEGATIVE, RF_MIN, RF_MAX, RF_VALUE }, Constants.REQUEST_GET_ANALOGS,
484             Constants.REPLY_GET_ANALOGS, new int[] { 1 }, 0x10),
485     IS_L1_SWITCH(ComfoAirBindingConstants.CG_INPUTS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_L1_SWITCH,
486             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_INPUTS, Constants.REPLY_GET_INPUTS, new int[] { 0 },
487             0x01),
488     IS_L2_SWITCH(ComfoAirBindingConstants.CG_INPUTS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_L2_SWITCH,
489             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_INPUTS, Constants.REPLY_GET_INPUTS, new int[] { 0 },
490             0x02),
491     IS_BATHROOM_SWITCH(ComfoAirBindingConstants.CG_INPUTS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_BATHROOM_SWITCH,
492             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_INPUTS, Constants.REPLY_GET_INPUTS, new int[] { 1 },
493             0x01),
494     IS_COOKERHOOD_SWITCH(
495             ComfoAirBindingConstants.CG_INPUTS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_COOKERHOOD_SWITCH,
496             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_INPUTS, Constants.REPLY_GET_INPUTS, new int[] { 1 },
497             0x02),
498     IS_EXTERNAL_FILTER(ComfoAirBindingConstants.CG_INPUTS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_EXTERNAL_FILTER,
499             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_INPUTS, Constants.REPLY_GET_INPUTS, new int[] { 1 },
500             0x04),
501     IS_WTW(ComfoAirBindingConstants.CG_INPUTS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_WTW,
502             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_INPUTS, Constants.REPLY_GET_INPUTS, new int[] { 1 },
503             0x08),
504     IS_BATHROOM2_SWITCH(
505             ComfoAirBindingConstants.CG_INPUTS_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_BATHROOM2_SWITCH,
506             DataTypeBoolean.getInstance(), Constants.REQUEST_GET_INPUTS, Constants.REPLY_GET_INPUTS, new int[] { 1 },
507             0x10),
508     IS_ANALOG1(ComfoAirBindingConstants.CG_ANALOG1_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_ANALOG,
509             DataTypeBoolean.getInstance(), new int[] { 0x01 }, Constants.REQUEST_SET_ANALOGS, 19, 0,
510             new ComfoAirCommandType[] { ANALOG1_MODE, ANALOG1_NEGATIVE, ANALOG1_MIN, ANALOG1_MAX, ANALOG1_VALUE,
511                     ANALOG1_VOLT },
512             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 0 }, 0x01),
513     IS_ANALOG2(ComfoAirBindingConstants.CG_ANALOG1_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_ANALOG,
514             DataTypeBoolean.getInstance(), new int[] { 0x02 }, Constants.REQUEST_SET_ANALOGS, 19, 0,
515             new ComfoAirCommandType[] { ANALOG2_MODE, ANALOG2_NEGATIVE, ANALOG2_MIN, ANALOG2_MAX, ANALOG2_VALUE,
516                     ANALOG2_VOLT },
517             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 0 }, 0x02),
518     IS_ANALOG3(ComfoAirBindingConstants.CG_ANALOG1_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_ANALOG,
519             DataTypeBoolean.getInstance(), new int[] { 0x04 }, Constants.REQUEST_SET_ANALOGS, 19, 0,
520             new ComfoAirCommandType[] { ANALOG3_MODE, ANALOG3_NEGATIVE, ANALOG3_MIN, ANALOG3_MAX, ANALOG3_VALUE,
521                     ANALOG3_VOLT },
522             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 0 }, 0x04),
523     IS_ANALOG4(ComfoAirBindingConstants.CG_ANALOG1_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_ANALOG,
524             DataTypeBoolean.getInstance(), new int[] { 0x08 }, Constants.REQUEST_SET_ANALOGS, 19, 0,
525             new ComfoAirCommandType[] { ANALOG4_MODE, ANALOG4_NEGATIVE, ANALOG4_MIN, ANALOG4_MAX, ANALOG4_VALUE,
526                     ANALOG4_VOLT },
527             Constants.REQUEST_GET_ANALOGS, Constants.REPLY_GET_ANALOGS, new int[] { 0 }, 0x08),
528     IS_RF(ComfoAirBindingConstants.CG_ANALOGRF_PREFIX + ComfoAirBindingConstants.CHANNEL_IS_RF,
529             DataTypeBoolean.getInstance(), new int[] { 0x10 }, Constants.REQUEST_SET_ANALOGS, 19, 0,
530             new ComfoAirCommandType[] { RF_MODE, RF_NEGATIVE, RF_MIN, RF_MAX, RF_VALUE }, Constants.REQUEST_GET_ANALOGS,
531             Constants.REPLY_GET_ANALOGS, new int[] { 0 }, 0x10);
532
533     private final String key;
534     private final ComfoAirDataType dataType;
535
536     /*
537      * Possible values
538      */
539     private final int @Nullable [] possibleValues;
540
541     /*
542      * Cmd code to change properties on the comfoair.
543      */
544     private final int changeCommand;
545
546     /*
547      * The size of the data block.
548      */
549     private final int changeDataSize;
550
551     /*
552      * The byte inside the data block which holds the crucial value.
553      */
554     private final int changeDataPos;
555
556     /*
557      * Affected commands which should be refreshed after a successful change
558      * command call.
559      */
560     private final ComfoAirCommandType @Nullable [] changeAffected;
561
562     /*
563      * Command for reading properties.
564      */
565     private final int readCommand;
566
567     /*
568      * ACK Command which identifies the matching response.
569      */
570     private final int readReplyCommand;
571
572     /*
573      * The byte position inside the response data.
574      */
575     private final int @Nullable [] readReplyDataPos;
576
577     /*
578      * Bit mask for boolean response properties to identify a true value.
579      */
580     private final int readReplyDataBits;
581
582     /*
583      * Constructor for full read/write command
584      */
585     private ComfoAirCommandType(String key, ComfoAirDataType dataType, int @Nullable [] possibleValues,
586             int changeCommand, int changeDataSize, int changeDataPos, ComfoAirCommandType @Nullable [] changeAffected,
587             int readCommand, int readReplyCommand, int @Nullable [] readReplyDataPos, int readReplyDataBits) {
588         this.key = key;
589         this.dataType = dataType;
590         this.possibleValues = possibleValues;
591         this.changeCommand = changeCommand;
592         this.changeDataSize = changeDataSize;
593         this.changeDataPos = changeDataPos;
594         this.changeAffected = changeAffected;
595         this.readCommand = readCommand;
596         this.readReplyCommand = readReplyCommand;
597         this.readReplyDataPos = readReplyDataPos;
598         this.readReplyDataBits = readReplyDataBits;
599     }
600
601     /*
602      * Constructor for read/write command w/o predefined readReplyDataBits
603      */
604     private ComfoAirCommandType(String key, ComfoAirDataType dataType, int[] possibleValues, int changeCommand,
605             int changeDataSize, int changeDataPos, ComfoAirCommandType[] changeAffected, int readCommand,
606             int readReplyCommand, int[] readReplyDataPos) {
607         this(key, dataType, possibleValues, changeCommand, changeDataSize, changeDataPos, changeAffected, readCommand,
608                 readReplyCommand, readReplyDataPos, 0);
609     }
610
611     /*
612      * Constructor for read/write command w/o predefined readReplyDataBits & possibleValues
613      */
614     private ComfoAirCommandType(String key, ComfoAirDataType dataType, int changeCommand, int changeDataSize,
615             int changeDataPos, ComfoAirCommandType[] changeAffected, int readCommand, int readReplyCommand,
616             int[] readReplyDataPos) {
617         this(key, dataType, null, changeCommand, changeDataSize, changeDataPos, changeAffected, readCommand,
618                 readReplyCommand, readReplyDataPos, 0);
619     }
620
621     /*
622      * Constructor for write-only command (reset)
623      */
624     private ComfoAirCommandType(String key, ComfoAirDataType dataType, int[] possibleValues, int changeCommand,
625             int changeDataSize, int changeDataPos, ComfoAirCommandType[] changeAffected) {
626         this(key, dataType, possibleValues, changeCommand, changeDataSize, changeDataPos, changeAffected, 0, 0, null,
627                 0);
628     }
629
630     /*
631      * Constructor for read-only command
632      */
633     private ComfoAirCommandType(String key, ComfoAirDataType dataType, int readCommand, int readReplyCommand,
634             int[] readReplyDataPos, int readReplyDataBits) {
635         this(key, dataType, null, 0, 0, 0, null, readCommand, readReplyCommand, readReplyDataPos, readReplyDataBits);
636     }
637
638     /*
639      * Constructor for read-only command w/o readReplyDataBits
640      */
641     private ComfoAirCommandType(String key, ComfoAirDataType dataType, int readCommand, int readReplyCommand,
642             int[] readReplyDataPos) {
643         this(key, dataType, null, 0, 0, 0, null, readCommand, readReplyCommand, readReplyDataPos, 0);
644     }
645
646     public static class Constants {
647         public static final int REQUEST_GET_INPUTS = 0x03;
648         public static final int REPLY_GET_INPUTS = 0x04;
649         public static final int REQUEST_GET_FAN = 0x0b;
650         public static final int REPLY_GET_FAN = 0x0c;
651         public static final int REQUEST_GET_ANALOG_VOLTS = 0x13;
652         public static final int REPLY_GET_ANALOG_VOLTS = 0x14;
653         public static final int REQUEST_GET_FIRMWARE = 0x69;
654         public static final int REPLY_GET_FIRMWARE = 0x6a;
655         public static final int REQUEST_GET_SENSORS = 0x97;
656         public static final int REPLY_GET_SENSORS = 0x98;
657         public static final int REQUEST_SET_LEVEL = 0x99;
658         public static final int REQUEST_SET_RS232 = 0x9b;
659         public static final int REPLY_SET_RS232 = 0x9c;
660         public static final int REQUEST_GET_ANALOGS = 0x9d;
661         public static final int REPLY_GET_ANALOGS = 0x9e;
662         public static final int REQUEST_SET_ANALOGS = 0x9f;
663         public static final int REQUEST_GET_DELAYS = 0xc9;
664         public static final int REPLY_GET_DELAYS = 0xca;
665         public static final int REQUEST_SET_DELAYS = 0xcb;
666         public static final int REQUEST_GET_FAN_LEVEL = 0xcd;
667         public static final int REPLY_GET_FAN_LEVEL = 0xce;
668         public static final int REQUEST_SET_FAN_LEVEL = 0xcf;
669         public static final int REQUEST_GET_TEMPS = 0xd1;
670         public static final int REPLY_GET_TEMPS = 0xd2;
671         public static final int REQUEST_SET_TEMPS = 0xd3;
672         public static final int REQUEST_GET_STATES = 0xd5;
673         public static final int REPLY_GET_STATES = 0xd6;
674         public static final int REQUEST_SET_STATES = 0xd7;
675         public static final int REQUEST_GET_ERRORS = 0xd9;
676         public static final int REPLY_GET_ERRORS = 0xda;
677         public static final int REQUEST_SET_RESETS = 0xdb;
678         public static final int REQUEST_GET_HOURS = 0xdd;
679         public static final int REPLY_GET_HOURS = 0xde;
680         public static final int REQUEST_GET_BYPASS = 0xdf;
681         public static final int REPLY_GET_BYPASS = 0xe0;
682         public static final int REQUEST_GET_PREHEATER = 0xe1;
683         public static final int REPLY_GET_PREHEATER = 0xe2;
684         public static final int REQUEST_GET_RF = 0xe5;
685         public static final int REPLY_GET_RF = 0xe6;
686         public static final int REQUEST_GET_GHX = 0xeb;
687         public static final int REPLY_GET_GHX = 0xec;
688         public static final int REQUEST_SET_GHX = 0xed;
689
690         public static final String[] EMPTY_STRING_ARRAY = new String[0];
691         public static final int[] EMPTY_INT_ARRAY = new int[0];
692         public static final ComfoAirCommandType[] EMPTY_TYPE_ARRAY = new ComfoAirCommandType[0];
693     }
694
695     /**
696      * @return command key
697      */
698     public String getKey() {
699         return key;
700     }
701
702     /**
703      * @return data type for this command key
704      */
705     public ComfoAirDataType getDataType() {
706         return dataType;
707     }
708
709     /**
710      * @return readCommand for this command key
711      */
712     public int getReadCommand() {
713         return readCommand;
714     }
715
716     /**
717      * @return readCommand for this command key
718      */
719     public int getReadReplyCommand() {
720         return readReplyCommand;
721     }
722
723     /**
724      * @return possible byte values
725      */
726     public int @Nullable [] getPossibleValues() {
727         return possibleValues;
728     }
729
730     /**
731      * @return relevant byte position inside the response byte value array
732      */
733     public int getChangeDataPos() {
734         return changeDataPos;
735     }
736
737     /**
738      * @return generate a byte value sequence for the response stream
739      */
740     public int[] getChangeDataTemplate() {
741         int[] template = new int[changeDataSize];
742         for (int i = 0; i < template.length; i++) {
743             template[i] = 0x00;
744         }
745         return template;
746     }
747
748     /**
749      * @return byte position inside the request byte value array
750      */
751     public int @Nullable [] getReadReplyDataPos() {
752         return readReplyDataPos;
753     }
754
755     /**
756      * @return bit mask for the response byte value
757      */
758     public int getReadReplyDataBits() {
759         return readReplyDataBits;
760     }
761
762     /**
763      * Get single read command to update item.
764      *
765      * @param key
766      *
767      * @return ComfoAirCommand identified by key
768      */
769     public static @Nullable ComfoAirCommand getReadCommand(String key) {
770         ComfoAirCommandType commandType = getCommandTypeByKey(key);
771
772         if (commandType != null && commandType.readCommand > 0) {
773             return new ComfoAirCommand(key);
774         }
775         return null;
776     }
777
778     /**
779      * Get a command to change properties on the comfoair.
780      *
781      * @param key
782      *            command key
783      * @param command
784      *            new state
785      * @return initialized ComfoAirCommand
786      */
787     public static @Nullable ComfoAirCommand getChangeCommand(String key, Command command) {
788         ComfoAirCommandType commandType = getCommandTypeByKey(key);
789
790         if (commandType != null) {
791             ComfoAirDataType dataType = commandType.getDataType();
792
793             State value = (State) command;
794
795             int[] data = dataType.convertFromState(value, commandType);
796             DecimalType decimalValue = value.as(DecimalType.class);
797             if (decimalValue != null) {
798                 int intValue = decimalValue.intValue();
799
800                 if (data != null) {
801                     int dataPosition = commandType.getChangeDataPos();
802                     return new ComfoAirCommand(key, commandType.changeCommand, null, data, dataPosition, intValue);
803                 }
804             }
805         }
806         return null;
807     }
808
809     /**
810      * Get all commands which should be refreshed after a successful change
811      * command.
812      *
813      * @param key
814      *            command key
815      * @param usedKeys
816      * @return ComfoAirCommand's which should be updated after a modifying
817      *         ComfoAirCommand named by key
818      */
819     public static Collection<ComfoAirCommand> getAffectedReadCommands(String key, Set<String> usedKeys) {
820         Map<Integer, ComfoAirCommand> commands = new HashMap<>();
821
822         ComfoAirCommandType commandType = getCommandTypeByKey(key);
823         if (commandType != null) {
824             uniteCommandsMap(commands, commandType);
825
826             if (commandType.changeAffected != null) {
827                 for (ComfoAirCommandType affectedCommandType : commandType.changeAffected) {
828                     // refresh affected event keys only when they are used
829                     if (usedKeys.contains(affectedCommandType.getKey())) {
830                         uniteCommandsMap(commands, affectedCommandType);
831                     }
832                 }
833             }
834         }
835         return commands.values();
836     }
837
838     /**
839      * Get all commands which receive informations to update items.
840      *
841      * @return all ComfoAirCommand's identified by keys
842      */
843     public static Collection<ComfoAirCommand> getReadCommandsByEventTypes(List<String> keys) {
844         Map<Integer, ComfoAirCommand> commands = new HashMap<>();
845         for (ComfoAirCommandType entry : values()) {
846             if (keys.contains(entry.key)) {
847                 uniteCommandsMap(commands, entry);
848             }
849         }
850         return commands.values();
851     }
852
853     /**
854      * Get commandtypes which matches the replyCmd.
855      *
856      * @param replyCmd
857      *            reply command byte value
858      * @return ComfoAirCommandType identified by replyCmd
859      */
860     public static List<ComfoAirCommandType> getCommandTypesByReplyCmd(int replyCmd) {
861         List<ComfoAirCommandType> commands = new ArrayList<>();
862         for (ComfoAirCommandType entry : values()) {
863             if (entry.readReplyCommand == replyCmd) {
864                 commands.add(entry);
865             }
866         }
867         return commands;
868     }
869
870     /**
871      * Get a specific command.
872      *
873      * @param key
874      *            command key
875      * @return ComfoAirCommandType identified by key
876      */
877     public static @Nullable ComfoAirCommandType getCommandTypeByKey(String key) {
878         for (ComfoAirCommandType entry : values()) {
879             if (entry.key.equals(key)) {
880                 return entry;
881             }
882         }
883         return null;
884     }
885
886     private static void uniteCommandsMap(Map<Integer, ComfoAirCommand> commands, ComfoAirCommandType commandType) {
887         if (commandType.readReplyCommand != 0) {
888             int replyCmd = commandType.readReplyCommand;
889
890             ComfoAirCommand command = commands.get(replyCmd);
891
892             if (command == null) {
893                 command = new ComfoAirCommand(commandType.key);
894                 commands.put(replyCmd, command);
895             } else {
896                 command.addKey(commandType.key);
897             }
898         }
899     }
900 }