homebridge-melcloud-control 4.3.4-beta.1 → 4.3.4-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +22 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -85,8 +85,22 @@ class MelCloudPlatform {
|
|
|
85
85
|
.on('start', async () => {
|
|
86
86
|
try {
|
|
87
87
|
//melcloud account
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
let configureAccount;
|
|
89
|
+
let timmers = []
|
|
90
|
+
switch (account.type) {
|
|
91
|
+
case 'melcloud':
|
|
92
|
+
timmers = [{ name: 'checkDevicesList', sampling: refreshInterval }];
|
|
93
|
+
configureAccount = new MelCloud(account, accountFile, buildingsFile, devicesFile, true);
|
|
94
|
+
break;
|
|
95
|
+
case 'melcloudhome':
|
|
96
|
+
timmers = [{ name: 'connect', sampling: 3300000 }, { name: 'checkDevicesList', sampling: 3000 }];
|
|
97
|
+
configureAccount = new MelCloudHome(account, accountFile, buildingsFile, devicesFile, true);
|
|
98
|
+
break;
|
|
99
|
+
default:
|
|
100
|
+
if (logLevel.warn) log.warn(`Unknown account type: ${account.type}.`);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
configureAccount.on('success', (msg) => log.success(`${accountName}, ${msg}`))
|
|
90
104
|
.on('info', (msg) => log.info(`${accountName}, ${msg}`))
|
|
91
105
|
.on('debug', (msg) => log.info(`${accountName}, debug: ${msg}`))
|
|
92
106
|
.on('warn', (msg) => log.warn(`${accountName}, ${msg}`))
|
|
@@ -95,7 +109,7 @@ class MelCloudPlatform {
|
|
|
95
109
|
//connect
|
|
96
110
|
let accountInfo;
|
|
97
111
|
try {
|
|
98
|
-
accountInfo = await
|
|
112
|
+
accountInfo = await configureAccount.connect();
|
|
99
113
|
} catch (error) {
|
|
100
114
|
if (logLevel.error) log.error(`${accountName}, Connect error: ${error.message ?? error}`);
|
|
101
115
|
return;
|
|
@@ -110,7 +124,7 @@ class MelCloudPlatform {
|
|
|
110
124
|
//check devices list
|
|
111
125
|
let devicesList;
|
|
112
126
|
try {
|
|
113
|
-
devicesList = await
|
|
127
|
+
devicesList = await configureAccount.checkDevicesList();
|
|
114
128
|
} catch (error) {
|
|
115
129
|
if (logLevel.error) log.error(`${accountName}, Check devices list error: ${error.message ?? error}`);
|
|
116
130
|
return;
|
|
@@ -192,15 +206,15 @@ class MelCloudPlatform {
|
|
|
192
206
|
api.publishExternalAccessories(PluginName, [accessory]);
|
|
193
207
|
if (logLevel.success) log.success(`${accountName}, ${deviceTypeString}, ${deviceName}, Published as external accessory.`);
|
|
194
208
|
|
|
195
|
-
//start impulse generators
|
|
209
|
+
//start impulse generators for device
|
|
196
210
|
await configuredDevice.startStopImpulseGenerator(true, [{ name: 'checkState', sampling: deviceRefreshInterval }]);
|
|
197
211
|
}
|
|
198
212
|
}
|
|
199
213
|
|
|
200
|
-
|
|
201
|
-
await
|
|
214
|
+
//start melcloud impulse generator
|
|
215
|
+
await configureAccount.impulseGenerator.state(true, timmers, false);
|
|
202
216
|
|
|
203
|
-
//stop impulse generator
|
|
217
|
+
//stop start impulse generator
|
|
204
218
|
await impulseGenerator.state(false);
|
|
205
219
|
} catch (error) {
|
|
206
220
|
if (logLevel.error) log.error(`${accountName}, Start impulse generator error, ${error.message ?? error}, trying again.`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.3.4-beta.
|
|
4
|
+
"version": "4.3.4-beta.2",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|