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