homebridge-melcloud-control 3.5.2 → 3.6.0
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/CHANGELOG.md +11 -0
- package/README.md +6 -3
- package/config.schema.json +28 -9
- package/index.js +57 -45
- package/package.json +2 -2
- package/src/deviceata.js +6 -6
- package/src/deviceatw.js +6 -6
- package/src/deviceerv.js +6 -6
- package/src/melcloud.js +3 -3
- package/src/melcloudata.js +2 -2
- package/src/melcloudatw.js +2 -2
- package/src/melclouderv.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -16,6 +16,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
16
16
|
- do not configure it manually, always using Config UI X
|
|
17
17
|
- required Homebridge v2.0.0 and above
|
|
18
18
|
|
|
19
|
+
## [3.6.0] - (29.01.2025)
|
|
20
|
+
|
|
21
|
+
## Changes
|
|
22
|
+
|
|
23
|
+
- added possibility to disable/enable log success, info, warn, error
|
|
24
|
+
- refactor cnnect code
|
|
25
|
+
- bump dependencies
|
|
26
|
+
- config schema updated
|
|
27
|
+
- redme updated
|
|
28
|
+
- cleanup
|
|
29
|
+
|
|
19
30
|
## [3.5.0] - (06.12.2024)
|
|
20
31
|
|
|
21
32
|
## Changes
|
package/README.md
CHANGED
|
@@ -273,9 +273,12 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
|
|
|
273
273
|
| `buttonsSensors.displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
274
274
|
| `buttonsSensors.namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
|
|
275
275
|
| `refreshInterval` | Here set the background account data refresh time in (sec), default `120s`. |
|
|
276
|
-
| `
|
|
277
|
-
| `disableLogInfo` |
|
|
278
|
-
| `
|
|
276
|
+
| `disableLogDeviceInfo` | If enabled, add ability to disable log device info by every connections device to the network. |
|
|
277
|
+
| `disableLogInfo` | If enabled, disable log info, all values and state will not be displayed in Homebridge log console. |
|
|
278
|
+
| `disableLogSuccess` | If enabled, disable logging device success. |
|
|
279
|
+
| `disableLogWarn` | If enabled, disable logging device warnings. |
|
|
280
|
+
| `disableLogError` | If enabled, disable logging device error. |
|
|
281
|
+
| `enableDebugMode` | If enabled, deep log will be present in homebridge console. |
|
|
279
282
|
| `restFul` | This is RSTful server. |
|
|
280
283
|
| `restFul.enable` | If enabled, RESTful server will start automatically and respond to any path request. |
|
|
281
284
|
| `restFul.port` | Here set the listening `Port` for RESTful server. |
|
package/config.schema.json
CHANGED
|
@@ -1543,25 +1543,41 @@
|
|
|
1543
1543
|
"description": "Set the background account data refresh time in seconds.",
|
|
1544
1544
|
"required": false
|
|
1545
1545
|
},
|
|
1546
|
-
"
|
|
1547
|
-
"title": "
|
|
1546
|
+
"disableLogDeviceInfo": {
|
|
1547
|
+
"title": "Disable Log Device Info",
|
|
1548
1548
|
"type": "boolean",
|
|
1549
1549
|
"default": false,
|
|
1550
|
-
"description": "
|
|
1550
|
+
"description": "This disable logging device info by every connections device to the network.",
|
|
1551
1551
|
"required": false
|
|
1552
1552
|
},
|
|
1553
1553
|
"disableLogInfo": {
|
|
1554
1554
|
"title": "Disable Log Info",
|
|
1555
1555
|
"type": "boolean",
|
|
1556
1556
|
"default": false,
|
|
1557
|
-
"description": "Don't display values and states in log every time info changes.",
|
|
1558
1557
|
"required": false
|
|
1559
1558
|
},
|
|
1560
|
-
"
|
|
1561
|
-
"title": "Disable Log
|
|
1559
|
+
"disableLogSuccess": {
|
|
1560
|
+
"title": "Disable Log Success",
|
|
1561
|
+
"type": "boolean",
|
|
1562
|
+
"default": false,
|
|
1563
|
+
"required": false
|
|
1564
|
+
},
|
|
1565
|
+
"disableLogWarn": {
|
|
1566
|
+
"title": "Disable Log Warn",
|
|
1567
|
+
"type": "boolean",
|
|
1568
|
+
"default": false,
|
|
1569
|
+
"required": false
|
|
1570
|
+
},
|
|
1571
|
+
"disableLogError": {
|
|
1572
|
+
"title": "Disable Log Error",
|
|
1573
|
+
"type": "boolean",
|
|
1574
|
+
"default": false,
|
|
1575
|
+
"required": false
|
|
1576
|
+
},
|
|
1577
|
+
"enableDebugMode": {
|
|
1578
|
+
"title": "Enable Log Debug",
|
|
1562
1579
|
"type": "boolean",
|
|
1563
1580
|
"default": false,
|
|
1564
|
-
"description": "Don't display device info in log on plugin start.",
|
|
1565
1581
|
"required": false
|
|
1566
1582
|
},
|
|
1567
1583
|
"restFul": {
|
|
@@ -2011,9 +2027,12 @@
|
|
|
2011
2027
|
"key": "accounts[]",
|
|
2012
2028
|
"title": "Log",
|
|
2013
2029
|
"items": [
|
|
2014
|
-
"accounts[].
|
|
2030
|
+
"accounts[].disableLogDeviceInfo",
|
|
2015
2031
|
"accounts[].disableLogInfo",
|
|
2016
|
-
"accounts[].
|
|
2032
|
+
"accounts[].disableLogSuccess",
|
|
2033
|
+
"accounts[].disableLogWarn",
|
|
2034
|
+
"accounts[].disableLogError",
|
|
2035
|
+
"accounts[].enableDebugMode"
|
|
2017
2036
|
]
|
|
2018
2037
|
},
|
|
2019
2038
|
{
|
package/index.js
CHANGED
|
@@ -47,9 +47,14 @@ class MelCloudPlatform {
|
|
|
47
47
|
}
|
|
48
48
|
accountsName.push(accountName);
|
|
49
49
|
|
|
50
|
-
//
|
|
50
|
+
//log config
|
|
51
51
|
const enableDebugMode = account.enableDebugMode || false;
|
|
52
|
-
const
|
|
52
|
+
const disableLogDeviceInfo = account.disableLogDeviceInfo || false;
|
|
53
|
+
const disableLogInfo = account.disableLogInfo || false;
|
|
54
|
+
const disableLogSuccess = account.disableLogSuccess || false;
|
|
55
|
+
const disableLogWarn = account.disableLogWarn || false;
|
|
56
|
+
const disableLogError = account.disableLogError || false;
|
|
57
|
+
const debug = enableDebugMode ? log.info(`Device: ${host} ${deviceName}, debug: Did finish launching.`) : false;
|
|
53
58
|
|
|
54
59
|
//remove sensitive data
|
|
55
60
|
const debugData = {
|
|
@@ -60,7 +65,7 @@ class MelCloudPlatform {
|
|
|
60
65
|
passwd: 'removed'
|
|
61
66
|
}
|
|
62
67
|
};
|
|
63
|
-
const debug1 = enableDebugMode ? log.info(`${accountName}, Config: ${JSON.stringify(debugData, null, 2)}`)
|
|
68
|
+
const debug1 = !enableDebugMode ? false : log.info(`${accountName}, Config: ${JSON.stringify(debugData, null, 2)}`);
|
|
64
69
|
|
|
65
70
|
//define directory and file paths
|
|
66
71
|
const accountFile = `${prefDir}/${accountName}_Account`;
|
|
@@ -73,34 +78,41 @@ class MelCloudPlatform {
|
|
|
73
78
|
try {
|
|
74
79
|
//melcloud account
|
|
75
80
|
const melCloud = new MelCloud(user, passwd, language, accountFile, buildingsFile, devicesFile, enableDebugMode, false);
|
|
76
|
-
melCloud.on('success', (
|
|
77
|
-
log.success(`${accountName}, ${
|
|
81
|
+
melCloud.on('success', (success) => {
|
|
82
|
+
const emitLog = disableLogSuccess ? false : log.success(`${accountName}, ${success}`);
|
|
78
83
|
})
|
|
79
|
-
.on('
|
|
80
|
-
log.info(`${accountName}, ${
|
|
84
|
+
.on('info', (info) => {
|
|
85
|
+
const emitLog = disableLogInfo ? false : log.info(`${accountName}, ${info}`);
|
|
81
86
|
})
|
|
82
87
|
.on('debug', (debug) => {
|
|
83
|
-
log.info(`${accountName}, debug: ${debug}`);
|
|
88
|
+
const emitLog = !enableDebugMode ? false : log.info(`${accountName}, debug: ${debug}`);
|
|
84
89
|
})
|
|
85
90
|
.on('warn', (warn) => {
|
|
86
|
-
log.warn(`${accountName}, ${warn}`);
|
|
91
|
+
const emitLog = disableLogWarn ? false : log.warn(`${accountName}, ${warn}`);
|
|
87
92
|
})
|
|
88
93
|
.on('error', (error) => {
|
|
89
|
-
log.error(`${accountName}, ${error}.`);
|
|
94
|
+
const emitLog = disableLogError ? false : log.error(`${accountName}, ${error}.`);
|
|
90
95
|
});
|
|
91
96
|
|
|
92
97
|
//connect
|
|
93
98
|
const response = await melCloud.connect();
|
|
94
|
-
const accountInfo = response.accountInfo;
|
|
95
|
-
const contextKey = response.contextKey;
|
|
96
|
-
const useFahrenheit = response.useFahrenheit;
|
|
99
|
+
const accountInfo = response.accountInfo ?? false;
|
|
100
|
+
const contextKey = response.contextKey ?? false;
|
|
101
|
+
const useFahrenheit = response.useFahrenheit ?? false;
|
|
102
|
+
|
|
103
|
+
if (contextKey === false) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
97
106
|
|
|
98
107
|
//check devices list
|
|
99
108
|
const devices = await melCloud.chackDevicesList(contextKey);
|
|
109
|
+
if (devices === false) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
100
112
|
|
|
101
113
|
//start impulse generator
|
|
102
114
|
const timers = [{ name: 'checkDevicesList', sampling: refreshInterval }];
|
|
103
|
-
melCloud.impulseGenerator.start(timers);
|
|
115
|
+
await melCloud.impulseGenerator.start(timers);
|
|
104
116
|
|
|
105
117
|
//Air Conditioner 0
|
|
106
118
|
try {
|
|
@@ -121,31 +133,31 @@ class MelCloudPlatform {
|
|
|
121
133
|
|
|
122
134
|
//publish device
|
|
123
135
|
api.publishExternalAccessories(PluginName, [accessory]);
|
|
124
|
-
log.success(`${accountName}, ${deviceTypeText} ${deviceName}, published as external accessory.`);
|
|
136
|
+
const emitLog = disableLogSuccess ? false : log.success(`${accountName}, ${deviceTypeText} ${deviceName}, published as external accessory.`);
|
|
125
137
|
})
|
|
126
138
|
.on('devInfo', (devInfo) => {
|
|
127
|
-
log.info(devInfo);
|
|
139
|
+
const emitLog = disableLogDeviceInfo ? false : log.info(devInfo);
|
|
128
140
|
})
|
|
129
|
-
.on('success', (
|
|
130
|
-
log.success(`${accountName}, ${deviceTypeText}, ${deviceName}, ${
|
|
141
|
+
.on('success', (success) => {
|
|
142
|
+
const emitLog = disableLogSuccess ? false : log.success(`${accountName}, ${deviceTypeText}, ${deviceName}, ${success}`);
|
|
131
143
|
})
|
|
132
|
-
.on('
|
|
133
|
-
log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, ${
|
|
144
|
+
.on('info', (info) => {
|
|
145
|
+
const emitLog = disableLogInfo ? false : log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, ${info}`);
|
|
134
146
|
})
|
|
135
147
|
.on('debug', (debug) => {
|
|
136
|
-
log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, debug: ${debug}`);
|
|
148
|
+
const emitLog = !enableDebugMode ? false : log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, debug: ${debug}`);
|
|
137
149
|
})
|
|
138
150
|
.on('warn', (warn) => {
|
|
139
|
-
log.warn(`${accountName}, ${deviceTypeText}, ${deviceName}, ${warn}`);
|
|
151
|
+
const emitLog = disableLogWarn ? false : log.warn(`${accountName}, ${deviceTypeText}, ${deviceName}, ${warn}`);
|
|
140
152
|
})
|
|
141
153
|
.on('error', (error) => {
|
|
142
|
-
log.error(`${accountName}, ${deviceTypeText}, ${deviceName}, ${error}`);
|
|
154
|
+
const emitLog = disableLogError ? false : log.error(`${accountName}, ${deviceTypeText}, ${deviceName}, ${error}`);
|
|
143
155
|
});
|
|
144
156
|
|
|
145
157
|
await airConditioner.start();
|
|
146
158
|
};
|
|
147
159
|
} catch (error) {
|
|
148
|
-
|
|
160
|
+
throw new Error(`${accountName}, ATA did finish launching error: ${error}.`);
|
|
149
161
|
}
|
|
150
162
|
|
|
151
163
|
//Heat Pump 1
|
|
@@ -167,31 +179,31 @@ class MelCloudPlatform {
|
|
|
167
179
|
|
|
168
180
|
//publish device
|
|
169
181
|
api.publishExternalAccessories(PluginName, [accessory]);
|
|
170
|
-
log.success(`${accountName}, ${deviceTypeText} ${deviceName}, published as external accessory.`);
|
|
182
|
+
const emitLog = disableLogSuccess ? false : log.success(`${accountName}, ${deviceTypeText} ${deviceName}, published as external accessory.`);
|
|
171
183
|
})
|
|
172
184
|
.on('devInfo', (devInfo) => {
|
|
173
|
-
log.info(devInfo);
|
|
185
|
+
const emitLog = disableLogDeviceInfo ? false : log.info(devInfo);
|
|
174
186
|
})
|
|
175
|
-
.on('success', (
|
|
176
|
-
log.success(`${accountName}, ${deviceTypeText}, ${deviceName}, ${
|
|
187
|
+
.on('success', (success) => {
|
|
188
|
+
const emitLog = disableLogSuccess ? false : log.success(`${accountName}, ${deviceTypeText}, ${deviceName}, ${success}`);
|
|
177
189
|
})
|
|
178
|
-
.on('
|
|
179
|
-
log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, ${
|
|
190
|
+
.on('info', (info) => {
|
|
191
|
+
const emitLog = disableLogInfo ? false : log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, ${info}`);
|
|
180
192
|
})
|
|
181
193
|
.on('debug', (debug) => {
|
|
182
|
-
log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, debug: ${debug}`);
|
|
194
|
+
const emitLog = !enableDebugMode ? false : log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, debug: ${debug}`);
|
|
183
195
|
})
|
|
184
196
|
.on('warn', (warn) => {
|
|
185
|
-
log.warn(`${accountName}, ${deviceTypeText}, ${deviceName}, ${warn}`);
|
|
197
|
+
const emitLog = disableLogWarn ? false : log.warn(`${accountName}, ${deviceTypeText}, ${deviceName}, ${warn}`);
|
|
186
198
|
})
|
|
187
199
|
.on('error', (error) => {
|
|
188
|
-
log.error(`${accountName}, ${deviceTypeText}, ${deviceName}, ${error}`);
|
|
200
|
+
const emitLog = disableLogError ? false : log.error(`${accountName}, ${deviceTypeText}, ${deviceName}, ${error}`);
|
|
189
201
|
});
|
|
190
202
|
|
|
191
203
|
await heatPump.start();
|
|
192
204
|
};
|
|
193
205
|
} catch (error) {
|
|
194
|
-
|
|
206
|
+
throw new Error(`${accountName}, ATE did finish launching error: ${error}.`);
|
|
195
207
|
}
|
|
196
208
|
|
|
197
209
|
//Energy Recovery Ventilation 3
|
|
@@ -213,34 +225,34 @@ class MelCloudPlatform {
|
|
|
213
225
|
|
|
214
226
|
//publish device
|
|
215
227
|
api.publishExternalAccessories(PluginName, [accessory]);
|
|
216
|
-
log.success(`${accountName}, ${deviceTypeText} ${deviceName}, published as external accessory.`);
|
|
228
|
+
const emitLog = disableLogSuccess ? false : log.success(`${accountName}, ${deviceTypeText} ${deviceName}, published as external accessory.`);
|
|
217
229
|
})
|
|
218
230
|
.on('devInfo', (devInfo) => {
|
|
219
|
-
log.info(devInfo);
|
|
231
|
+
const emitLog = disableLogDeviceInfo ? false : log.info(devInfo);
|
|
220
232
|
})
|
|
221
|
-
.on('success', (
|
|
222
|
-
log.success(`${accountName}, ${deviceTypeText}, ${deviceName}, ${
|
|
233
|
+
.on('success', (success) => {
|
|
234
|
+
const emitLog = disableLogSuccess ? false : log.success(`${accountName}, ${deviceTypeText}, ${deviceName}, ${success}`);
|
|
223
235
|
})
|
|
224
|
-
.on('
|
|
225
|
-
log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, ${
|
|
236
|
+
.on('info', (info) => {
|
|
237
|
+
const emitLog = disableLogInfo ? false : log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, ${info}`);
|
|
226
238
|
})
|
|
227
239
|
.on('debug', (debug) => {
|
|
228
|
-
log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, debug: ${debug}`);
|
|
240
|
+
const emitLog = !enableDebugMode ? false : log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, debug: ${debug}`);
|
|
229
241
|
})
|
|
230
242
|
.on('warn', (warn) => {
|
|
231
|
-
log.warn(`${accountName}, ${deviceTypeText}, ${deviceName}, ${warn}`);
|
|
243
|
+
const emitLog = disableLogWarn ? false : log.warn(`${accountName}, ${deviceTypeText}, ${deviceName}, ${warn}`);
|
|
232
244
|
})
|
|
233
245
|
.on('error', (error) => {
|
|
234
|
-
log.error(`${accountName}, ${deviceTypeText}, ${deviceName}, ${error}`);
|
|
246
|
+
const emitLog = disableLogError ? false : log.error(`${accountName}, ${deviceTypeText}, ${deviceName}, ${error}`);
|
|
235
247
|
});
|
|
236
248
|
|
|
237
249
|
await energyRecoveryVentilation.start();
|
|
238
250
|
};
|
|
239
251
|
} catch (error) {
|
|
240
|
-
|
|
252
|
+
throw new Error(`${accountName}, ERV did finish launching error: ${error}.`);
|
|
241
253
|
}
|
|
242
254
|
} catch (error) {
|
|
243
|
-
|
|
255
|
+
throw new Error(`${accountName}, Account did finish launching error: ${error}.`);
|
|
244
256
|
}
|
|
245
257
|
};
|
|
246
258
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.6.0",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"LICENSE"
|
|
32
32
|
],
|
|
33
33
|
"engines": {
|
|
34
|
-
"homebridge": "^1.
|
|
34
|
+
"homebridge": "^1.8.5 || ^2.0.0-beta.0",
|
|
35
35
|
"node": "^18.20.4 || ^20.15.1 || ^22.7.0 || ^23.2.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
package/src/deviceata.js
CHANGED
|
@@ -1370,19 +1370,19 @@ class DeviceAta extends EventEmitter {
|
|
|
1370
1370
|
this.emit('error', error);
|
|
1371
1371
|
};
|
|
1372
1372
|
})
|
|
1373
|
-
.on('success', (
|
|
1374
|
-
this.emit('success',
|
|
1373
|
+
.on('success', (success) => {
|
|
1374
|
+
this.emit('success', success);
|
|
1375
1375
|
})
|
|
1376
|
-
.on('
|
|
1377
|
-
this.emit('
|
|
1376
|
+
.on('info', (info) => {
|
|
1377
|
+
this.emit('info', info);
|
|
1378
1378
|
})
|
|
1379
1379
|
.on('debug', (debug) => {
|
|
1380
1380
|
this.emit('debug', debug);
|
|
1381
1381
|
})
|
|
1382
|
-
.on('warn',
|
|
1382
|
+
.on('warn', (warn) => {
|
|
1383
1383
|
this.emit('warn', warn);
|
|
1384
1384
|
})
|
|
1385
|
-
.on('error',
|
|
1385
|
+
.on('error', (error) => {
|
|
1386
1386
|
this.emit('error', error);
|
|
1387
1387
|
});
|
|
1388
1388
|
|
package/src/deviceatw.js
CHANGED
|
@@ -1914,19 +1914,19 @@ class DeviceAtw extends EventEmitter {
|
|
|
1914
1914
|
this.emit('error', error);
|
|
1915
1915
|
};
|
|
1916
1916
|
})
|
|
1917
|
-
.on('success', (
|
|
1918
|
-
this.emit('success',
|
|
1917
|
+
.on('success', (success) => {
|
|
1918
|
+
this.emit('success', success);
|
|
1919
1919
|
})
|
|
1920
|
-
.on('
|
|
1921
|
-
this.emit('
|
|
1920
|
+
.on('info', (info) => {
|
|
1921
|
+
this.emit('info', info);
|
|
1922
1922
|
})
|
|
1923
1923
|
.on('debug', (debug) => {
|
|
1924
1924
|
this.emit('debug', debug);
|
|
1925
1925
|
})
|
|
1926
|
-
.on('warn',
|
|
1926
|
+
.on('warn', (warn) => {
|
|
1927
1927
|
this.emit('warn', warn);
|
|
1928
1928
|
})
|
|
1929
|
-
.on('error',
|
|
1929
|
+
.on('error', (error) => {
|
|
1930
1930
|
this.emit('error', error);
|
|
1931
1931
|
});
|
|
1932
1932
|
|
package/src/deviceerv.js
CHANGED
|
@@ -1238,19 +1238,19 @@ class DeviceErv extends EventEmitter {
|
|
|
1238
1238
|
this.emit('error', error);
|
|
1239
1239
|
};
|
|
1240
1240
|
})
|
|
1241
|
-
.on('success', (
|
|
1242
|
-
this.emit('success',
|
|
1241
|
+
.on('success', (success) => {
|
|
1242
|
+
this.emit('success', success);
|
|
1243
1243
|
})
|
|
1244
|
-
.on('
|
|
1245
|
-
this.emit('
|
|
1244
|
+
.on('info', (info) => {
|
|
1245
|
+
this.emit('info', info);
|
|
1246
1246
|
})
|
|
1247
1247
|
.on('debug', (debug) => {
|
|
1248
1248
|
this.emit('debug', debug);
|
|
1249
1249
|
})
|
|
1250
|
-
.on('warn',
|
|
1250
|
+
.on('warn', (warn) => {
|
|
1251
1251
|
this.emit('warn', warn);
|
|
1252
1252
|
})
|
|
1253
|
-
.on('error',
|
|
1253
|
+
.on('error', (error) => {
|
|
1254
1254
|
this.emit('error', error);
|
|
1255
1255
|
});
|
|
1256
1256
|
|
package/src/melcloud.js
CHANGED
|
@@ -79,7 +79,7 @@ class MelCloud extends EventEmitter {
|
|
|
79
79
|
|
|
80
80
|
if (contextKey === undefined || contextKey === null) {
|
|
81
81
|
this.emit('warn', `Context key: ${contextKey}, missing.`)
|
|
82
|
-
return;
|
|
82
|
+
return false;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
//create axios instance post
|
|
@@ -144,7 +144,7 @@ class MelCloud extends EventEmitter {
|
|
|
144
144
|
|
|
145
145
|
if (!buildingsList) {
|
|
146
146
|
this.emit('warn', `No building found.`);
|
|
147
|
-
return;
|
|
147
|
+
return false;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
//save buildings to the file
|
|
@@ -170,7 +170,7 @@ class MelCloud extends EventEmitter {
|
|
|
170
170
|
const devicesCount = devices.length;
|
|
171
171
|
if (devicesCount === 0) {
|
|
172
172
|
this.emit('warn', `No devices found.`);
|
|
173
|
-
return;
|
|
173
|
+
return false;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
//save buildings to the file
|
package/src/melcloudata.js
CHANGED
|
@@ -10,7 +10,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
-
this.
|
|
13
|
+
this.enableDebugMode = config.enableDebugMode;
|
|
14
14
|
|
|
15
15
|
//set default values
|
|
16
16
|
this.deviceState = {};
|
|
@@ -52,7 +52,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
55
|
-
const debug = this.
|
|
55
|
+
const debug = this.enableDebugMode ? this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`) : false;
|
|
56
56
|
|
|
57
57
|
//device info
|
|
58
58
|
const deviceId = deviceData.DeviceID;
|
package/src/melcloudatw.js
CHANGED
|
@@ -10,7 +10,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
-
this.
|
|
13
|
+
this.enableDebugMode = config.enableDebugMode;
|
|
14
14
|
|
|
15
15
|
//set default values
|
|
16
16
|
this.deviceState = {};
|
|
@@ -52,7 +52,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
55
|
-
const debug = this.
|
|
55
|
+
const debug = this.enableDebugMode ? this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`) : false;
|
|
56
56
|
|
|
57
57
|
//device info
|
|
58
58
|
const deviceId = deviceData.DeviceID;
|
package/src/melclouderv.js
CHANGED
|
@@ -10,7 +10,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
-
this.
|
|
13
|
+
this.enableDebugMode = config.enableDebugMode;
|
|
14
14
|
|
|
15
15
|
//set default values
|
|
16
16
|
this.deviceState = {};
|
|
@@ -52,7 +52,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
55
|
-
const debug = this.
|
|
55
|
+
const debug = this.enableDebugMode ? this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`) : false;
|
|
56
56
|
|
|
57
57
|
//deviceData
|
|
58
58
|
const deviceId = deviceData.DeviceID;
|