iobroker.acinfinity 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "acinfinity",
4
- "version": "0.7.1",
4
+ "version": "0.7.2",
5
5
  "news": {
6
+ "0.7.2": {
7
+ "en": "Code quality: migrate to ESLint 9 with @iobroker/eslint-config",
8
+ "de": "Codequalität: Migration auf ESLint 9 mit @iobroker/eslint-config",
9
+ "ru": "Качество кода: миграция на ESLint 9 с @iobroker/eslint-config",
10
+ "pt": "Qualidade do código: migração para ESLint 9 com @iobroker/eslint-config",
11
+ "nl": "Codekwaliteit: migratie naar ESLint 9 met @iobroker/eslint-config",
12
+ "fr": "Qualité du code: migration vers ESLint 9 avec @iobroker/eslint-config",
13
+ "it": "Qualità del codice: migrazione a ESLint 9 con @iobroker/eslint-config",
14
+ "es": "Calidad del código: migración a ESLint 9 con @iobroker/eslint-config",
15
+ "pl": "Jakość kodu: migracja do ESLint 9 z @iobroker/eslint-config",
16
+ "uk": "Якість коду: міграція на ESLint 9 з @iobroker/eslint-config",
17
+ "zh-cn": "代码质量:迁移到 ESLint 9 并使用 @iobroker/eslint-config"
18
+ },
6
19
  "0.7.1": {
7
20
  "en": "Add value ranges to state names for better readability",
8
21
  "de": "Wertebereiche zu Datenpunkt-Namen hinzugefügt für bessere Lesbarkeit",
package/lib/client.js CHANGED
@@ -3,14 +3,15 @@
3
3
  * Handles all API communication with AC Infinity servers
4
4
  */
5
5
 
6
- "use strict";
6
+ 'use strict';
7
7
 
8
- const axios = require("axios");
9
- const { API_BASE_URL, API_ENDPOINTS } = require("./constants");
8
+ const axios = require('axios');
9
+ const { API_BASE_URL, API_ENDPOINTS } = require('./constants');
10
10
 
11
11
  class ACInfinityClient {
12
12
  /**
13
13
  * Creates a new AC Infinity API client
14
+ *
14
15
  * @param {string} email - AC Infinity account email
15
16
  * @param {string} password - AC Infinity account password
16
17
  * @param {object} log - Logger object
@@ -22,19 +23,20 @@ class ACInfinityClient {
22
23
  this.token = null;
23
24
  this.axiosInstance = axios.create({
24
25
  timeout: 30000,
25
- validateStatus: status => status >= 200 && status < 300
26
+ validateStatus: status => status >= 200 && status < 300,
26
27
  });
27
28
  }
28
29
 
29
30
  /**
30
31
  * Creates headers for API requests
32
+ *
31
33
  * @param {boolean} useAuthToken - Whether to include authentication token
32
34
  * @returns {object}
33
35
  */
34
36
  createHeaders(useAuthToken = false) {
35
37
  const headers = {
36
- "User-Agent": "ACController/1.8.5 (com.acinfinity.humiture; build:500; iOS 17.0.1) Alamofire/5.7.1",
37
- "Content-Type": "application/x-www-form-urlencoded; charset=utf-8"
38
+ 'User-Agent': 'ACController/1.8.5 (com.acinfinity.humiture; build:500; iOS 17.0.1) Alamofire/5.7.1',
39
+ 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
38
40
  };
39
41
  if (useAuthToken && this.token) {
40
42
  headers.token = this.token;
@@ -44,6 +46,7 @@ class ACInfinityClient {
44
46
 
45
47
  /**
46
48
  * Performs API login and obtains authentication token
49
+ *
47
50
  * @returns {Promise<void>}
48
51
  */
49
52
  async login() {
@@ -52,21 +55,21 @@ class ACInfinityClient {
52
55
  const formData = `appEmail=${encodeURIComponent(this.email)}&appPasswordl=${encodeURIComponent(normalizedPassword)}`;
53
56
  this.log.debug(`Login attempt with: ${this.email}`);
54
57
 
55
- const response = await this.axiosInstance.post(
56
- `${API_BASE_URL}${API_ENDPOINTS.LOGIN}`,
57
- formData,
58
- { headers: this.createHeaders(false) }
59
- );
58
+ const response = await this.axiosInstance.post(`${API_BASE_URL}${API_ENDPOINTS.LOGIN}`, formData, {
59
+ headers: this.createHeaders(false),
60
+ });
60
61
 
61
62
  if (response.data && response.data.code === 200) {
62
63
  this.token = response.data.data.appId;
63
- this.log.debug("Login successful");
64
+ this.log.debug('Login successful');
64
65
  return;
65
66
  }
66
- throw new Error(`Login failed: ${response.data ? response.data.msg : "Unknown error"}`);
67
+ throw new Error(`Login failed: ${response.data ? response.data.msg : 'Unknown error'}`);
67
68
  } catch (error) {
68
69
  if (error.response) {
69
- throw new Error(`Login failed with status ${error.response.status}: ${error.response.data ? error.response.data.msg : "Unknown error"}`);
70
+ throw new Error(
71
+ `Login failed with status ${error.response.status}: ${error.response.data ? error.response.data.msg : 'Unknown error'}`,
72
+ );
70
73
  }
71
74
  throw new Error(`Login failed: ${error.message}`);
72
75
  }
@@ -74,6 +77,7 @@ class ACInfinityClient {
74
77
 
75
78
  /**
76
79
  * Checks if client is logged in
80
+ *
77
81
  * @returns {boolean}
78
82
  */
79
83
  isLoggedIn() {
@@ -82,6 +86,7 @@ class ACInfinityClient {
82
86
 
83
87
  /**
84
88
  * General API call with automatic re-login on 401
89
+ *
85
90
  * @param {string} endpoint
86
91
  * @param {object} data
87
92
  * @param {boolean} needsAuth
@@ -95,21 +100,19 @@ class ACInfinityClient {
95
100
  try {
96
101
  const formData = Object.entries(data)
97
102
  .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
98
- .join("&");
103
+ .join('&');
99
104
 
100
- const response = await this.axiosInstance.post(
101
- `${API_BASE_URL}${endpoint}`,
102
- formData,
103
- { headers: this.createHeaders(needsAuth) }
104
- );
105
+ const response = await this.axiosInstance.post(`${API_BASE_URL}${endpoint}`, formData, {
106
+ headers: this.createHeaders(needsAuth),
107
+ });
105
108
 
106
109
  if (response.data && response.data.code === 200) {
107
110
  return response.data.data || {};
108
111
  }
109
- throw new Error(`API call to ${endpoint} failed: ${response.data ? response.data.msg : "Unknown error"}`);
112
+ throw new Error(`API call to ${endpoint} failed: ${response.data ? response.data.msg : 'Unknown error'}`);
110
113
  } catch (error) {
111
114
  if (error.response && error.response.status === 401 && needsAuth) {
112
- this.log.info("Token expired, attempting to re-login");
115
+ this.log.info('Token expired, attempting to re-login');
113
116
  await this.login();
114
117
  return this.apiCall(endpoint, data, needsAuth);
115
118
  }
@@ -122,6 +125,7 @@ class ACInfinityClient {
122
125
 
123
126
  /**
124
127
  * Gets list of all AC Infinity devices
128
+ *
125
129
  * @returns {Promise<Array>}
126
130
  */
127
131
  async getDevicesList() {
@@ -130,35 +134,46 @@ class ACInfinityClient {
130
134
 
131
135
  /**
132
136
  * Gets mode settings for a specific device port
137
+ *
133
138
  * @param {string|number} deviceId
134
139
  * @param {number} portId
135
140
  * @returns {Promise<object>}
136
141
  */
137
142
  async getDeviceModeSettings(deviceId, portId) {
138
143
  this.log.debug(`Getting mode settings for deviceId=${deviceId}, portId=${portId}`);
139
- return this.apiCall(API_ENDPOINTS.DEVICE_MODE_SETTINGS, {
140
- devId: deviceId,
141
- port: portId
142
- }, true);
144
+ return this.apiCall(
145
+ API_ENDPOINTS.DEVICE_MODE_SETTINGS,
146
+ {
147
+ devId: deviceId,
148
+ port: portId,
149
+ },
150
+ true,
151
+ );
143
152
  }
144
153
 
145
154
  /**
146
155
  * Gets advanced settings for a device or port
156
+ *
147
157
  * @param {string|number} deviceId
148
158
  * @param {number} portId - 0 for controller-level settings
149
159
  * @returns {Promise<object>}
150
160
  */
151
161
  async getDeviceSettings(deviceId, portId) {
152
162
  this.log.debug(`Getting device settings for deviceId=${deviceId}, portId=${portId}`);
153
- return this.apiCall(API_ENDPOINTS.DEVICE_SETTINGS, {
154
- devId: deviceId,
155
- port: portId
156
- }, true);
163
+ return this.apiCall(
164
+ API_ENDPOINTS.DEVICE_SETTINGS,
165
+ {
166
+ devId: deviceId,
167
+ port: portId,
168
+ },
169
+ true,
170
+ );
157
171
  }
158
172
 
159
173
  /**
160
174
  * Sends a raw URL-encoded form payload to the addDevMode endpoint.
161
175
  * This is the single write path for all mode and speed changes.
176
+ *
162
177
  * @param {string} formData - URL-encoded form data string
163
178
  * @returns {Promise<boolean>}
164
179
  */
@@ -173,17 +188,17 @@ class ACInfinityClient {
173
188
  const response = await this.axiosInstance.post(
174
189
  `${API_BASE_URL}${API_ENDPOINTS.UPDATE_DEVICE_MODE}`,
175
190
  formData,
176
- { headers: this.createHeaders(true) }
191
+ { headers: this.createHeaders(true) },
177
192
  );
178
193
 
179
194
  if (response.data && response.data.code === 200) {
180
- this.log.debug("Mode update successful");
195
+ this.log.debug('Mode update successful');
181
196
  return true;
182
197
  }
183
- throw new Error(`Mode update failed: ${response.data ? response.data.msg : "Unknown error"}`);
198
+ throw new Error(`Mode update failed: ${response.data ? response.data.msg : 'Unknown error'}`);
184
199
  } catch (error) {
185
200
  if (error.response && error.response.status === 401) {
186
- this.log.info("Token expired, re-logging in");
201
+ this.log.info('Token expired, re-logging in');
187
202
  await this.login();
188
203
  return this.sendRawModeUpdate(formData);
189
204
  }
@@ -213,10 +228,10 @@ class ACInfinityClient {
213
228
 
214
229
  const settings = await this.getDeviceModeSettings(deviceId, portId);
215
230
  const modeSetid = settings.modeSetid;
216
- const vpdnums = (settings.vpdnums !== undefined && settings.vpdnums !== null) ? settings.vpdnums : 0;
231
+ const vpdnums = settings.vpdnums !== undefined && settings.vpdnums !== null ? settings.vpdnums : 0;
217
232
 
218
233
  // speak = active speed; 0 when mode is Off (atType=1)
219
- const speak = (atType === 2) ? onSpeed : 0;
234
+ const speak = atType === 2 ? onSpeed : 0;
220
235
 
221
236
  const formData = [
222
237
  `modeSetid=${encodeURIComponent(modeSetid)}`,
@@ -228,16 +243,19 @@ class ACInfinityClient {
228
243
  `speak=${encodeURIComponent(speak)}`,
229
244
  `curMode=${encodeURIComponent(atType)}`,
230
245
  `vpdstatus=0`,
231
- `vpdnums=${encodeURIComponent(vpdnums)}`
232
- ].join("&");
246
+ `vpdnums=${encodeURIComponent(vpdnums)}`,
247
+ ].join('&');
233
248
 
234
- this.log.info(`setDeviceMode: deviceId=${deviceId}, portId=${portId}, atType=${atType}, onSpeed=${onSpeed}, offSpeed=${offSpeed}`);
249
+ this.log.info(
250
+ `setDeviceMode: deviceId=${deviceId}, portId=${portId}, atType=${atType}, onSpeed=${onSpeed}, offSpeed=${offSpeed}`,
251
+ );
235
252
  return this.sendRawModeUpdate(formData);
236
253
  }
237
254
 
238
255
  /**
239
256
  * Updates specific mode settings parameters (timer/cycle/auto/vpd/schedule values).
240
257
  * Fetches current settings, applies overrides, and sends the full payload.
258
+ *
241
259
  * @param {string|number} deviceId
242
260
  * @param {number} portId
243
261
  * @param {Array<Array<string|number>>} keyValues - Array of [key, value] pairs to override
@@ -255,23 +273,27 @@ class ACInfinityClient {
255
273
  this.log.debug(`Current mode settings fetched for update`);
256
274
 
257
275
  // Remove fields that the API rejects in write calls
258
- const fieldsToRemove = ["devMacAddr", "ipcSetting", "devSetting"];
276
+ const fieldsToRemove = ['devMacAddr', 'ipcSetting', 'devSetting'];
259
277
  for (const field of fieldsToRemove) {
260
278
  delete settings[field];
261
279
  }
262
280
 
263
281
  // Ensure required fields exist
264
- if (!("vpdstatus" in settings)) settings.vpdstatus = 0;
265
- if (!("vpdnums" in settings)) settings.vpdnums = 0;
282
+ if (!('vpdstatus' in settings)) {
283
+ settings.vpdstatus = 0;
284
+ }
285
+ if (!('vpdnums' in settings)) {
286
+ settings.vpdnums = 0;
287
+ }
266
288
 
267
289
  settings.devId = parseInt(deviceIdStr);
268
- if ("modeSetid" in settings) {
290
+ if ('modeSetid' in settings) {
269
291
  settings.modeSetid = String(settings.modeSetid);
270
292
  }
271
293
 
272
294
  // Apply the requested overrides
273
295
  for (const [key, value] of keyValues) {
274
- settings[key] = (typeof value === "number") ? value : parseInt(String(value));
296
+ settings[key] = typeof value === 'number' ? value : parseInt(String(value));
275
297
  }
276
298
 
277
299
  // Replace any remaining null/undefined with 0
@@ -283,13 +305,14 @@ class ACInfinityClient {
283
305
 
284
306
  const formData = Object.entries(settings)
285
307
  .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
286
- .join("&");
308
+ .join('&');
287
309
 
288
310
  return this.sendRawModeUpdate(formData);
289
311
  }
290
312
 
291
313
  /**
292
314
  * Updates advanced (device/port-level) settings
315
+ *
293
316
  * @param {string|number} deviceId
294
317
  * @param {number} portId - 0 for controller-level settings
295
318
  * @param {string} deviceName - Device name (prevents API from resetting it to "None")
@@ -309,22 +332,29 @@ class ACInfinityClient {
309
332
  settings.devName = deviceName;
310
333
 
311
334
  const fieldsToRemove = [
312
- "setId", "devMacAddr", "portResistance", "devTimeZone",
313
- "sensorSetting", "sensorTransBuff", "subDeviceVersion",
314
- "secFucReportTime", "updateAllPort", "calibrationTime"
335
+ 'setId',
336
+ 'devMacAddr',
337
+ 'portResistance',
338
+ 'devTimeZone',
339
+ 'sensorSetting',
340
+ 'sensorTransBuff',
341
+ 'subDeviceVersion',
342
+ 'secFucReportTime',
343
+ 'updateAllPort',
344
+ 'calibrationTime',
315
345
  ];
316
346
  for (const field of fieldsToRemove) {
317
347
  delete settings[field];
318
348
  }
319
349
 
320
- const stringFields = ["sensorTransBuffStr", "sensorSettingStr", "portParamData", "paramSensors"];
350
+ const stringFields = ['sensorTransBuffStr', 'sensorSettingStr', 'portParamData', 'paramSensors'];
321
351
  for (const field of stringFields) {
322
352
  if (!(field in settings) || settings[field] === null) {
323
- settings[field] = "";
353
+ settings[field] = '';
324
354
  }
325
355
  }
326
356
 
327
- const defaultFields = ["sensorOneType", "isShare", "targetVpdSwitch", "sensorTwoType", "zoneSensorType"];
357
+ const defaultFields = ['sensorOneType', 'isShare', 'targetVpdSwitch', 'sensorTwoType', 'zoneSensorType'];
328
358
  for (const field of defaultFields) {
329
359
  if (!(field in settings)) {
330
360
  settings[field] = 0;
@@ -345,12 +375,12 @@ class ACInfinityClient {
345
375
 
346
376
  const formData = Object.entries(settings)
347
377
  .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
348
- .join("&");
378
+ .join('&');
349
379
 
350
380
  const response = await this.axiosInstance.post(
351
381
  `${API_BASE_URL}${API_ENDPOINTS.UPDATE_ADVANCED_SETTINGS}`,
352
382
  formData,
353
- { headers: this.createHeaders(true) }
383
+ { headers: this.createHeaders(true) },
354
384
  );
355
385
 
356
386
  if (response.data && response.data.code === 200) {
@@ -358,7 +388,7 @@ class ACInfinityClient {
358
388
  return;
359
389
  }
360
390
 
361
- throw new Error(`Failed to update advanced settings: ${response.data ? response.data.msg : "Unknown error"}`);
391
+ throw new Error(`Failed to update advanced settings: ${response.data ? response.data.msg : 'Unknown error'}`);
362
392
  }
363
393
  }
364
394
 
package/lib/constants.js CHANGED
@@ -2,17 +2,17 @@
2
2
  * Constants for AC Infinity adapter
3
3
  */
4
4
 
5
- "use strict";
5
+ 'use strict';
6
6
 
7
7
  // API constants
8
- const API_BASE_URL = "http://www.acinfinityserver.com";
8
+ const API_BASE_URL = 'http://www.acinfinityserver.com';
9
9
  const API_ENDPOINTS = {
10
- LOGIN: "/api/user/appUserLogin",
11
- DEVICE_LIST: "/api/user/devInfoListAll",
12
- DEVICE_MODE_SETTINGS: "/api/dev/getdevModeSettingList",
13
- UPDATE_DEVICE_MODE: "/api/dev/addDevMode",
14
- DEVICE_SETTINGS: "/api/dev/getDevSetting",
15
- UPDATE_ADVANCED_SETTINGS: "/api/dev/updateAdvSetting",
10
+ LOGIN: '/api/user/appUserLogin',
11
+ DEVICE_LIST: '/api/user/devInfoListAll',
12
+ DEVICE_MODE_SETTINGS: '/api/dev/getdevModeSettingList',
13
+ UPDATE_DEVICE_MODE: '/api/dev/addDevMode',
14
+ DEVICE_SETTINGS: '/api/dev/getDevSetting',
15
+ UPDATE_ADVANCED_SETTINGS: '/api/dev/updateAdvSetting',
16
16
  };
17
17
 
18
18
  // Polling intervals
@@ -21,98 +21,98 @@ const MINIMUM_POLLING_INTERVAL = 10; // seconds
21
21
 
22
22
  // Controller property keys
23
23
  const CONTROLLER_PROPERTY_KEY = {
24
- DEVICE_ID: "devId",
25
- DEVICE_NAME: "devName",
26
- MAC_ADDR: "devMacAddr",
27
- DEVICE_INFO: "deviceInfo",
28
- PORTS: "ports",
29
- HW_VERSION: "hardwareVersion",
30
- SW_VERSION: "firmwareVersion",
31
- DEVICE_TYPE: "devType",
32
- TEMPERATURE: "temperature",
33
- HUMIDITY: "humidity",
34
- VPD: "vpdnums",
35
- ONLINE: "online",
36
- TIME_ZONE: "zoneId",
24
+ DEVICE_ID: 'devId',
25
+ DEVICE_NAME: 'devName',
26
+ MAC_ADDR: 'devMacAddr',
27
+ DEVICE_INFO: 'deviceInfo',
28
+ PORTS: 'ports',
29
+ HW_VERSION: 'hardwareVersion',
30
+ SW_VERSION: 'firmwareVersion',
31
+ DEVICE_TYPE: 'devType',
32
+ TEMPERATURE: 'temperature',
33
+ HUMIDITY: 'humidity',
34
+ VPD: 'vpdnums',
35
+ ONLINE: 'online',
36
+ TIME_ZONE: 'zoneId',
37
37
  };
38
38
 
39
39
  // Port property keys
40
40
  const PORT_PROPERTY_KEY = {
41
- PORT: "port",
42
- NAME: "portName",
43
- SPEAK: "speak",
44
- ONLINE: "online",
45
- STATE: "loadState",
46
- REMAINING_TIME: "remainTime",
41
+ PORT: 'port',
42
+ NAME: 'portName',
43
+ SPEAK: 'speak',
44
+ ONLINE: 'online',
45
+ STATE: 'loadState',
46
+ REMAINING_TIME: 'remainTime',
47
47
  };
48
48
 
49
49
  // Advanced settings keys
50
50
  const ADVANCED_SETTINGS_KEY = {
51
- DEV_ID: "devId",
52
- DEV_NAME: "devName",
53
-
51
+ DEV_ID: 'devId',
52
+ DEV_NAME: 'devName',
53
+
54
54
  // Controller advanced settings
55
- TEMP_UNIT: "devCompany",
56
- CALIBRATE_TEMP: "devCt",
57
- CALIBRATE_TEMP_F: "devCth",
58
- CALIBRATE_HUMIDITY: "devCh",
59
- VPD_LEAF_TEMP_OFFSET: "vpdCt",
60
- VPD_LEAF_TEMP_OFFSET_F: "vpdCth",
61
- OUTSIDE_TEMP_COMPARE: "tempCompare",
62
- OUTSIDE_HUMIDITY_COMPARE: "humiCompare",
63
-
55
+ TEMP_UNIT: 'devCompany',
56
+ CALIBRATE_TEMP: 'devCt',
57
+ CALIBRATE_TEMP_F: 'devCth',
58
+ CALIBRATE_HUMIDITY: 'devCh',
59
+ VPD_LEAF_TEMP_OFFSET: 'vpdCt',
60
+ VPD_LEAF_TEMP_OFFSET_F: 'vpdCth',
61
+ OUTSIDE_TEMP_COMPARE: 'tempCompare',
62
+ OUTSIDE_HUMIDITY_COMPARE: 'humiCompare',
63
+
64
64
  // Port advanced settings
65
- DEVICE_LOAD_TYPE: "loadType",
66
- DYNAMIC_RESPONSE_TYPE: "isFlag",
67
- DYNAMIC_TRANSITION_TEMP: "devTt",
68
- DYNAMIC_TRANSITION_TEMP_F: "devTth",
69
- DYNAMIC_TRANSITION_HUMIDITY: "devTh",
70
- DYNAMIC_TRANSITION_VPD: "vpdTransition",
71
- DYNAMIC_BUFFER_TEMP: "devBt",
72
- DYNAMIC_BUFFER_TEMP_F: "devBth",
73
- DYNAMIC_BUFFER_HUMIDITY: "devBh",
74
- DYNAMIC_BUFFER_VPD: "devBvpd",
75
- SUNRISE_TIMER_ENABLED: "onTimeSwitch",
76
- SUNRISE_TIMER_DURATION: "onTime",
65
+ DEVICE_LOAD_TYPE: 'loadType',
66
+ DYNAMIC_RESPONSE_TYPE: 'isFlag',
67
+ DYNAMIC_TRANSITION_TEMP: 'devTt',
68
+ DYNAMIC_TRANSITION_TEMP_F: 'devTth',
69
+ DYNAMIC_TRANSITION_HUMIDITY: 'devTh',
70
+ DYNAMIC_TRANSITION_VPD: 'vpdTransition',
71
+ DYNAMIC_BUFFER_TEMP: 'devBt',
72
+ DYNAMIC_BUFFER_TEMP_F: 'devBth',
73
+ DYNAMIC_BUFFER_HUMIDITY: 'devBh',
74
+ DYNAMIC_BUFFER_VPD: 'devBvpd',
75
+ SUNRISE_TIMER_ENABLED: 'onTimeSwitch',
76
+ SUNRISE_TIMER_DURATION: 'onTime',
77
77
  };
78
78
 
79
79
  // Port control keys
80
80
  const PORT_CONTROL_KEY = {
81
- DEV_ID: "devId",
82
- MODE_SET_ID: "modeSetid",
83
- SURPLUS: "surplus",
84
- ON_SPEED: "onSpead",
85
- OFF_SPEED: "offSpead",
86
- AT_TYPE: "atType",
87
- SCHEDULED_START_TIME: "schedStartTime",
88
- SCHEDULED_END_TIME: "schedEndtTime",
89
- TIMER_DURATION_TO_ON: "acitveTimerOn",
90
- TIMER_DURATION_TO_OFF: "acitveTimerOff",
91
- CYCLE_DURATION_ON: "activeCycleOn",
92
- CYCLE_DURATION_OFF: "activeCycleOff",
93
- VPD_SETTINGS_MODE: "vpdSettingMode",
94
- VPD_HIGH_ENABLED: "activeHtVpd",
95
- VPD_HIGH_TRIGGER: "activeHtVpdNums",
96
- VPD_LOW_ENABLED: "activeLtVpd",
97
- VPD_LOW_TRIGGER: "activeLtVpdNums",
98
- VPD_TARGET_ENABLED: "targetVpdSwitch",
99
- VPD_TARGET: "targetVpd",
100
- AUTO_SETTINGS_MODE: "settingMode",
101
- AUTO_TEMP_HIGH_TRIGGER: "devHt",
102
- AUTO_TEMP_HIGH_TRIGGER_F: "devHtf",
103
- AUTO_TEMP_HIGH_ENABLED: "activeHt",
104
- AUTO_HUMIDITY_HIGH_TRIGGER: "devHh",
105
- AUTO_HUMIDITY_HIGH_ENABLED: "activeHh",
106
- AUTO_TEMP_LOW_TRIGGER: "devLt",
107
- AUTO_TEMP_LOW_TRIGGER_F: "devLtf",
108
- AUTO_TEMP_LOW_ENABLED: "activeLt",
109
- AUTO_HUMIDITY_LOW_TRIGGER: "devLh",
110
- AUTO_HUMIDITY_LOW_ENABLED: "activeLh",
111
- AUTO_TARGET_TEMP_ENABLED: "targetTSwitch",
112
- AUTO_TARGET_TEMP: "targetTemp",
113
- AUTO_TARGET_TEMP_F: "targetTempF",
114
- AUTO_TARGET_HUMIDITY_ENABLED: "targetHumiSwitch",
115
- AUTO_TARGET_HUMIDITY: "targetHumi",
81
+ DEV_ID: 'devId',
82
+ MODE_SET_ID: 'modeSetid',
83
+ SURPLUS: 'surplus',
84
+ ON_SPEED: 'onSpead',
85
+ OFF_SPEED: 'offSpead',
86
+ AT_TYPE: 'atType',
87
+ SCHEDULED_START_TIME: 'schedStartTime',
88
+ SCHEDULED_END_TIME: 'schedEndtTime',
89
+ TIMER_DURATION_TO_ON: 'acitveTimerOn',
90
+ TIMER_DURATION_TO_OFF: 'acitveTimerOff',
91
+ CYCLE_DURATION_ON: 'activeCycleOn',
92
+ CYCLE_DURATION_OFF: 'activeCycleOff',
93
+ VPD_SETTINGS_MODE: 'vpdSettingMode',
94
+ VPD_HIGH_ENABLED: 'activeHtVpd',
95
+ VPD_HIGH_TRIGGER: 'activeHtVpdNums',
96
+ VPD_LOW_ENABLED: 'activeLtVpd',
97
+ VPD_LOW_TRIGGER: 'activeLtVpdNums',
98
+ VPD_TARGET_ENABLED: 'targetVpdSwitch',
99
+ VPD_TARGET: 'targetVpd',
100
+ AUTO_SETTINGS_MODE: 'settingMode',
101
+ AUTO_TEMP_HIGH_TRIGGER: 'devHt',
102
+ AUTO_TEMP_HIGH_TRIGGER_F: 'devHtf',
103
+ AUTO_TEMP_HIGH_ENABLED: 'activeHt',
104
+ AUTO_HUMIDITY_HIGH_TRIGGER: 'devHh',
105
+ AUTO_HUMIDITY_HIGH_ENABLED: 'activeHh',
106
+ AUTO_TEMP_LOW_TRIGGER: 'devLt',
107
+ AUTO_TEMP_LOW_TRIGGER_F: 'devLtf',
108
+ AUTO_TEMP_LOW_ENABLED: 'activeLt',
109
+ AUTO_HUMIDITY_LOW_TRIGGER: 'devLh',
110
+ AUTO_HUMIDITY_LOW_ENABLED: 'activeLh',
111
+ AUTO_TARGET_TEMP_ENABLED: 'targetTSwitch',
112
+ AUTO_TARGET_TEMP: 'targetTemp',
113
+ AUTO_TARGET_TEMP_F: 'targetTempF',
114
+ AUTO_TARGET_HUMIDITY_ENABLED: 'targetHumiSwitch',
115
+ AUTO_TARGET_HUMIDITY: 'targetHumi',
116
116
  };
117
117
 
118
118
  // Schedule related constants
@@ -121,37 +121,25 @@ const SCHEDULE_MIDNIGHT_VALUE = 0; // 12:00am, default for start time
121
121
  const SCHEDULE_EOD_VALUE = 1439; // 11:59pm, default for end time
122
122
 
123
123
  // Mode options
124
- const MODE_OPTIONS = [
125
- "Off",
126
- "On",
127
- "Auto",
128
- "Timer to On",
129
- "Timer to Off",
130
- "Cycle",
131
- "Schedule",
132
- "VPD",
133
- ];
124
+ const MODE_OPTIONS = ['Off', 'On', 'Auto', 'Timer to On', 'Timer to Off', 'Cycle', 'Schedule', 'VPD'];
134
125
 
135
126
  // Dynamic response options
136
- const DYNAMIC_RESPONSE_OPTIONS = ["Transition", "Buffer"];
127
+ const DYNAMIC_RESPONSE_OPTIONS = ['Transition', 'Buffer'];
137
128
 
138
129
  // Outside climate options
139
- const OUTSIDE_CLIMATE_OPTIONS = ["Neutral", "Lower", "Higher"];
130
+ const OUTSIDE_CLIMATE_OPTIONS = ['Neutral', 'Lower', 'Higher'];
140
131
 
141
132
  // Device load type options
142
133
  const DEVICE_LOAD_TYPE_OPTIONS = {
143
- 1: "Grow Light",
144
- 2: "Humidifier",
145
- 4: "Heater",
146
- 5: "AC",
147
- 6: "Fan",
134
+ 1: 'Grow Light',
135
+ 2: 'Humidifier',
136
+ 4: 'Heater',
137
+ 5: 'AC',
138
+ 6: 'Fan',
148
139
  };
149
140
 
150
141
  // Settings mode options
151
- const SETTINGS_MODE_OPTIONS = [
152
- "Auto",
153
- "Target",
154
- ];
142
+ const SETTINGS_MODE_OPTIONS = ['Auto', 'Target'];
155
143
 
156
144
  module.exports = {
157
145
  API_BASE_URL,
@@ -170,4 +158,4 @@ module.exports = {
170
158
  OUTSIDE_CLIMATE_OPTIONS,
171
159
  DEVICE_LOAD_TYPE_OPTIONS,
172
160
  SETTINGS_MODE_OPTIONS,
173
- };
161
+ };