homebridge-melcloud-control 3.1.1-beta.1 → 3.1.1
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/homebridge-ui/server.js +1 -1
- package/index.js +16 -16
- package/package.json +1 -1
- package/src/melcloud.js +2 -3
package/homebridge-ui/server.js
CHANGED
|
@@ -22,7 +22,7 @@ class PluginUiServer extends HomebridgePluginUiServer {
|
|
|
22
22
|
const accountInfoFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Account`;
|
|
23
23
|
const buildingsFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Buildings`;
|
|
24
24
|
const deviceFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Device_`;
|
|
25
|
-
const melCloud = new MelCloud(user, passwd, language, accountInfoFile, buildingsFile, deviceFile, false,
|
|
25
|
+
const melCloud = new MelCloud(user, passwd, language, accountInfoFile, buildingsFile, deviceFile, false, true);
|
|
26
26
|
let data = {};
|
|
27
27
|
|
|
28
28
|
try {
|
package/index.js
CHANGED
|
@@ -74,7 +74,22 @@ class MelCloudPlatform {
|
|
|
74
74
|
|
|
75
75
|
try {
|
|
76
76
|
//melcloud account
|
|
77
|
-
const melCloud = new MelCloud(user, passwd, language, accountInfoFile, buildingsFile, deviceFile, enableDebugMode,
|
|
77
|
+
const melCloud = new MelCloud(user, passwd, language, accountInfoFile, buildingsFile, deviceFile, enableDebugMode, false);
|
|
78
|
+
melCloud.on('success', (message) => {
|
|
79
|
+
log.success(`Account ${accountName}, ${message}`);
|
|
80
|
+
})
|
|
81
|
+
.on('message', (message) => {
|
|
82
|
+
log.info(`Account ${accountName}, ${message}`);
|
|
83
|
+
})
|
|
84
|
+
.on('debug', (debug) => {
|
|
85
|
+
log.info(`Account ${accountName}, debug: ${debug}`);
|
|
86
|
+
})
|
|
87
|
+
.on('warn', (warn) => {
|
|
88
|
+
log.warn(`Account ${accountName}, ${warn}`);
|
|
89
|
+
})
|
|
90
|
+
.on('error', (error) => {
|
|
91
|
+
log.error(`Account ${accountName}, ${error}.`);
|
|
92
|
+
});
|
|
78
93
|
|
|
79
94
|
//connect
|
|
80
95
|
const response = await melCloud.connect();
|
|
@@ -200,21 +215,6 @@ class MelCloudPlatform {
|
|
|
200
215
|
log.error(`${deviceTypeText}, ${deviceName}, ${error}`);
|
|
201
216
|
});
|
|
202
217
|
};
|
|
203
|
-
melCloud.on('success', (message) => {
|
|
204
|
-
log.success(`Account ${accountName}, ${message}`);
|
|
205
|
-
})
|
|
206
|
-
.on('message', (message) => {
|
|
207
|
-
log.info(`Account ${accountName}, ${message}`);
|
|
208
|
-
})
|
|
209
|
-
.on('debug', (debug) => {
|
|
210
|
-
log.info(`Account ${accountName}, debug: ${debug}`);
|
|
211
|
-
})
|
|
212
|
-
.on('warn', (warn) => {
|
|
213
|
-
log.warn(`Account ${accountName}, ${warn}`);
|
|
214
|
-
})
|
|
215
|
-
.on('error', (error) => {
|
|
216
|
-
log.error(`Account ${accountName}, ${error}.`);
|
|
217
|
-
});
|
|
218
218
|
} catch (error) {
|
|
219
219
|
log.error(`Account: ${accountName}, MELCloud error: ${error.message ?? error}`);
|
|
220
220
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "3.1.1
|
|
4
|
+
"version": "3.1.1",
|
|
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/melcloud.js
CHANGED
|
@@ -8,13 +8,12 @@ const ImpulseGenerator = require('./impulsegenerator.js');
|
|
|
8
8
|
const CONSTANTS = require('./constants.json');
|
|
9
9
|
|
|
10
10
|
class MelCloud extends EventEmitter {
|
|
11
|
-
constructor(user, passwd, language, accountInfoFile, buildingsFile, deviceFile, enableDebugMode,
|
|
11
|
+
constructor(user, passwd, language, accountInfoFile, buildingsFile, deviceFile, enableDebugMode, requestConfig) {
|
|
12
12
|
super();
|
|
13
13
|
this.accountInfoFile = accountInfoFile;
|
|
14
14
|
this.buildingsFile = buildingsFile;
|
|
15
15
|
this.deviceFile = deviceFile;
|
|
16
16
|
this.enableDebugMode = enableDebugMode;
|
|
17
|
-
this.refreshInterval = refreshInterval;
|
|
18
17
|
this.requestConfig = requestConfig;
|
|
19
18
|
this.contextKey = '';
|
|
20
19
|
this.devicesId = [];
|
|
@@ -121,7 +120,7 @@ class MelCloud extends EventEmitter {
|
|
|
121
120
|
const debug = this.enableDebugMode ? this.emit('debug', `Scanning for devices.`) : false;
|
|
122
121
|
const listDevicesData = await axiosInstanceGet(CONSTANTS.ApiUrls.ListDevices);
|
|
123
122
|
const buildingsList = listDevicesData.data;
|
|
124
|
-
const debug1 =
|
|
123
|
+
const debug1 = this.enableDebugMode ? this.emit('debug', `Buildings: ${JSON.stringify(buildingsList, null, 2)}`) : false;
|
|
125
124
|
|
|
126
125
|
if (!buildingsList) {
|
|
127
126
|
this.emit('warn', `No building found.`);
|