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.rfxcom.internal;
15 import java.util.AbstractMap;
16 import java.util.Collections;
17 import java.util.HashMap;
20 import java.util.stream.Collectors;
21 import java.util.stream.Stream;
23 import org.eclipse.jdt.annotation.NonNullByDefault;
24 import org.openhab.binding.rfxcom.internal.config.RFXComDeviceConfiguration;
25 import org.openhab.binding.rfxcom.internal.config.RFXComLighting4DeviceConfiguration;
26 import org.openhab.binding.rfxcom.internal.config.RFXComRawDeviceConfiguration;
27 import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType;
28 import org.openhab.core.thing.ThingTypeUID;
31 * The {@link RFXComBindingConstants} class defines common constants, which are
32 * used across the whole binding.
34 * @author Pauli Anttila - Initial contribution
37 public class RFXComBindingConstants {
39 public static final String BINDING_ID = "rfxcom";
41 // List of all Bridge Type UIDs
42 public static final String BRIDGE_TYPE_MANUAL_BRIDGE = "bridge";
43 public static final String BRIDGE_TYPE_TCP_BRIDGE = "tcpbridge";
44 public static final String BRIDGE_TYPE_RFXTRX433 = "RFXtrx433";
45 public static final String BRIDGE_TYPE_RFXTRX315 = "RFXtrx315";
46 public static final String BRIDGE_TYPE_RFXREC433 = "RFXrec433";
48 public static final ThingTypeUID BRIDGE_MANUAL = new ThingTypeUID(BINDING_ID, BRIDGE_TYPE_MANUAL_BRIDGE);
49 public static final ThingTypeUID BRIDGE_TCP = new ThingTypeUID(BINDING_ID, BRIDGE_TYPE_TCP_BRIDGE);
50 public static final ThingTypeUID BRIDGE_RFXTRX443 = new ThingTypeUID(BINDING_ID, BRIDGE_TYPE_RFXTRX433);
51 public static final ThingTypeUID BRIDGE_RFXTRX315 = new ThingTypeUID(BINDING_ID, BRIDGE_TYPE_RFXTRX315);
52 public static final ThingTypeUID BRIDGE_RFXREC443 = new ThingTypeUID(BINDING_ID, BRIDGE_TYPE_RFXREC433);
54 public static final int MAX_RFXCOM_MESSAGE_LEN = 256;
57 * Presents all supported Bridge types by RFXCOM binding.
59 public static final Set<ThingTypeUID> SUPPORTED_BRIDGE_THING_TYPES_UIDS = Collections
60 .unmodifiableSet(Stream.of(BRIDGE_MANUAL, BRIDGE_TCP, BRIDGE_RFXTRX443, BRIDGE_RFXTRX315, BRIDGE_RFXREC443)
61 .collect(Collectors.toSet()));
64 * Presents all discoverable Bridge types by RFXCOM binding.
66 public static final Set<ThingTypeUID> DISCOVERABLE_BRIDGE_THING_TYPES_UIDS = Collections.unmodifiableSet(
67 Stream.of(BRIDGE_RFXTRX443, BRIDGE_RFXTRX315, BRIDGE_RFXREC443).collect(Collectors.toSet()));
69 // List of all Channel ids
70 public static final String CHANNEL_RAW_MESSAGE = "rawMessage";
71 public static final String CHANNEL_RAW_PAYLOAD = "rawPayload";
72 public static final String CHANNEL_PULSES = "pulses";
73 public static final String CHANNEL_SHUTTER = "shutter";
74 public static final String CHANNEL_VENETIAN_BLIND = "venetianBlind";
75 public static final String CHANNEL_SUN_WIND_DETECTOR = "sunWindDetector";
76 public static final String CHANNEL_COMMAND = "command";
77 public static final String CHANNEL_COMMAND_SECOND = "command2nd";
78 public static final String CHANNEL_CONTROL = "control";
79 public static final String CHANNEL_PROGRAM = "program";
80 public static final String CHANNEL_COMMAND_ID = "commandId";
81 public static final String CHANNEL_COMMAND_STRING = "commandString";
82 public static final String CHANNEL_MOOD = "mood";
83 public static final String CHANNEL_SIGNAL_LEVEL = "signalLevel";
84 public static final String CHANNEL_DIMMING_LEVEL = "dimmingLevel";
85 public static final String CHANNEL_UV = "uv";
86 public static final String CHANNEL_FAN_LIGHT = "fanLight";
87 public static final String CHANNEL_FAN_SPEED = "fanSpeed";
88 public static final String CHANNEL_TEMPERATURE = "temperature";
89 public static final String CHANNEL_FOOD_TEMPERATURE = "foodTemperature";
90 public static final String CHANNEL_BBQ_TEMPERATURE = "bbqTemperature";
91 public static final String CHANNEL_CHILL_TEMPERATURE = "chillTemperature";
92 public static final String CHANNEL_HUMIDITY = "humidity";
93 public static final String CHANNEL_HUMIDITY_STATUS = "humidityStatus";
94 public static final String CHANNEL_BATTERY_LEVEL = "batteryLevel";
95 public static final String CHANNEL_LOW_BATTERY = "lowBattery";
96 public static final String CHANNEL_PRESSURE = "pressure";
97 public static final String CHANNEL_FORECAST = "forecast";
98 public static final String CHANNEL_RAIN_RATE = "rainRate";
99 public static final String CHANNEL_RAIN_TOTAL = "rainTotal";
100 public static final String CHANNEL_WIND_DIRECTION = "windDirection";
101 public static final String CHANNEL_WIND_SPEED = "windSpeed";
102 public static final String CHANNEL_AVG_WIND_SPEED = "avgWindSpeed";
103 public static final String CHANNEL_INSTANT_POWER = "instantPower";
104 public static final String CHANNEL_TOTAL_USAGE = "totalUsage";
105 public static final String CHANNEL_INSTANT_AMPS = "instantAmp";
106 public static final String CHANNEL_TOTAL_AMP_HOUR = "totalAmpHour";
107 public static final String CHANNEL_CHANNEL1_AMPS = "channel1Amps";
108 public static final String CHANNEL_CHANNEL2_AMPS = "channel2Amps";
109 public static final String CHANNEL_CHANNEL3_AMPS = "channel3Amps";
110 public static final String CHANNEL_STATUS = "status";
111 public static final String CHANNEL_MOTION = "motion";
112 public static final String CHANNEL_CONTACT = "contact";
113 public static final String CHANNEL_CONTACT_1 = "contact1";
114 public static final String CHANNEL_CONTACT_2 = "contact2";
115 public static final String CHANNEL_CONTACT_3 = "contact3";
116 public static final String CHANNEL_VOLTAGE = "voltage";
117 public static final String CHANNEL_REFERENCE_VOLTAGE = "referenceVoltage";
118 public static final String CHANNEL_SET_POINT = "setpoint";
119 public static final String CHANNEL_DATE_TIME = "dateTime";
120 public static final String CHANNEL_CHIME_SOUND = "chimeSound";
122 // List of all Thing Type UIDs
123 private static final ThingTypeUID THING_TYPE_BAROMETRIC = new ThingTypeUID(BINDING_ID, "barometric");
124 private static final ThingTypeUID THING_TYPE_BBQ_TEMPERATURE = new ThingTypeUID(BINDING_ID, "bbqtemperature");
125 private static final ThingTypeUID THING_TYPE_BLINDS1 = new ThingTypeUID(BINDING_ID, "blinds1");
126 private static final ThingTypeUID THING_TYPE_CAMERA1 = new ThingTypeUID(BINDING_ID, "camera1");
127 private static final ThingTypeUID THING_TYPE_CHIME = new ThingTypeUID(BINDING_ID, "chime");
128 private static final ThingTypeUID THING_TYPE_CURRENT = new ThingTypeUID(BINDING_ID, "current");
129 private static final ThingTypeUID THING_TYPE_CURRENT_ENERGY = new ThingTypeUID(BINDING_ID, "currentenergy");
130 private static final ThingTypeUID THING_TYPE_CURTAIN1 = new ThingTypeUID(BINDING_ID, "curtain1");
131 private static final ThingTypeUID THING_TYPE_DATE_TIME = new ThingTypeUID(BINDING_ID, "datetime");
132 private static final ThingTypeUID THING_TYPE_ENERGY = new ThingTypeUID(BINDING_ID, "energy");
133 private static final ThingTypeUID THING_TYPE_FAN = new ThingTypeUID(BINDING_ID, "fan");
134 private static final ThingTypeUID THING_TYPE_FAN_SF01 = new ThingTypeUID(BINDING_ID, "fan_sf01");
135 private static final ThingTypeUID THING_TYPE_FAN_ITHO = new ThingTypeUID(BINDING_ID, "fan_itho");
136 private static final ThingTypeUID THING_TYPE_FAN_SEAV = new ThingTypeUID(BINDING_ID, "fan_seav");
137 private static final ThingTypeUID THING_TYPE_FAN_LUCCI_DC = new ThingTypeUID(BINDING_ID, "fan_lucci_dc");
138 private static final ThingTypeUID THING_TYPE_FAN_FT1211R = new ThingTypeUID(BINDING_ID, "fan_ft1211r");
139 private static final ThingTypeUID THING_TYPE_FAN_FALMEC = new ThingTypeUID(BINDING_ID, "fan_falmec");
140 private static final ThingTypeUID THING_TYPE_FAN_LUCCI_DC_II = new ThingTypeUID(BINDING_ID, "fan_lucci_dc_ii");
141 private static final ThingTypeUID THING_TYPE_FAN_NOVY = new ThingTypeUID(BINDING_ID, "fan_novy");
142 private static final ThingTypeUID THING_TYPE_FS20 = new ThingTypeUID(BINDING_ID, "fs20");
143 private static final ThingTypeUID THING_TYPE_GAS_USAGE = new ThingTypeUID(BINDING_ID, "gasusage");
144 private static final ThingTypeUID THING_TYPE_HOME_CONFORT = new ThingTypeUID(BINDING_ID, "homeconfort");
145 private static final ThingTypeUID THING_TYPE_HUMIDITY = new ThingTypeUID(BINDING_ID, "humidity");
146 private static final ThingTypeUID THING_TYPE_IO_LINES = new ThingTypeUID(BINDING_ID, "iolines");
147 private static final ThingTypeUID THING_TYPE_LIGHTNING1 = new ThingTypeUID(BINDING_ID, "lighting1");
148 private static final ThingTypeUID THING_TYPE_LIGHTNING2 = new ThingTypeUID(BINDING_ID, "lighting2");
149 private static final ThingTypeUID THING_TYPE_LIGHTNING3 = new ThingTypeUID(BINDING_ID, "lighting3");
150 private static final ThingTypeUID THING_TYPE_LIGHTNING4 = new ThingTypeUID(BINDING_ID, "lighting4");
151 private static final ThingTypeUID THING_TYPE_LIGHTNING5 = new ThingTypeUID(BINDING_ID, "lighting5");
152 private static final ThingTypeUID THING_TYPE_LIGHTNING6 = new ThingTypeUID(BINDING_ID, "lighting6");
153 private static final ThingTypeUID THING_TYPE_POWER = new ThingTypeUID(BINDING_ID, "power");
154 private static final ThingTypeUID THING_TYPE_RADIATOR1 = new ThingTypeUID(BINDING_ID, "radiator1");
155 private static final ThingTypeUID THING_TYPE_RAIN = new ThingTypeUID(BINDING_ID, "rain");
156 private static final ThingTypeUID THING_TYPE_RAW = new ThingTypeUID(BINDING_ID, "raw");
157 private static final ThingTypeUID THING_TYPE_REMOTE_CONTROL = new ThingTypeUID(BINDING_ID, "remotecontrol");
158 private static final ThingTypeUID THING_TYPE_RFX_METER = new ThingTypeUID(BINDING_ID, "rfxmeter");
159 private static final ThingTypeUID THING_TYPE_RFX_SENSOR = new ThingTypeUID(BINDING_ID, "rfxsensor");
160 private static final ThingTypeUID THING_TYPE_RFY = new ThingTypeUID(BINDING_ID, "rfy");
161 private static final ThingTypeUID THING_TYPE_SECURITY1 = new ThingTypeUID(BINDING_ID, "security1");
162 private static final ThingTypeUID THING_TYPE_SECURITY2 = new ThingTypeUID(BINDING_ID, "security2");
163 private static final ThingTypeUID THING_TYPE_TEMPERATURE = new ThingTypeUID(BINDING_ID, "temperature");
164 private static final ThingTypeUID THING_TYPE_TEMPERATURE_HUMIDITY = new ThingTypeUID(BINDING_ID,
165 "temperaturehumidity");
166 private static final ThingTypeUID THING_TYPE_TEMPERATURE_HUMIDITY_BAROMETRIC = new ThingTypeUID(BINDING_ID,
167 "temperaturehumiditybarometric");
168 private static final ThingTypeUID THING_TYPE_TEMPERATURE_RAIN = new ThingTypeUID(BINDING_ID, "temperaturerain");
169 private static final ThingTypeUID THING_TYPE_THERMOSTAT1 = new ThingTypeUID(BINDING_ID, "thermostat1");
170 private static final ThingTypeUID THING_TYPE_THERMOSTAT2 = new ThingTypeUID(BINDING_ID, "thermostat2");
171 private static final ThingTypeUID THING_TYPE_THERMOSTAT3 = new ThingTypeUID(BINDING_ID, "thermostat3");
172 private static final ThingTypeUID THING_TYPE_UNDECODED = new ThingTypeUID(BINDING_ID, "undecoded");
173 private static final ThingTypeUID THING_TYPE_UV = new ThingTypeUID(BINDING_ID, "uv");
174 private static final ThingTypeUID THING_TYPE_WATER_USAGE = new ThingTypeUID(BINDING_ID, "waterusage");
175 private static final ThingTypeUID THING_TYPE_WEIGHTING_SCALE = new ThingTypeUID(BINDING_ID, "weightingscale");
176 private static final ThingTypeUID THING_TYPE_WIND = new ThingTypeUID(BINDING_ID, "wind");
179 * Presents all supported Thing types by RFXCOM binding.
181 public static final Set<ThingTypeUID> SUPPORTED_DEVICE_THING_TYPES_UIDS = Collections
182 .unmodifiableSet(Stream.of(THING_TYPE_BAROMETRIC, THING_TYPE_BBQ_TEMPERATURE, THING_TYPE_BLINDS1,
183 THING_TYPE_CAMERA1, THING_TYPE_CHIME, THING_TYPE_CURRENT, THING_TYPE_CURRENT_ENERGY,
184 THING_TYPE_CURTAIN1, THING_TYPE_DATE_TIME, THING_TYPE_ENERGY, THING_TYPE_FAN, THING_TYPE_FAN_SF01,
185 THING_TYPE_FAN_ITHO, THING_TYPE_FAN_SEAV, THING_TYPE_FAN_LUCCI_DC, THING_TYPE_FAN_FT1211R,
186 THING_TYPE_FAN_FALMEC, THING_TYPE_FAN_LUCCI_DC_II, THING_TYPE_FAN_NOVY, THING_TYPE_GAS_USAGE,
187 THING_TYPE_HOME_CONFORT, THING_TYPE_HUMIDITY, THING_TYPE_IO_LINES, THING_TYPE_LIGHTNING1,
188 THING_TYPE_LIGHTNING2, THING_TYPE_LIGHTNING3, THING_TYPE_LIGHTNING4, THING_TYPE_LIGHTNING5,
189 THING_TYPE_LIGHTNING6, THING_TYPE_POWER, THING_TYPE_RADIATOR1, THING_TYPE_RAIN, THING_TYPE_RAW,
190 THING_TYPE_REMOTE_CONTROL, THING_TYPE_RFX_METER, THING_TYPE_RFX_SENSOR, THING_TYPE_RFY,
191 THING_TYPE_SECURITY1, THING_TYPE_SECURITY2, THING_TYPE_TEMPERATURE, THING_TYPE_TEMPERATURE_HUMIDITY,
192 THING_TYPE_TEMPERATURE_HUMIDITY_BAROMETRIC, THING_TYPE_TEMPERATURE_RAIN, THING_TYPE_THERMOSTAT1,
193 THING_TYPE_THERMOSTAT2, THING_TYPE_THERMOSTAT3, THING_TYPE_UNDECODED, THING_TYPE_UV,
194 THING_TYPE_WATER_USAGE, THING_TYPE_WEIGHTING_SCALE, THING_TYPE_WIND).collect(Collectors.toSet()));
197 * Map Device ThingTypeUIDs to their Configuration class
199 public static final Map<ThingTypeUID, Class<? extends RFXComDeviceConfiguration>> THING_TYPE_UID_CONFIGURATION_CLASS_MAP = Map
201 new AbstractMap.SimpleEntry<ThingTypeUID, Class<? extends RFXComDeviceConfiguration>>(
202 THING_TYPE_RAW, RFXComRawDeviceConfiguration.class),
203 new AbstractMap.SimpleEntry<ThingTypeUID, Class<? extends RFXComDeviceConfiguration>>(
204 THING_TYPE_LIGHTNING4, RFXComLighting4DeviceConfiguration.class));
207 * Map RFXCOM packet types to RFXCOM Thing types and vice versa.
209 public static final Map<PacketType, ThingTypeUID> PACKET_TYPE_THING_TYPE_UID_MAP = Collections
210 .unmodifiableMap(new HashMap<PacketType, ThingTypeUID>() {
212 put(PacketType.BAROMETRIC, RFXComBindingConstants.THING_TYPE_BAROMETRIC);
213 put(PacketType.BBQ, RFXComBindingConstants.THING_TYPE_BBQ_TEMPERATURE);
214 put(PacketType.BLINDS1, RFXComBindingConstants.THING_TYPE_BLINDS1);
215 put(PacketType.CAMERA1, RFXComBindingConstants.THING_TYPE_CAMERA1);
216 put(PacketType.CHIME, RFXComBindingConstants.THING_TYPE_CHIME);
217 put(PacketType.CURRENT, RFXComBindingConstants.THING_TYPE_CURRENT);
218 put(PacketType.CURRENT_ENERGY, RFXComBindingConstants.THING_TYPE_CURRENT_ENERGY);
219 put(PacketType.CURTAIN1, RFXComBindingConstants.THING_TYPE_CURTAIN1);
220 put(PacketType.DATE_TIME, RFXComBindingConstants.THING_TYPE_DATE_TIME);
221 put(PacketType.ENERGY, RFXComBindingConstants.THING_TYPE_ENERGY);
222 put(PacketType.FAN, RFXComBindingConstants.THING_TYPE_FAN);
223 put(PacketType.FAN_SF01, RFXComBindingConstants.THING_TYPE_FAN_SF01);
224 put(PacketType.FAN_ITHO, RFXComBindingConstants.THING_TYPE_FAN_ITHO);
225 put(PacketType.FAN_SEAV, RFXComBindingConstants.THING_TYPE_FAN_SEAV);
226 put(PacketType.FAN_LUCCI_DC, RFXComBindingConstants.THING_TYPE_FAN_LUCCI_DC);
227 put(PacketType.FAN_FT1211R, RFXComBindingConstants.THING_TYPE_FAN_FT1211R);
228 put(PacketType.FAN_FALMEC, RFXComBindingConstants.THING_TYPE_FAN_FALMEC);
229 put(PacketType.FAN_LUCCI_DC_II, RFXComBindingConstants.THING_TYPE_FAN_LUCCI_DC_II);
230 put(PacketType.FAN_NOVY, RFXComBindingConstants.THING_TYPE_FAN_NOVY);
231 put(PacketType.FS20, RFXComBindingConstants.THING_TYPE_FS20);
232 put(PacketType.GAS, RFXComBindingConstants.THING_TYPE_GAS_USAGE);
233 put(PacketType.HOME_CONFORT, RFXComBindingConstants.THING_TYPE_HOME_CONFORT);
234 put(PacketType.HUMIDITY, RFXComBindingConstants.THING_TYPE_HUMIDITY);
235 put(PacketType.IO_LINES, RFXComBindingConstants.THING_TYPE_IO_LINES);
236 put(PacketType.LIGHTING1, RFXComBindingConstants.THING_TYPE_LIGHTNING1);
237 put(PacketType.LIGHTING2, RFXComBindingConstants.THING_TYPE_LIGHTNING2);
238 put(PacketType.LIGHTING3, RFXComBindingConstants.THING_TYPE_LIGHTNING3);
239 put(PacketType.LIGHTING4, RFXComBindingConstants.THING_TYPE_LIGHTNING4);
240 put(PacketType.LIGHTING5, RFXComBindingConstants.THING_TYPE_LIGHTNING5);
241 put(PacketType.LIGHTING6, RFXComBindingConstants.THING_TYPE_LIGHTNING6);
242 put(PacketType.POWER, RFXComBindingConstants.THING_TYPE_POWER);
243 put(PacketType.RADIATOR1, RFXComBindingConstants.THING_TYPE_RADIATOR1);
244 put(PacketType.RAIN, RFXComBindingConstants.THING_TYPE_RAIN);
245 put(PacketType.RAW, RFXComBindingConstants.THING_TYPE_RAW);
246 put(PacketType.REMOTE_CONTROL, RFXComBindingConstants.THING_TYPE_REMOTE_CONTROL);
247 put(PacketType.RFXMETER, RFXComBindingConstants.THING_TYPE_RFX_METER);
248 put(PacketType.RFXSENSOR, RFXComBindingConstants.THING_TYPE_RFX_SENSOR);
249 put(PacketType.RFY, RFXComBindingConstants.THING_TYPE_RFY);
250 put(PacketType.SECURITY1, RFXComBindingConstants.THING_TYPE_SECURITY1);
251 put(PacketType.SECURITY2, RFXComBindingConstants.THING_TYPE_SECURITY2);
252 put(PacketType.TEMPERATURE, RFXComBindingConstants.THING_TYPE_TEMPERATURE);
253 put(PacketType.TEMPERATURE_HUMIDITY, RFXComBindingConstants.THING_TYPE_TEMPERATURE_HUMIDITY);
254 put(PacketType.TEMPERATURE_HUMIDITY_BAROMETRIC,
255 RFXComBindingConstants.THING_TYPE_TEMPERATURE_HUMIDITY_BAROMETRIC);
256 put(PacketType.TEMPERATURE_RAIN, RFXComBindingConstants.THING_TYPE_TEMPERATURE_RAIN);
257 put(PacketType.THERMOSTAT1, RFXComBindingConstants.THING_TYPE_THERMOSTAT1);
258 put(PacketType.THERMOSTAT2, RFXComBindingConstants.THING_TYPE_THERMOSTAT2);
259 put(PacketType.THERMOSTAT3, RFXComBindingConstants.THING_TYPE_THERMOSTAT3);
260 put(PacketType.UNDECODED_RF_MESSAGE, RFXComBindingConstants.THING_TYPE_UNDECODED);
261 put(PacketType.UV, RFXComBindingConstants.THING_TYPE_UV);
262 put(PacketType.WATER, RFXComBindingConstants.THING_TYPE_WATER_USAGE);
263 put(PacketType.WEIGHT, RFXComBindingConstants.THING_TYPE_WEIGHTING_SCALE);
264 put(PacketType.WIND, RFXComBindingConstants.THING_TYPE_WIND);