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