homebridge-melcloud-control 3.5.1 → 3.5.3-beta.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/README.md +6 -3
- package/config.schema.json +28 -9
- package/index.js +57 -45
- package/package.json +2 -2
- package/src/deviceata.js +1232 -1231
- package/src/deviceatw.js +1674 -1673
- package/src/deviceerv.js +1002 -1001
- package/src/impulsegenerator.js +14 -13
- 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/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.5.
|
|
4
|
+
"version": "3.5.3-beta.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",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"node": "^18.20.4 || ^20.15.1 || ^22.7.0 || ^23.2.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@homebridge/plugin-ui-utils": "^2.0.
|
|
38
|
+
"@homebridge/plugin-ui-utils": "^2.0.1",
|
|
39
39
|
"async-mqtt": "^2.6.3",
|
|
40
40
|
"axios": "^1.7.9",
|
|
41
41
|
"express": "^4.21.2"
|