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.siemensrds.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.thing.ThingTypeUID;
19 * The {@link RdsBindingConstants} contains the constants used by the binding
21 * @author Andrew Fiddian-Green - Initial contribution
24 public class RdsBindingConstants {
29 public static final String BINDING_ID = "siemensrds";
34 public static final String DEVICE_ID_CLOUD = "climatixic";
35 public static final String DEVICE_ID_STAT = "rds";
40 public static final ThingTypeUID THING_TYPE_CLOUD = new ThingTypeUID(BINDING_ID, DEVICE_ID_CLOUD);
42 public static final ThingTypeUID THING_TYPE_RDS = new ThingTypeUID(BINDING_ID, DEVICE_ID_STAT);
44 // ========================== URLs and HTTP stuff =========================
46 private static final String API = "https://api.climatixic.com/";
48 private static final String ARG_RDS = """
57 private static final String ARG_PARENT = "?parentId=[\"%s\"]&take=100";
58 private static final String ARG_POINT = "?filterId=[%s]";
60 public static final String URL_TOKEN = API + "Token";
61 public static final String URL_PLANTS = API + "Plants" + ARG_RDS;
62 public static final String URL_POINTS = API + "DataPoints" + ARG_PARENT;
63 public static final String URL_SETVAL = API + "DataPoints/%s";
64 public static final String URL_VALUES = API + "DataPoints/Values" + ARG_POINT;
66 public static final String HTTP_POST = "POST";
67 public static final String HTTP_GET = "GET";
68 public static final String HTTP_PUT = "PUT";
70 public static final String USER_AGENT = "User-Agent";
71 public static final String ACCEPT = "Accept";
72 public static final String CONTENT_TYPE = "Content-Type";
74 public static final String MOZILLA = "Mozilla/5.0";
75 public static final String APPLICATION_JSON = "application/json;charset=UTF-8";
76 public static final String TEXT_PLAIN = "text/plain;charset=UTF-8";
77 public static final String SUBSCRIPTION_KEY = "Ocp-Apim-Subscription-Key";
78 public static final String AUTHORIZATION = "Authorization";
79 public static final String BEARER = "Bearer %s";
81 public static final String TOKEN_REQUEST = "grant_type=password&username=%s&password=%s&expire_minutes=20160";
84 * setup parameters for de-bouncing of state changes (time in seconds) so state
85 * changes that occur within this time window are ignored
87 public static final long DEBOUNCE_DELAY = 15;
90 * setup parameters for lazy polling
92 public static final int LAZY_POLL_INTERVAL = 60;
95 * setup parameters for fast polling bursts a burst comprises FAST_POLL_CYCLES
96 * polling calls spaced at FAST_POLL_INTERVAL for example 5 polling calls made
97 * at 4 second intervals (e.g. 6 x 4 => 24 seconds)
99 public static final int FAST_POLL_CYCLES = 6;
100 public static final int FAST_POLL_INTERVAL = 8;
103 * setup parameters for device discovery
105 public static final int DISCOVERY_TIMEOUT = 5;
106 public static final int DISCOVERY_START_DELAY = 30;
107 public static final int DISCOVERY_REFRESH_PERIOD = 600;
109 public static final String PROP_PLANT_ID = "plantId";
112 * ==================== USED DATA POINTS ==========================
114 * where: HIE_xxx = the point class suffix part of the hierarchy name in the
115 * ClimatixIc server, and CHA_xxx = the Channel ID in the OpenHAB binding
119 public static final String HIE_DESCRIPTION = "'Description";
122 public static final String HIE_ONLINE = "#Online";
124 // room (actual) temperature (read-only)
125 protected static final String CHA_ROOM_TEMP = "roomTemperature";
126 public static final String HIE_ROOM_TEMP = "'RTemp";
128 // room relative humidity (read-only)
129 protected static final String CHA_ROOM_HUMIDITY = "roomHumidity";
130 public static final String HIE_ROOM_HUMIDITY = "'RHuRel";
132 // room air quality (low/med/high) (read-only)
133 protected static final String CHA_ROOM_AIR_QUALITY = "roomAirQuality";
134 public static final String HIE_ROOM_AIR_QUALITY = "'RAQualInd";
136 // energy savings level (green leaf) (poor..excellent) (read-write)
137 // note: writing the value "5" forces the device to green leaf mode
138 protected static final String CHA_ENERGY_SAVINGS_LEVEL = "energySavingsLevel";
139 public static final String HIE_ENERGY_SAVINGS_LEVEL = "'REei";
141 // outside air temperature (read-only)
142 protected static final String CHA_OUTSIDE_TEMP = "outsideTemperature";
143 public static final String HIE_OUTSIDE_TEMP = "'TOa";
145 // set-point override (read-write)
146 protected static final String CHA_TARGET_TEMP = "targetTemperature";
147 public static final String HIE_TARGET_TEMP = "'SpTR";
149 // heating/cooling state (read-only)
150 protected static final String CHA_OUTPUT_STATE = "thermostatOutputState";
151 public static final String HIE_OUTPUT_STATE = "'HCSta";
154 * thermostat occupancy state (absent, present) (read-write) NOTE: uses
155 * different parameters as follows.. OccMod = 2, 3 to read, and command to, the
156 * absent, present states
158 protected static final String CHA_STAT_OCC_MODE_PRESENT = "occupancyModePresent";
159 public static final String HIE_STAT_OCC_MODE_PRESENT = "'OccMod";
162 * thermostat program mode (read-write) NOTE: uses different parameters as
163 * follows.. PrOpModRsn presentPriority < / > 13 combined with OccMod = 2 to
164 * read the manual, auto mode CmfBtn = 1 to command to the manual mode REei = 5
165 * to command to the auto mode
167 protected static final String CHA_STAT_AUTO_MODE = "thermostatAutoMode";
168 public static final String HIE_PR_OP_MOD_RSN = "'PrOpModRsn";
169 public static final String HIE_STAT_CMF_BTN = "'CmfBtn";
172 * domestic hot water state (off, on) (read-write) NOTE: uses different
173 * parameters as follows.. DhwMod = 1, 2 to read, and command to, the off, on
176 protected static final String CHA_DHW_OUTPUT_STATE = "hotWaterOutputState";
177 public static final String HIE_DHW_OUTPUT_STATE = "'DhwMod";
180 * domestic hot water program mode (manual, auto) (read-write) NOTE: uses
181 * different parameters as follows.. DhwMod presentPriority < / > 13 to read the
182 * manual, auto mode DhwMod = 0 to command to the auto mode DhwMod = its current
183 * value to command it's resp. manual states
185 protected static final String CHA_DHW_AUTO_MODE = "hotWaterAutoMode";
188 * openHAB status strings
190 protected static final String STATE_NEITHER = "Neither";
191 protected static final String STATE_OFF = "Off";
193 public static final ChannelMap[] CHAN_MAP = { new ChannelMap(CHA_ROOM_TEMP, HIE_ROOM_TEMP),
194 new ChannelMap(CHA_ROOM_HUMIDITY, HIE_ROOM_HUMIDITY), new ChannelMap(CHA_OUTSIDE_TEMP, HIE_OUTSIDE_TEMP),
195 new ChannelMap(CHA_TARGET_TEMP, HIE_TARGET_TEMP),
196 new ChannelMap(CHA_ROOM_AIR_QUALITY, HIE_ROOM_AIR_QUALITY),
197 new ChannelMap(CHA_ENERGY_SAVINGS_LEVEL, HIE_ENERGY_SAVINGS_LEVEL),
198 new ChannelMap(CHA_OUTPUT_STATE, HIE_OUTPUT_STATE),
199 new ChannelMap(CHA_STAT_OCC_MODE_PRESENT, HIE_STAT_OCC_MODE_PRESENT),
200 new ChannelMap(CHA_STAT_AUTO_MODE, HIE_PR_OP_MOD_RSN),
201 new ChannelMap(CHA_DHW_OUTPUT_STATE, HIE_DHW_OUTPUT_STATE),
202 new ChannelMap(CHA_DHW_AUTO_MODE, HIE_DHW_OUTPUT_STATE) };
205 * ==================== UNUSED DATA POINTS ======================
207 * room air quality (numeric value)
209 * private static final String HIE_ROOM_AIR_QUALITY_VAL = "RAQual";
211 * other set-points for phases of the time program mode
213 * private static final String HIE_CMF_SETPOINT = "SpHCmf";
215 * private static final String HIE_PCF_SETPOINT = "SpHPcf";
217 * private static final String HIE_ECO_SETPOINT = "SpHEco";
219 * private static final String HIE_PRT_SETPOINT = "SpHPrt";
221 * enable heating control
223 * private static final String HIE_ENABLE_HEATING = "EnHCtl";
227 * private static final String HIE_COMFORT_BUTTON = "CmfBtn";
234 public static final String LOG_HTTP_COMMAND = "{} for url {} characters long";
235 public static final String LOG_CONTENT_LENGTH = "{} {} characters..";
236 public static final String LOG_PAYLOAD_FMT = "{} {}";
238 public static final String LOG_HTTP_COMMAND_ABR = "{} for url {} characters long (set log level to TRACE to see full url)..";
239 public static final String LOG_CONTENT_LENGTH_ABR = "{} {} characters (set log level to TRACE to see full string)..";
240 public static final String LOG_PAYLOAD_FMT_ABR = "{} {} ...";
242 public static final String LOG_RECEIVED_MSG = "received";
243 public static final String LOG_RECEIVED_MARK = "<<";
245 public static final String LOG_SENDING_MSG = "sending";
246 public static final String LOG_SENDING_MARK = ">>";
248 public static final String LOG_SYSTEM_EXCEPTION = "system exception in {}, type={}, message=\"{}\"";
249 public static final String LOG_RUNTIME_EXCEPTION = "runtime exception in {}, type={}, message=\"{}\"";
253 * @author Andrew Fiddian-Green - Initial contribution
260 public ChannelMap(String channelId, String pointClass) {
262 this.clazz = pointClass;