homebridge-melcloud-control 3.10.0-beta.20 → 3.10.0-beta.22
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/README.md +79 -77
- package/index.js +7 -7
- package/package.json +1 -1
- package/src/deviceata.js +31 -32
- package/src/deviceatw.js +27 -28
- package/src/deviceerv.js +32 -33
- package/src/melcloud.js +5 -4
- package/src/melcloudata.js +3 -2
- package/src/melcloudatw.js +2 -1
- package/src/melclouderv.js +2 -1
package/README.md
CHANGED
|
@@ -207,92 +207,94 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
|
|
|
207
207
|
| `user` | Here set the MELCloud username. |
|
|
208
208
|
| `passwd` | Here set the MELCloud password. |
|
|
209
209
|
| `language` | Here select the MELCloud language. |
|
|
210
|
-
| `ataDevices` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
|
|
211
|
-
| `ataDevices.id` | Read only data, do not change it. |
|
|
212
|
-
| `ataDevices.type` | Read only data, do not change it. |
|
|
213
|
-
| `ataDevices.typeString` | Read only data, do not change it. |
|
|
214
|
-
| `ataDevices.name` | Here You can schange the `Accessory Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
215
|
-
| `ataDevices.displayMode` | Here select device control mode `None/Disabled`, `Heater/Cooler`, `Thermostat`. |
|
|
216
|
-
| `ataDevices.heatDryFanMode` | Here select the operatiing mode for `Heat`, if this mode is not supported, it will be disabled. |
|
|
217
|
-
| `ataDevices.coolDryFanMode` | Here select the operatiing mode for `Cool`, if this mode is not supported, it will be disabled. |
|
|
218
|
-
| `ataDevices.autoDryFanMode` | Here select the operatiing mode for `Auto`, if this mode is not supported, it will be disabled.. |
|
|
219
|
-
| `ataDevices.temperatureSensor` | This enable extra `Room` temperature sensors to use with automations in HomeKit app. |
|
|
220
|
-
| `ataDevices.temperatureSensorOutdoor` | This enable extra `Outdoor` temperature sensors to use with automations in HomeKit app. |
|
|
221
|
-
| `ataDevices.refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
|
|
222
|
-
| `ataDevices.presets` | Array of ATA device Presets created automatically after login to MELCloud from plugin config UI. |
|
|
223
|
-
| `ataDevices.presets.id` | Read only data, do not change it. |
|
|
224
|
-
| `ataDevices.presets.name` | Here You can schange the `Preset Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
225
|
-
| `ataDevices.presets.displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
226
|
-
| `buttonsSensors` | Array of buttons sensors. |
|
|
227
|
-
| `buttonsSensors.name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
|
|
228
|
-
| `buttonsSensors.mode` | Here select button mode, VH - Vane Horizontal, VV - Vane Horizontal. |
|
|
229
|
-
| `buttonsSensors.displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
230
|
-
| `buttonsSensors.namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
|
|
231
|
-
| `atwDevices` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
|
|
232
|
-
| `atwDevices.id` | Read only data, do not change it. |
|
|
233
|
-
| `atwDevices.type` | Read only data, do not change it. |
|
|
234
|
-
| `atwDevices.typeString` | Read only data, do not change it. |
|
|
235
|
-
| `atwDevices.name` | Here You can schange the `Accessory Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
236
|
-
| `atwDevices.displayMode` | Here select main control mode `None/Disabled`, `Heater/Cooler`, `Thermostat`. |
|
|
237
|
-
| `atwDevices.hideZone` | Here select which zone need to be hidden `None/Disabled`, `Heat Pump`, `Heat Pump / Zone 1`, `Heat Pump / Zone 1 / Hot Water`, `Heat Pump / Zone 1 / Zone 2`, `Heat Pump / Hot Water`,`Heat Pump / Hot Water / Zone 2`, `Heat Pump / Zone 2`, `Zone 1`, `Zone 1 / Hot Water`, `Zone 1 / Hot Water / Zone 2`, `Zone 1 / Zone 2`, `Hot Water`, `Hot Water / Zone 2`, `Zone 2`, `All`. |
|
|
238
|
-
| `atwDevices.temperatureSensor` | This enable extra `Room` temperature sensors to use with automations in HomeKit app. |
|
|
239
|
-
| `atwDevices.temperatureSensorFlow` | This enable extra `Flow` temperature sensors to use with automations in HomeKit app. |
|
|
240
|
-
| `atwDevices.temperatureSensorReturn` | This enable extra `Return` temperature sensors to use with automations in HomeKit app. |
|
|
241
|
-
| `atwDevices.temperatureSensorFlowZone1` | This enable extra `Flow Zone 1` temperature sensors to use with automations in HomeKit app. |
|
|
242
|
-
| `atwDevices.temperatureSensorReturnZone1` | This enable extra `Return Zone 1` temperature sensors to use with automations in HomeKit app. |
|
|
243
|
-
| `atwDevices.temperatureSensorFlowWaterTank` | This enable extra `Flow Water Tank` temperature sensors to use with automations in HomeKit app. |
|
|
244
|
-
| `atwDevices.temperatureSensorReturnWaterTank` | This enable extra `Return Water Tank` temperature sensors to use with automations in HomeKit app. |
|
|
245
|
-
| `atwDevices.temperatureSensorFlowZone2` | This enable extra `Flow Zone 2` temperature sensors to use with automations in HomeKit app. |
|
|
246
|
-
| `atwDevices.temperatureSensorReturnZone2` | This enable extra `Return Zone 2` temperature sensors to use with automations in HomeKit app. |
|
|
247
|
-
| `atwDevices.refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
|
|
248
|
-
| `atwDevices.presets` | Array of ATA device Presets created automatically after login to MELCloud from plugin config UI. |
|
|
249
|
-
| `atwDevices.presets.id` | Read only data, do not change it. |
|
|
250
|
-
| `atwDevices.presets.name` | Here You can schange the `Preset Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
251
|
-
| `atwDevices.presets.displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
252
|
-
| `buttonsSensors` | Array of buttons sensors. |
|
|
253
|
-
| `buttonsSensors.name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
|
|
254
|
-
| `buttonsSensors.mode` | Here select button mode. |
|
|
255
|
-
| `buttonsSensors.displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
256
|
-
| `buttonsSensors.namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
|
|
257
|
-
| `ervDevices` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
|
|
258
|
-
| `ervDevices.id` | Read only data, do not change it. |
|
|
259
|
-
| `ervDevices.type` | Read only data, do not change it. |
|
|
260
|
-
| `ervDevices.typeString` | Read only data, do not change it. |
|
|
261
|
-
| `ervDevices.name` | Here You can schange the `Accessory Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
262
|
-
| `ervDevices.displayMode` | Here select main control mode `None/Disabled`, `Heater/Cooler`, `Thermostat`. |
|
|
263
|
-
| `ervDevices.temperatureSensor` | This enable extra `Room` temperature sensors to use with automations in HomeKit app. |
|
|
264
|
-
| `ervDevices.temperatureSensorOutdoor` | This enable extra `Outdoor` temperature sensors to use with automations in HomeKit app. |
|
|
265
|
-
| `ervDevices.temperatureSensorSupply` | This enable extra `Supply` temperature sensors to use with automations in HomeKit app. |
|
|
266
|
-
| `ervDevices.refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
|
|
267
|
-
| `ervDevices.presets` | Array of ATA device Presets created automatically after login to MELCloud from plugin config UI. |
|
|
268
|
-
| `ervDevices.presets.id` | Read only data, do not change it. |
|
|
269
|
-
| `ervDevices.presets.name` | Here You can schange the `Preset Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
270
|
-
| `ervDevices.presets.displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
271
|
-
| `buttonsSensors` | Array of buttons sensors. |
|
|
272
|
-
| `buttonsSensors.name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
|
|
273
|
-
| `buttonsSensors.mode` | Here select button mode. |
|
|
274
|
-
| `buttonsSensors.displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
275
|
-
| `buttonsSensors.namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
|
|
210
|
+
| `ataDevices[]` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
|
|
211
|
+
| `ataDevices[].id` | Read only data, do not change it. |
|
|
212
|
+
| `ataDevices[].type` | Read only data, do not change it. |
|
|
213
|
+
| `ataDevices[].typeString` | Read only data, do not change it. |
|
|
214
|
+
| `ataDevices[].name` | Here You can schange the `Accessory Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
215
|
+
| `ataDevices[].displayMode` | Here select device control mode `None/Disabled`, `Heater/Cooler`, `Thermostat`. |
|
|
216
|
+
| `ataDevices[].heatDryFanMode` | Here select the operatiing mode for `Heat`, if this mode is not supported, it will be disabled. |
|
|
217
|
+
| `ataDevices[].coolDryFanMode` | Here select the operatiing mode for `Cool`, if this mode is not supported, it will be disabled. |
|
|
218
|
+
| `ataDevices[].autoDryFanMode` | Here select the operatiing mode for `Auto`, if this mode is not supported, it will be disabled.. |
|
|
219
|
+
| `ataDevices[].temperatureSensor` | This enable extra `Room` temperature sensors to use with automations in HomeKit app. |
|
|
220
|
+
| `ataDevices[].temperatureSensorOutdoor` | This enable extra `Outdoor` temperature sensors to use with automations in HomeKit app. |
|
|
221
|
+
| `ataDevices[].refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
|
|
222
|
+
| `ataDevices[].presets[]` | Array of ATA device Presets created automatically after login to MELCloud from plugin config UI. |
|
|
223
|
+
| `ataDevices[].presets[].id` | Read only data, do not change it. |
|
|
224
|
+
| `ataDevices[].presets[].name` | Here You can schange the `Preset Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
225
|
+
| `ataDevices[].presets[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
226
|
+
| `ataDevices[].buttonsSensors[]` | Array of buttons sensors. |
|
|
227
|
+
| `ataDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
|
|
228
|
+
| `ataDevices[].buttonsSensors[].mode` | Here select button mode, VH - Vane Horizontal, VV - Vane Horizontal. |
|
|
229
|
+
| `ataDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
230
|
+
| `ataDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
|
|
231
|
+
| `atwDevices[]` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
|
|
232
|
+
| `atwDevices[].id` | Read only data, do not change it. |
|
|
233
|
+
| `atwDevices[].type` | Read only data, do not change it. |
|
|
234
|
+
| `atwDevices[].typeString` | Read only data, do not change it. |
|
|
235
|
+
| `atwDevices[].name` | Here You can schange the `Accessory Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
236
|
+
| `atwDevices[].displayMode` | Here select main control mode `None/Disabled`, `Heater/Cooler`, `Thermostat`. |
|
|
237
|
+
| `atwDevices[].hideZone` | Here select which zone need to be hidden `None/Disabled`, `Heat Pump`, `Heat Pump / Zone 1`, `Heat Pump / Zone 1 / Hot Water`, `Heat Pump / Zone 1 / Zone 2`, `Heat Pump / Hot Water`,`Heat Pump / Hot Water / Zone 2`, `Heat Pump / Zone 2`, `Zone 1`, `Zone 1 / Hot Water`, `Zone 1 / Hot Water / Zone 2`, `Zone 1 / Zone 2`, `Hot Water`, `Hot Water / Zone 2`, `Zone 2`, `All`. |
|
|
238
|
+
| `atwDevices[].temperatureSensor` | This enable extra `Room` temperature sensors to use with automations in HomeKit app. |
|
|
239
|
+
| `atwDevices[].temperatureSensorFlow` | This enable extra `Flow` temperature sensors to use with automations in HomeKit app. |
|
|
240
|
+
| `atwDevices[].temperatureSensorReturn` | This enable extra `Return` temperature sensors to use with automations in HomeKit app. |
|
|
241
|
+
| `atwDevices[].temperatureSensorFlowZone1` | This enable extra `Flow Zone 1` temperature sensors to use with automations in HomeKit app. |
|
|
242
|
+
| `atwDevices[].temperatureSensorReturnZone1` | This enable extra `Return Zone 1` temperature sensors to use with automations in HomeKit app. |
|
|
243
|
+
| `atwDevices[].temperatureSensorFlowWaterTank` | This enable extra `Flow Water Tank` temperature sensors to use with automations in HomeKit app. |
|
|
244
|
+
| `atwDevices[].temperatureSensorReturnWaterTank` | This enable extra `Return Water Tank` temperature sensors to use with automations in HomeKit app. |
|
|
245
|
+
| `atwDevices[].temperatureSensorFlowZone2` | This enable extra `Flow Zone 2` temperature sensors to use with automations in HomeKit app. |
|
|
246
|
+
| `atwDevices[].temperatureSensorReturnZone2` | This enable extra `Return Zone 2` temperature sensors to use with automations in HomeKit app. |
|
|
247
|
+
| `atwDevices[].refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
|
|
248
|
+
| `atwDevices[].presets[]` | Array of ATA device Presets created automatically after login to MELCloud from plugin config UI. |
|
|
249
|
+
| `atwDevices[].presets[].id` | Read only data, do not change it. |
|
|
250
|
+
| `atwDevices[].presets[].name` | Here You can schange the `Preset Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
251
|
+
| `atwDevices[].presets[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
252
|
+
| `atwDevices[].buttonsSensors[]` | Array of buttons sensors. |
|
|
253
|
+
| `atwDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
|
|
254
|
+
| `atwDevices[].buttonsSensors[].mode` | Here select button mode. |
|
|
255
|
+
| `atwDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
256
|
+
| `atwDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
|
|
257
|
+
| `ervDevices[]` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
|
|
258
|
+
| `ervDevices[].id` | Read only data, do not change it. |
|
|
259
|
+
| `ervDevices[].type` | Read only data, do not change it. |
|
|
260
|
+
| `ervDevices[].typeString` | Read only data, do not change it. |
|
|
261
|
+
| `ervDevices[].name` | Here You can schange the `Accessory Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
262
|
+
| `ervDevices[].displayMode` | Here select main control mode `None/Disabled`, `Heater/Cooler`, `Thermostat`. |
|
|
263
|
+
| `ervDevices[].temperatureSensor` | This enable extra `Room` temperature sensors to use with automations in HomeKit app. |
|
|
264
|
+
| `ervDevices[].temperatureSensorOutdoor` | This enable extra `Outdoor` temperature sensors to use with automations in HomeKit app. |
|
|
265
|
+
| `ervDevices[].temperatureSensorSupply` | This enable extra `Supply` temperature sensors to use with automations in HomeKit app. |
|
|
266
|
+
| `ervDevices[].refreshInterval` | Here set the background devices state refresh time in (sec), default `5s`. |
|
|
267
|
+
| `ervDevices[].presets[]` | Array of ATA device Presets created automatically after login to MELCloud from plugin config UI. |
|
|
268
|
+
| `ervDevices[].presets[].id` | Read only data, do not change it. |
|
|
269
|
+
| `ervDevices[].presets[].name` | Here You can schange the `Preset Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
270
|
+
| `ervDevices[].presets[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
271
|
+
| `ervDevices[].buttonsSensors[]` | Array of buttons sensors. |
|
|
272
|
+
| `ervDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
|
|
273
|
+
| `ervDevices[].buttonsSensors[].mode` | Here select button mode. |
|
|
274
|
+
| `ervDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
|
|
275
|
+
| `ervDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
|
|
276
276
|
| `refreshInterval` | Here set the background account data refresh time in (sec), default `120s`. |
|
|
277
|
-
| `
|
|
278
|
-
| `
|
|
279
|
-
| `
|
|
280
|
-
| `
|
|
281
|
-
| `
|
|
282
|
-
| `
|
|
283
|
-
| `
|
|
277
|
+
| `log{}` | Log object. |
|
|
278
|
+
| `log.deviceInfo` | If enabled, log device info will be displayed by every connections device to the network. |
|
|
279
|
+
| `log.sSuccess` | If enabled, success log will be displayed in console. |
|
|
280
|
+
| `log.info` | If enabled, info log will be displayed in console. |
|
|
281
|
+
| `log.warn` | If enabled, warn log will be displayed in console. |
|
|
282
|
+
| `log.error` | If enabled, error log will be displayed in console. |
|
|
283
|
+
| `log.debug` | If enabled, debug log will be displayed in console. |
|
|
284
|
+
| `restFul{}` | RSTful object. |
|
|
284
285
|
| `restFul.enable` | If enabled, RESTful server will start automatically and respond to any path request. |
|
|
285
286
|
| `restFul.debug` | If enabled, deep log will be present in homebridge console for RESTFul server. |
|
|
286
|
-
| `mqtt` |
|
|
287
|
+
| `mqtt{}` | MQTT object. |
|
|
287
288
|
| `mqtt.enable` | If enabled, MQTT Broker will start automatically and publish all awailable PV data. |
|
|
288
289
|
| `mqtt.host` | Here set the `IP Address` or `Hostname` for MQTT Broker. |
|
|
289
290
|
| `mqtt.port` | Here set the `Port` for MQTT Broker, default 1883. |
|
|
290
291
|
| `mqtt.clientId` | Here optional set the `Client Id` of MQTT Broker. |
|
|
291
292
|
| `mqtt.prefix` | Here set the `Prefix` for `Topic` or leave empty. |
|
|
292
|
-
| `mqtt.auth` | If enabled, MQTT Broker will use authorization credentials. |
|
|
293
|
-
| `mqtt.user` | Here set the MQTT Broker user. |
|
|
294
|
-
| `mqtt.passwd` | Here set the MQTT Broker password. |
|
|
295
293
|
| `mqtt.debug` | If enabled, deep log will be present in homebridge console for MQTT. |
|
|
294
|
+
| `mqtt.auth{}` | MQTT authorization object. |
|
|
295
|
+
| `mqtt.auth.enable` | Here enable authorization for MQTT Broker. |
|
|
296
|
+
| `mqtt.auth.user` | Here set the MQTT Broker user. |
|
|
297
|
+
| `mqtt.auth.passwd` | Here set the MQTT Broker password. |
|
|
296
298
|
|
|
297
299
|
### RESTful Integration
|
|
298
300
|
|
package/index.js
CHANGED
|
@@ -48,12 +48,12 @@ class MelCloudPlatform {
|
|
|
48
48
|
|
|
49
49
|
//log config
|
|
50
50
|
const logLevel = {
|
|
51
|
-
devInfo:
|
|
52
|
-
success:
|
|
53
|
-
info:
|
|
54
|
-
warn:
|
|
55
|
-
error:
|
|
56
|
-
debug:
|
|
51
|
+
devInfo: account.log?.deviceInfo,
|
|
52
|
+
success: account.log?.success,
|
|
53
|
+
info: account.log?.info,
|
|
54
|
+
warn: account.log?.warn,
|
|
55
|
+
error: account.log?.error,
|
|
56
|
+
debug: account.log?.debug
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
|
|
@@ -86,7 +86,7 @@ class MelCloudPlatform {
|
|
|
86
86
|
.on('start', async () => {
|
|
87
87
|
try {
|
|
88
88
|
//melcloud account
|
|
89
|
-
const melCloud = new MelCloud(user, passwd, language, accountFile, buildingsFile, devicesFile, logLevel.debug, false)
|
|
89
|
+
const melCloud = new MelCloud(user, passwd, language, accountFile, buildingsFile, devicesFile, logLevel.warn, logLevel.debug, false)
|
|
90
90
|
.on('success', (msg) => logLevel.success && log.success(`${accountName}, ${msg}`))
|
|
91
91
|
.on('info', (msg) => logLevel.info && log.info(`${accountName}, ${msg}`))
|
|
92
92
|
.on('debug', (msg) => logLevel.debug && log.info(`${accountName}, debug: ${msg}`))
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "3.10.0-beta.
|
|
4
|
+
"version": "3.10.0-beta.22",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/deviceata.js
CHANGED
|
@@ -24,10 +24,10 @@ class DeviceAta extends EventEmitter {
|
|
|
24
24
|
this.autoDryFanMode = device.autoDryFanMode || 1; //NONE, AUTO, DRY, FAN
|
|
25
25
|
this.presets = device.presets || [];
|
|
26
26
|
this.buttons = device.buttonsSensors || [];
|
|
27
|
-
this.logDeviceInfo = account.
|
|
28
|
-
this.logInfo = account.log
|
|
29
|
-
this.logWarn = account.log
|
|
30
|
-
this.logDebug = account.log
|
|
27
|
+
this.logDeviceInfo = account.log?.deviceInfo || false;
|
|
28
|
+
this.logInfo = account.log?.info || false;
|
|
29
|
+
this.logWarn = account.log?.warn || false;
|
|
30
|
+
this.logDebug = account.log?.debug || false;
|
|
31
31
|
this.contextKey = contextKey;
|
|
32
32
|
this.accountName = accountName;
|
|
33
33
|
this.deviceId = deviceId;
|
|
@@ -133,8 +133,8 @@ class DeviceAta extends EventEmitter {
|
|
|
133
133
|
port: this.mqtt.port || 1883,
|
|
134
134
|
clientId: this.mqtt.clientId ? `melcloud_${this.mqtt.clientId}_${Math.random().toString(16).slice(3)}` : `melcloud_${Math.random().toString(16).slice(3)}`,
|
|
135
135
|
prefix: this.mqtt.prefix ? `melcloud/${this.mqtt.prefix}/${this.deviceTypeText}/${this.deviceName}` : `melcloud/${this.deviceTypeText}/${this.deviceName}`,
|
|
136
|
-
user: this.mqtt.auth
|
|
137
|
-
passwd: this.mqtt.auth
|
|
136
|
+
user: this.mqtt.auth?.user,
|
|
137
|
+
passwd: this.mqtt.auth?.passwd,
|
|
138
138
|
debug: this.mqtt.debug || false
|
|
139
139
|
});
|
|
140
140
|
|
|
@@ -315,7 +315,7 @@ class DeviceAta extends EventEmitter {
|
|
|
315
315
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
316
316
|
if (this.logInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
317
317
|
} catch (error) {
|
|
318
|
-
this.emit('warn', `Set power error: ${error}`);
|
|
318
|
+
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
319
319
|
};
|
|
320
320
|
});
|
|
321
321
|
this.melCloudService.getCharacteristic(Characteristic.CurrentHeaterCoolerState)
|
|
@@ -352,7 +352,7 @@ class DeviceAta extends EventEmitter {
|
|
|
352
352
|
const operationModeText = AirConditioner.DriveMode[deviceData.Device.OperationMode];
|
|
353
353
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
354
354
|
} catch (error) {
|
|
355
|
-
this.emit('warn', `Set operation mode error: ${error}`);
|
|
355
|
+
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
356
356
|
};
|
|
357
357
|
});
|
|
358
358
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -400,7 +400,7 @@ class DeviceAta extends EventEmitter {
|
|
|
400
400
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
401
401
|
if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeed[fanSpeedModeText]}`);
|
|
402
402
|
} catch (error) {
|
|
403
|
-
this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
403
|
+
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
404
404
|
};
|
|
405
405
|
});
|
|
406
406
|
};
|
|
@@ -419,7 +419,7 @@ class DeviceAta extends EventEmitter {
|
|
|
419
419
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
420
420
|
if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirection[value]}`);
|
|
421
421
|
} catch (error) {
|
|
422
|
-
this.emit('warn', `Set vane swing mode error: ${error}`);
|
|
422
|
+
if (this.logWarn) this.emit('warn', `Set vane swing mode error: ${error}`);
|
|
423
423
|
};
|
|
424
424
|
});
|
|
425
425
|
};
|
|
@@ -440,7 +440,7 @@ class DeviceAta extends EventEmitter {
|
|
|
440
440
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
441
441
|
if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
442
442
|
} catch (error) {
|
|
443
|
-
this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
443
|
+
if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
444
444
|
};
|
|
445
445
|
});
|
|
446
446
|
if (modelSupportsHeat) {
|
|
@@ -461,7 +461,7 @@ class DeviceAta extends EventEmitter {
|
|
|
461
461
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
462
462
|
if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
463
463
|
} catch (error) {
|
|
464
|
-
this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
464
|
+
if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
465
465
|
};
|
|
466
466
|
});
|
|
467
467
|
};
|
|
@@ -480,7 +480,7 @@ class DeviceAta extends EventEmitter {
|
|
|
480
480
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
481
481
|
if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
482
482
|
} catch (error) {
|
|
483
|
-
this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
483
|
+
if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
484
484
|
};
|
|
485
485
|
});
|
|
486
486
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -495,7 +495,7 @@ class DeviceAta extends EventEmitter {
|
|
|
495
495
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
496
496
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
497
497
|
} catch (error) {
|
|
498
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
498
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
499
499
|
};
|
|
500
500
|
});
|
|
501
501
|
accessory.addService(this.melCloudService);
|
|
@@ -547,7 +547,7 @@ class DeviceAta extends EventEmitter {
|
|
|
547
547
|
const operationModeText = AirConditioner.DriveMode[deviceData.Device.OperationMode];
|
|
548
548
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
549
549
|
} catch (error) {
|
|
550
|
-
this.emit('warn', `Set operation mode error: ${error}`);
|
|
550
|
+
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
551
551
|
};
|
|
552
552
|
});
|
|
553
553
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -572,7 +572,7 @@ class DeviceAta extends EventEmitter {
|
|
|
572
572
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
573
573
|
if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
574
574
|
} catch (error) {
|
|
575
|
-
this.emit('warn', `Set temperature error: ${error}`);
|
|
575
|
+
if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
|
|
576
576
|
};
|
|
577
577
|
});
|
|
578
578
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -587,7 +587,7 @@ class DeviceAta extends EventEmitter {
|
|
|
587
587
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
588
588
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
589
589
|
} catch (error) {
|
|
590
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
590
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
591
591
|
};
|
|
592
592
|
});
|
|
593
593
|
accessory.addService(this.melCloudService);
|
|
@@ -682,7 +682,7 @@ class DeviceAta extends EventEmitter {
|
|
|
682
682
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
683
683
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
684
684
|
} catch (error) {
|
|
685
|
-
this.emit('warn', `Set preset error: ${error}`);
|
|
685
|
+
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
686
686
|
};
|
|
687
687
|
});
|
|
688
688
|
this.presetsServices.push(presetService);
|
|
@@ -915,14 +915,14 @@ class DeviceAta extends EventEmitter {
|
|
|
915
915
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
916
916
|
break;
|
|
917
917
|
default:
|
|
918
|
-
this.emit('warn', `Unknown button mode: ${mode}`);
|
|
918
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode}`);
|
|
919
919
|
break;
|
|
920
920
|
};
|
|
921
921
|
|
|
922
922
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
923
923
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
|
|
924
924
|
} catch (error) {
|
|
925
|
-
this.emit('warn', `Set button error: ${error}`);
|
|
925
|
+
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
926
926
|
};
|
|
927
927
|
});
|
|
928
928
|
this.buttonsServices.push(buttonService);
|
|
@@ -944,30 +944,29 @@ class DeviceAta extends EventEmitter {
|
|
|
944
944
|
contextKey: this.contextKey,
|
|
945
945
|
devicesFile: this.devicesFile,
|
|
946
946
|
deviceId: this.deviceId,
|
|
947
|
+
logWarn: this.logWarn,
|
|
947
948
|
logDebug: this.logDebug
|
|
948
949
|
})
|
|
949
950
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
950
|
-
if (
|
|
951
|
-
return;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
if (!this.logDeviceInfo) {
|
|
951
|
+
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
955
952
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
956
953
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
957
|
-
|
|
958
|
-
|
|
954
|
+
if (modelIndoor) this.emit('devInfo', `Indoor: ${modelIndoor}`);
|
|
955
|
+
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
959
956
|
this.emit('devInfo', `Serial: ${serialNumber}`);
|
|
960
957
|
this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
961
958
|
this.emit('devInfo', `Manufacturer: ${manufacturer}`);
|
|
962
959
|
this.emit('devInfo', '----------------------------------');
|
|
963
|
-
|
|
960
|
+
this.displayDeviceInfo = false;
|
|
961
|
+
}
|
|
964
962
|
|
|
965
963
|
//accessory info
|
|
966
964
|
this.manufacturer = manufacturer;
|
|
967
965
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
968
966
|
this.serialNumber = serialNumber;
|
|
969
967
|
this.firmwareRevision = firmwareAppVersion;
|
|
970
|
-
|
|
968
|
+
|
|
969
|
+
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, firmwareAppVersion);
|
|
971
970
|
})
|
|
972
971
|
.on('deviceState', async (deviceData) => {
|
|
973
972
|
this.deviceData = deviceData;
|
|
@@ -1093,7 +1092,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1093
1092
|
obj.targetOperationMode = 2;
|
|
1094
1093
|
break;
|
|
1095
1094
|
default:
|
|
1096
|
-
this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
1095
|
+
if (this.logWarn) this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
1097
1096
|
return
|
|
1098
1097
|
};
|
|
1099
1098
|
|
|
@@ -1176,7 +1175,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1176
1175
|
obj.targetOperationMode = 2;
|
|
1177
1176
|
break;
|
|
1178
1177
|
default:
|
|
1179
|
-
this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
1178
|
+
if (this.logWarn) this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
1180
1179
|
break;
|
|
1181
1180
|
};
|
|
1182
1181
|
|
|
@@ -1328,7 +1327,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1328
1327
|
button.state = (prohibitSetTemperature === true);
|
|
1329
1328
|
break;
|
|
1330
1329
|
default: //Unknown button
|
|
1331
|
-
this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1330
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1332
1331
|
break;
|
|
1333
1332
|
};
|
|
1334
1333
|
|
package/src/deviceatw.js
CHANGED
|
@@ -29,10 +29,10 @@ class DeviceAtw extends EventEmitter {
|
|
|
29
29
|
this.temperatureSensorReturnZone2 = device.temperatureSensorReturnZone2 || false;
|
|
30
30
|
this.presets = device.presets || [];
|
|
31
31
|
this.buttons = device.buttonsSensors || [];
|
|
32
|
-
this.logDeviceInfo = account.
|
|
33
|
-
this.logInfo = account.log
|
|
34
|
-
this.logWarn = account.log
|
|
35
|
-
this.logDebug = account.log
|
|
32
|
+
this.logDeviceInfo = account.log?.deviceInfo || false;
|
|
33
|
+
this.logInfo = account.log?.info || false;
|
|
34
|
+
this.logWarn = account.log?.warn || false;
|
|
35
|
+
this.logDebug = account.log?.debug || false;
|
|
36
36
|
this.contextKey = contextKey;
|
|
37
37
|
this.accountName = accountName;
|
|
38
38
|
this.deviceId = deviceId;
|
|
@@ -138,8 +138,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
138
138
|
port: this.mqtt.port || 1883,
|
|
139
139
|
clientId: this.mqtt.clientId ? `melcloud_${this.mqtt.clientId}_${Math.random().toString(16).slice(3)}` : `melcloud_${Math.random().toString(16).slice(3)}`,
|
|
140
140
|
prefix: this.mqtt.prefix ? `melcloud/${this.mqtt.prefix}/${this.deviceTypeText}/${this.deviceName}` : `melcloud/${this.deviceTypeText}/${this.deviceName}`,
|
|
141
|
-
user: this.mqtt.auth
|
|
142
|
-
passwd: this.mqtt.auth
|
|
141
|
+
user: this.mqtt.auth?.user,
|
|
142
|
+
passwd: this.mqtt.auth?.passwd,
|
|
143
143
|
debug: this.mqtt.debug || false
|
|
144
144
|
});
|
|
145
145
|
|
|
@@ -348,7 +348,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
348
348
|
break;
|
|
349
349
|
};
|
|
350
350
|
} catch (error) {
|
|
351
|
-
this.emit('warn', `Set power error: ${error}`);
|
|
351
|
+
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
352
352
|
};
|
|
353
353
|
});
|
|
354
354
|
melCloudService.getCharacteristic(Characteristic.CurrentHeaterCoolerState)
|
|
@@ -445,7 +445,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
445
445
|
await this.melCloudAtw.send(deviceData);
|
|
446
446
|
if (this.logInfo) this.emit('info', `${zoneName}, Set operation mode: ${operationModeText}`);
|
|
447
447
|
} catch (error) {
|
|
448
|
-
this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
448
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
449
449
|
};
|
|
450
450
|
});
|
|
451
451
|
melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -518,7 +518,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
518
518
|
const set = i > 0 ? await this.melCloudAtw.send(deviceData) : false;
|
|
519
519
|
const info = this.logInfo || i === 0 ? false : this.emit('info', `${zoneName}, Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
520
520
|
} catch (error) {
|
|
521
|
-
this.emit('warn', `${zoneName}, Set cooling threshold temperature error: ${error}`);
|
|
521
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set cooling threshold temperature error: ${error}`);
|
|
522
522
|
};
|
|
523
523
|
});
|
|
524
524
|
};
|
|
@@ -582,7 +582,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
582
582
|
const set = i > 0 ? await this.melCloudAtw.send(deviceData) : false;
|
|
583
583
|
const info = this.logInfo || i === 0 ? false : this.emit('info', `${zoneName}, Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
584
584
|
} catch (error) {
|
|
585
|
-
this.emit('warn', `${zoneName}, Set heating threshold temperature error: ${error}`);
|
|
585
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set heating threshold temperature error: ${error}`);
|
|
586
586
|
};
|
|
587
587
|
});
|
|
588
588
|
};
|
|
@@ -618,7 +618,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
618
618
|
await this.melCloudAtw.send(deviceData);
|
|
619
619
|
if (this.logInfo) this.emit('info', `${zoneName}, Set lock physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
620
620
|
} catch (error) {
|
|
621
|
-
this.emit('warn', `${zoneName}, Set lock physical controls error: ${error}`);
|
|
621
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set lock physical controls error: ${error}`);
|
|
622
622
|
};
|
|
623
623
|
});
|
|
624
624
|
melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -633,7 +633,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
633
633
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
634
634
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
635
635
|
} catch (error) {
|
|
636
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
636
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
637
637
|
};
|
|
638
638
|
});
|
|
639
639
|
this.melCloudServices.push(melCloudService);
|
|
@@ -753,7 +753,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
753
753
|
await this.melCloudAtw.send(deviceData);
|
|
754
754
|
if (this.logInfo) this.emit('info', `${zoneName}, Set operation mode: ${operationModeText}`);
|
|
755
755
|
} catch (error) {
|
|
756
|
-
this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
756
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
757
757
|
};
|
|
758
758
|
});
|
|
759
759
|
melCloudServiceT.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -800,7 +800,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
800
800
|
const set = i > 0 ? await this.melCloudAtw.send(deviceData) : false;
|
|
801
801
|
const info = this.logInfo || i === 0 ? false : this.emit('info', `${zoneName}, Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
802
802
|
} catch (error) {
|
|
803
|
-
this.emit('warn', `${zoneName}, Set temperature error: ${error}`);
|
|
803
|
+
if (this.logWarn) this.emit('warn', `${zoneName}, Set temperature error: ${error}`);
|
|
804
804
|
};
|
|
805
805
|
});
|
|
806
806
|
melCloudServiceT.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -815,7 +815,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
815
815
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
816
816
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
817
817
|
} catch (error) {
|
|
818
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
818
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
819
819
|
};
|
|
820
820
|
});
|
|
821
821
|
this.melCloudServices.push(melCloudServiceT);
|
|
@@ -1119,7 +1119,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1119
1119
|
await this.melCloudAtw.send(deviceData);
|
|
1120
1120
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
1121
1121
|
} catch (error) {
|
|
1122
|
-
this.emit('warn', `Set preset error: ${error}`);
|
|
1122
|
+
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
1123
1123
|
};
|
|
1124
1124
|
});
|
|
1125
1125
|
this.presetsServices.push(presetService);
|
|
@@ -1280,14 +1280,14 @@ class DeviceAtw extends EventEmitter {
|
|
|
1280
1280
|
HeatPump.EffectiveFlags.ProhibitHeatingZone2;
|
|
1281
1281
|
break;
|
|
1282
1282
|
default:
|
|
1283
|
-
this.emit('warn', `Unknown button mode: ${mode}`);
|
|
1283
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode}`);
|
|
1284
1284
|
break;
|
|
1285
1285
|
};
|
|
1286
1286
|
|
|
1287
1287
|
await this.melCloudAtw.send(deviceData);
|
|
1288
1288
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
|
|
1289
1289
|
} catch (error) {
|
|
1290
|
-
this.emit('warn', `Set button error: ${error}`);
|
|
1290
|
+
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
1291
1291
|
};
|
|
1292
1292
|
};
|
|
1293
1293
|
});
|
|
@@ -1310,18 +1310,15 @@ class DeviceAtw extends EventEmitter {
|
|
|
1310
1310
|
contextKey: this.contextKey,
|
|
1311
1311
|
devicesFile: this.devicesFile,
|
|
1312
1312
|
deviceId: this.deviceId,
|
|
1313
|
+
logWarn: this.logWarn,
|
|
1313
1314
|
logDebug: this.logDebug
|
|
1314
1315
|
})
|
|
1315
1316
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, hasHotWaterTank, hasZone2) => {
|
|
1316
|
-
if (
|
|
1317
|
-
return;
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
if (!this.logDeviceInfo) {
|
|
1317
|
+
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1321
1318
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
1322
1319
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
1323
|
-
|
|
1324
|
-
|
|
1320
|
+
if (modelIndoor) this.emit('devInfo', `Indoor: ${modelIndoor}`);
|
|
1321
|
+
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
1325
1322
|
this.emit('devInfo', `Serial: ${serialNumber}`)
|
|
1326
1323
|
this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
1327
1324
|
this.emit('devInfo', `Manufacturer: ${manufacturer}`);
|
|
@@ -1330,14 +1327,16 @@ class DeviceAtw extends EventEmitter {
|
|
|
1330
1327
|
this.emit('devInfo', `Hot Water Tank: ${hasHotWaterTank ? 'Yes' : 'No'}`);
|
|
1331
1328
|
this.emit('devInfo', `Zone 2: ${hasZone2 ? 'Yes' : 'No'}`);
|
|
1332
1329
|
this.emit('devInfo', '----------------------------------');
|
|
1333
|
-
|
|
1330
|
+
this.displayDeviceInfo = false;
|
|
1331
|
+
}
|
|
1334
1332
|
|
|
1335
1333
|
//accessory info
|
|
1336
1334
|
this.manufacturer = manufacturer;
|
|
1337
1335
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
1338
1336
|
this.serialNumber = serialNumber;
|
|
1339
1337
|
this.firmwareRevision = firmwareAppVersion;
|
|
1340
|
-
|
|
1338
|
+
|
|
1339
|
+
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, firmwareAppVersion);
|
|
1341
1340
|
})
|
|
1342
1341
|
.on('deviceState', async (deviceData) => {
|
|
1343
1342
|
this.deviceData = deviceData;
|
|
@@ -1917,7 +1916,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1917
1916
|
button.state = (prohibitZone2 === true);
|
|
1918
1917
|
break;
|
|
1919
1918
|
default: //Unknown button
|
|
1920
|
-
this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1919
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1921
1920
|
break;
|
|
1922
1921
|
};
|
|
1923
1922
|
|
package/src/deviceerv.js
CHANGED
|
@@ -22,10 +22,10 @@ class DeviceErv extends EventEmitter {
|
|
|
22
22
|
this.temperatureSensorSupply = device.temperatureSensorSupply || false;
|
|
23
23
|
this.presets = device.presets || [];
|
|
24
24
|
this.buttons = device.buttonsSensors || [];
|
|
25
|
-
this.logDeviceInfo = account.
|
|
26
|
-
this.logInfo = account.log
|
|
27
|
-
this.logWarn = account.log
|
|
28
|
-
this.logDebug = account.log
|
|
25
|
+
this.logDeviceInfo = account.log?.deviceInfo || false;
|
|
26
|
+
this.logInfo = account.log?.info || false;
|
|
27
|
+
this.logWarn = account.log?.warn || false;
|
|
28
|
+
this.logDebug = account.log?.debug || false;
|
|
29
29
|
this.contextKey = contextKey;
|
|
30
30
|
this.accountName = accountName;
|
|
31
31
|
this.deviceId = deviceId;
|
|
@@ -131,8 +131,8 @@ class DeviceErv extends EventEmitter {
|
|
|
131
131
|
port: this.mqtt.port || 1883,
|
|
132
132
|
clientId: this.mqtt.clientId ? `melcloud_${this.mqtt.clientId}_${Math.random().toString(16).slice(3)}` : `melcloud_${Math.random().toString(16).slice(3)}`,
|
|
133
133
|
prefix: this.mqtt.prefix ? `melcloud/${this.mqtt.prefix}/${this.deviceTypeText}/${this.deviceName}` : `melcloud/${this.deviceTypeText}/${this.deviceName}`,
|
|
134
|
-
user: this.mqtt.auth
|
|
135
|
-
passwd: this.mqtt.auth
|
|
134
|
+
user: this.mqtt.auth?.user,
|
|
135
|
+
passwd: this.mqtt.auth?.passwd,
|
|
136
136
|
debug: this.mqtt.debug || false
|
|
137
137
|
});
|
|
138
138
|
|
|
@@ -302,7 +302,7 @@ class DeviceErv extends EventEmitter {
|
|
|
302
302
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
303
303
|
if (this.logInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
304
304
|
} catch (error) {
|
|
305
|
-
this.emit('warn', `Set power error: ${error}`);
|
|
305
|
+
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
306
306
|
};
|
|
307
307
|
});
|
|
308
308
|
this.melCloudService.getCharacteristic(Characteristic.CurrentHeaterCoolerState)
|
|
@@ -339,7 +339,7 @@ class DeviceErv extends EventEmitter {
|
|
|
339
339
|
const operationModeText = Ventilation.VentilationMode[deviceData.Device.VentilationMode];
|
|
340
340
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
341
341
|
} catch (error) {
|
|
342
|
-
this.emit('warn', `Set operation mode error: ${error}`);
|
|
342
|
+
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
343
343
|
};
|
|
344
344
|
});
|
|
345
345
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -382,7 +382,7 @@ class DeviceErv extends EventEmitter {
|
|
|
382
382
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
383
383
|
if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeed[fanSpeedModeText]}`);
|
|
384
384
|
} catch (error) {
|
|
385
|
-
this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
385
|
+
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
386
386
|
};
|
|
387
387
|
});
|
|
388
388
|
//device can cool
|
|
@@ -404,7 +404,7 @@ class DeviceErv extends EventEmitter {
|
|
|
404
404
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
405
405
|
if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
406
406
|
} catch (error) {
|
|
407
|
-
this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
407
|
+
if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
408
408
|
};
|
|
409
409
|
});
|
|
410
410
|
};
|
|
@@ -427,7 +427,7 @@ class DeviceErv extends EventEmitter {
|
|
|
427
427
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
428
428
|
if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
429
429
|
} catch (error) {
|
|
430
|
-
this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
430
|
+
if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
431
431
|
};
|
|
432
432
|
});
|
|
433
433
|
};
|
|
@@ -445,7 +445,7 @@ class DeviceErv extends EventEmitter {
|
|
|
445
445
|
// await this.melCloudErv.send(deviceData, this.displayMode);
|
|
446
446
|
// if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
447
447
|
// } catch (error) {
|
|
448
|
-
// this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
448
|
+
// if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
449
449
|
// };
|
|
450
450
|
// });
|
|
451
451
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -460,7 +460,7 @@ class DeviceErv extends EventEmitter {
|
|
|
460
460
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
461
461
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
462
462
|
} catch (error) {
|
|
463
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
463
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
464
464
|
};
|
|
465
465
|
});
|
|
466
466
|
accessory.addService(this.melCloudService);
|
|
@@ -512,7 +512,7 @@ class DeviceErv extends EventEmitter {
|
|
|
512
512
|
const operationModeText = Ventilation.VentilationMode[deviceData.Device.VentilationMode];
|
|
513
513
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
514
514
|
} catch (error) {
|
|
515
|
-
this.emit('warn', `Set operation mode error: ${error}`);
|
|
515
|
+
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
516
516
|
};
|
|
517
517
|
});
|
|
518
518
|
this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -537,7 +537,7 @@ class DeviceErv extends EventEmitter {
|
|
|
537
537
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
538
538
|
if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
539
539
|
} catch (error) {
|
|
540
|
-
this.emit('warn', `Set temperature error: ${error}`);
|
|
540
|
+
if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
|
|
541
541
|
};
|
|
542
542
|
});
|
|
543
543
|
this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
|
|
@@ -552,7 +552,7 @@ class DeviceErv extends EventEmitter {
|
|
|
552
552
|
this.emit('melCloud', 'UseFahrenheit', value);
|
|
553
553
|
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
554
554
|
} catch (error) {
|
|
555
|
-
this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
555
|
+
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
556
556
|
};
|
|
557
557
|
});
|
|
558
558
|
accessory.addService(this.melCloudService);
|
|
@@ -729,7 +729,7 @@ class DeviceErv extends EventEmitter {
|
|
|
729
729
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
730
730
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
731
731
|
} catch (error) {
|
|
732
|
-
this.emit('warn', `Set preset error: ${error}`);
|
|
732
|
+
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
733
733
|
};
|
|
734
734
|
});
|
|
735
735
|
});
|
|
@@ -836,14 +836,14 @@ class DeviceErv extends EventEmitter {
|
|
|
836
836
|
deviceData.hideOutdoorTemperature = state;
|
|
837
837
|
break;
|
|
838
838
|
default:
|
|
839
|
-
this.emit('warn', `Unknown button mode: ${mode}`);
|
|
839
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode}`);
|
|
840
840
|
break;
|
|
841
841
|
};
|
|
842
842
|
|
|
843
843
|
await this.melCloudErv.send(deviceData, this.displayMode);
|
|
844
844
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${buttonName}` : `Unset: ${buttonName}, Set: ${button.previousValue}`}`);
|
|
845
845
|
} catch (error) {
|
|
846
|
-
this.emit('warn', `Set button error: ${error}`);
|
|
846
|
+
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
847
847
|
};
|
|
848
848
|
});
|
|
849
849
|
this.buttonsServices.push(buttonService);
|
|
@@ -865,30 +865,29 @@ class DeviceErv extends EventEmitter {
|
|
|
865
865
|
contextKey: this.contextKey,
|
|
866
866
|
devicesFile: this.devicesFile,
|
|
867
867
|
deviceId: this.deviceId,
|
|
868
|
+
logWarn: this.logWarn,
|
|
868
869
|
logDebug: this.logDebug
|
|
869
870
|
})
|
|
870
871
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
871
|
-
if (
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
if (!this.logDeviceInfo) {
|
|
872
|
+
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
876
873
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
877
874
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
878
|
-
|
|
879
|
-
|
|
875
|
+
if (modelIndoor) this.emit('devInfo', `Indoor: ${modelIndoor}`);
|
|
876
|
+
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
880
877
|
this.emit('devInfo', `Serial: ${serialNumber}`);
|
|
881
878
|
this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
882
879
|
this.emit('devInfo', `Manufacturer: ${manufacturer}`);
|
|
883
880
|
this.emit('devInfo', '----------------------------------');
|
|
884
|
-
|
|
881
|
+
this.displayDeviceInfo = false;
|
|
882
|
+
}
|
|
885
883
|
|
|
886
884
|
//accessory info
|
|
887
885
|
this.manufacturer = manufacturer;
|
|
888
886
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
889
887
|
this.serialNumber = serialNumber;
|
|
890
888
|
this.firmwareRevision = firmwareAppVersion;
|
|
891
|
-
|
|
889
|
+
|
|
890
|
+
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, firmwareAppVersion);
|
|
892
891
|
})
|
|
893
892
|
.on('deviceState', async (deviceData) => {
|
|
894
893
|
this.deviceData = deviceData;
|
|
@@ -1005,13 +1004,13 @@ class DeviceErv extends EventEmitter {
|
|
|
1005
1004
|
obj.currentOperationMode = 3;
|
|
1006
1005
|
break;
|
|
1007
1006
|
default:
|
|
1008
|
-
this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
|
|
1007
|
+
if (this.logWarn) this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
|
|
1009
1008
|
break;
|
|
1010
1009
|
};
|
|
1011
1010
|
obj.targetOperationMode = 0;
|
|
1012
1011
|
break;
|
|
1013
1012
|
default:
|
|
1014
|
-
this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
|
|
1013
|
+
if (this.logWarn) this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
|
|
1015
1014
|
break;
|
|
1016
1015
|
};
|
|
1017
1016
|
|
|
@@ -1070,13 +1069,13 @@ class DeviceErv extends EventEmitter {
|
|
|
1070
1069
|
obj.currentOperationMode = 2;
|
|
1071
1070
|
break;
|
|
1072
1071
|
default:
|
|
1073
|
-
this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
|
|
1072
|
+
if (this.logWarn) this.emit('warn', `Unknown actual ventilation mode: ${actualVentilationMode}`);
|
|
1074
1073
|
break;
|
|
1075
1074
|
};
|
|
1076
1075
|
obj.targetOperationMode = 3;
|
|
1077
1076
|
break;
|
|
1078
1077
|
default:
|
|
1079
|
-
this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
|
|
1078
|
+
if (this.logWarn) this.emit('warn', `Unknown ventilation mode: ${ventilationMode}`);
|
|
1080
1079
|
break;
|
|
1081
1080
|
};
|
|
1082
1081
|
|
|
@@ -1182,7 +1181,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1182
1181
|
button.state = (hideOutdoorTemperature === true);
|
|
1183
1182
|
break;
|
|
1184
1183
|
default: //Unknown button
|
|
1185
|
-
this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1184
|
+
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode} detected`);
|
|
1186
1185
|
break;
|
|
1187
1186
|
};
|
|
1188
1187
|
|
package/src/melcloud.js
CHANGED
|
@@ -6,11 +6,12 @@ import Functions from './functions.js';
|
|
|
6
6
|
import { ApiUrls } from './constants.js';
|
|
7
7
|
|
|
8
8
|
class MelCloud extends EventEmitter {
|
|
9
|
-
constructor(user, passwd, language, accountFile, buildingsFile, devicesFile, logDebug, requestConfig) {
|
|
9
|
+
constructor(user, passwd, language, accountFile, buildingsFile, devicesFile, logWarn, logDebug, requestConfig) {
|
|
10
10
|
super();
|
|
11
11
|
this.accountFile = accountFile;
|
|
12
12
|
this.buildingsFile = buildingsFile;
|
|
13
13
|
this.devicesFile = devicesFile;
|
|
14
|
+
this.logWarn = logWarn;
|
|
14
15
|
this.logDebug = logDebug;
|
|
15
16
|
this.requestConfig = requestConfig;
|
|
16
17
|
this.devicesId = [];
|
|
@@ -67,7 +68,7 @@ class MelCloud extends EventEmitter {
|
|
|
67
68
|
if (this.logDebug) this.emit('debug', `Buildings: ${JSON.stringify(buildingsList, null, 2)}`);
|
|
68
69
|
|
|
69
70
|
if (!buildingsList) {
|
|
70
|
-
this.emit('warn', `No building found`);
|
|
71
|
+
if (this.logWarn) this.emit('warn', `No building found`);
|
|
71
72
|
return null;
|
|
72
73
|
}
|
|
73
74
|
|
|
@@ -90,7 +91,7 @@ class MelCloud extends EventEmitter {
|
|
|
90
91
|
|
|
91
92
|
const devicesCount = devices.length;
|
|
92
93
|
if (devicesCount === 0) {
|
|
93
|
-
this.emit('warn', `No devices found`);
|
|
94
|
+
if (this.logWarn) this.emit('warn', `No devices found`);
|
|
94
95
|
return null;
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -132,7 +133,7 @@ class MelCloud extends EventEmitter {
|
|
|
132
133
|
if (this.logDebug) this.emit('debug', `MELCloud Info: ${JSON.stringify(debugData, null, 2)}`);
|
|
133
134
|
|
|
134
135
|
if (!contextKey) {
|
|
135
|
-
this.emit('warn', `Context key missing`);
|
|
136
|
+
if (this.logWarn) this.emit('warn', `Context key missing`);
|
|
136
137
|
return null;
|
|
137
138
|
}
|
|
138
139
|
|
package/src/melcloudata.js
CHANGED
|
@@ -10,6 +10,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
+
this.logWarn = config.logWarn;
|
|
13
14
|
this.logDebug = config.logDebug;
|
|
14
15
|
this.functions = new Functions();
|
|
15
16
|
|
|
@@ -64,7 +65,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
64
65
|
const devicesData = JSON.parse(data);
|
|
65
66
|
|
|
66
67
|
if (!Array.isArray(devicesData)) {
|
|
67
|
-
this.emit('warn', `Device data not found`);
|
|
68
|
+
if (this.logWarn) this.emit('warn', `Device data not found`);
|
|
68
69
|
return null;
|
|
69
70
|
}
|
|
70
71
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
@@ -323,7 +324,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
323
324
|
|
|
324
325
|
//display info if units are not configured in MELCloud service
|
|
325
326
|
if (unitsCount === 0) {
|
|
326
|
-
this.emit('warn', `Units are not configured in MELCloud service`);
|
|
327
|
+
if (this.logWarn) this.emit('warn', `Units are not configured in MELCloud service`);
|
|
327
328
|
};
|
|
328
329
|
|
|
329
330
|
const deviceState = {
|
package/src/melcloudatw.js
CHANGED
|
@@ -10,6 +10,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
+
this.logWarn = config.logWarn;
|
|
13
14
|
this.logDebug = config.logDebug;
|
|
14
15
|
this.functions = new Functions();
|
|
15
16
|
|
|
@@ -64,7 +65,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
64
65
|
const devicesData = JSON.parse(data);
|
|
65
66
|
|
|
66
67
|
if (!Array.isArray(devicesData)) {
|
|
67
|
-
this.emit('warn', `Device data not found`);
|
|
68
|
+
if (this.logWarn) this.emit('warn', `Device data not found`);
|
|
68
69
|
return null;
|
|
69
70
|
}
|
|
70
71
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
package/src/melclouderv.js
CHANGED
|
@@ -10,6 +10,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
10
10
|
super();
|
|
11
11
|
this.devicesFile = config.devicesFile;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
|
+
this.logWarn = config.logWarn;
|
|
13
14
|
this.logDebug = config.logDebug;
|
|
14
15
|
this.functions = new Functions();
|
|
15
16
|
|
|
@@ -64,7 +65,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
64
65
|
const devicesData = JSON.parse(data);
|
|
65
66
|
|
|
66
67
|
if (!Array.isArray(devicesData)) {
|
|
67
|
-
this.emit('warn', `Device data not found`);
|
|
68
|
+
if (this.logWarn) this.emit('warn', `Device data not found`);
|
|
68
69
|
return null;
|
|
69
70
|
}
|
|
70
71
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|