homebridge-melcloud-control 3.1.4-beta.8 → 3.1.4-beta.9
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 +5 -5
- package/package.json +1 -1
- package/src/deviceata.js +2 -2
- package/src/deviceatw.js +2 -2
- package/src/deviceerv.js +2 -2
- package/src/melcloud.js +8 -6
- package/src/melcloudata.js +2 -2
- package/src/melcloudatw.js +2 -2
- package/src/melclouderv.js +2 -2
package/index.js
CHANGED
|
@@ -55,7 +55,7 @@ class MelCloudPlatform {
|
|
|
55
55
|
|
|
56
56
|
//define directory and file paths
|
|
57
57
|
const prefDir = path.join(api.user.storagePath(), 'melcloud');
|
|
58
|
-
const
|
|
58
|
+
const accountFile = `${prefDir}/${accountName}_Account`;
|
|
59
59
|
const buildingsFile = `${prefDir}/${accountName}_Buildings`;
|
|
60
60
|
const devicesFile = `${prefDir}/${accountName}_Devices`;
|
|
61
61
|
|
|
@@ -74,7 +74,7 @@ class MelCloudPlatform {
|
|
|
74
74
|
|
|
75
75
|
try {
|
|
76
76
|
//melcloud account
|
|
77
|
-
const melCloud = new MelCloud(user, passwd, language,
|
|
77
|
+
const melCloud = new MelCloud(user, passwd, language, accountFile, buildingsFile, devicesFile, enableDebugMode, false);
|
|
78
78
|
melCloud.on('success', (message) => {
|
|
79
79
|
log.success(`Account ${accountName}, ${message}`);
|
|
80
80
|
})
|
|
@@ -114,7 +114,7 @@ class MelCloudPlatform {
|
|
|
114
114
|
|
|
115
115
|
const deviceName = device.name;
|
|
116
116
|
const deviceTypeText = device.typeString;
|
|
117
|
-
const airConditioner = new DeviceAta(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText,
|
|
117
|
+
const airConditioner = new DeviceAta(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountFile, devicesFile, deviceRefreshInterval)
|
|
118
118
|
airConditioner.on('publishAccessory', (accessory) => {
|
|
119
119
|
|
|
120
120
|
//publish device
|
|
@@ -152,7 +152,7 @@ class MelCloudPlatform {
|
|
|
152
152
|
|
|
153
153
|
const deviceName = device.name;
|
|
154
154
|
const deviceTypeText = device.typeString;
|
|
155
|
-
const heatPump = new DeviceAtw(api, account, melCloud, device, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText,
|
|
155
|
+
const heatPump = new DeviceAtw(api, account, melCloud, device, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountFile, devicesFile, deviceRefreshInterval)
|
|
156
156
|
heatPump.on('publishAccessory', (accessory) => {
|
|
157
157
|
|
|
158
158
|
//publish device
|
|
@@ -190,7 +190,7 @@ class MelCloudPlatform {
|
|
|
190
190
|
|
|
191
191
|
const deviceName = device.name;
|
|
192
192
|
const deviceTypeText = device.typeString;
|
|
193
|
-
const energyRecoveryVentilation = new DeviceErv(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText,
|
|
193
|
+
const energyRecoveryVentilation = new DeviceErv(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountFile, devicesFile, deviceRefreshInterval)
|
|
194
194
|
energyRecoveryVentilation.on('publishAccessory', (accessory) => {
|
|
195
195
|
|
|
196
196
|
//publish device
|
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.4-beta.
|
|
4
|
+
"version": "3.1.4-beta.9",
|
|
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
|
@@ -7,7 +7,7 @@ const CONSTANTS = require('./constants.json');
|
|
|
7
7
|
let Accessory, Characteristic, Service, Categories, AccessoryUUID;
|
|
8
8
|
|
|
9
9
|
class DeviceAta extends EventEmitter {
|
|
10
|
-
constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText,
|
|
10
|
+
constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountFile, devicesFile, refreshInterval) {
|
|
11
11
|
super();
|
|
12
12
|
|
|
13
13
|
Accessory = api.platformAccessory;
|
|
@@ -94,7 +94,7 @@ class DeviceAta extends EventEmitter {
|
|
|
94
94
|
//melcloud device
|
|
95
95
|
this.melCloudAta = new MelCloudAta({
|
|
96
96
|
contextKey: contextKey,
|
|
97
|
-
|
|
97
|
+
accountFile: accountFile,
|
|
98
98
|
devicesFile: devicesFile,
|
|
99
99
|
deviceId: deviceId,
|
|
100
100
|
debugLog: account.enableDebugMode,
|
package/src/deviceatw.js
CHANGED
|
@@ -7,7 +7,7 @@ const CONSTANTS = require('./constants.json');
|
|
|
7
7
|
let Accessory, Characteristic, Service, Categories, AccessoryUUID;
|
|
8
8
|
|
|
9
9
|
class DeviceAtw extends EventEmitter {
|
|
10
|
-
constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText,
|
|
10
|
+
constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountFile, devicesFile, refreshInterval) {
|
|
11
11
|
super();
|
|
12
12
|
|
|
13
13
|
Accessory = api.platformAccessory;
|
|
@@ -90,7 +90,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
90
90
|
//melcloud device
|
|
91
91
|
this.melCloudAtw = new MelCloudAtw({
|
|
92
92
|
contextKey: contextKey,
|
|
93
|
-
|
|
93
|
+
accountFile: accountFile,
|
|
94
94
|
devicesFile: devicesFile,
|
|
95
95
|
deviceId: deviceId,
|
|
96
96
|
debugLog: account.enableDebugMode,
|
package/src/deviceerv.js
CHANGED
|
@@ -7,7 +7,7 @@ const CONSTANTS = require('./constants.json');
|
|
|
7
7
|
let Accessory, Characteristic, Service, Categories, AccessoryUUID;
|
|
8
8
|
|
|
9
9
|
class DeviceErv extends EventEmitter {
|
|
10
|
-
constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText,
|
|
10
|
+
constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountFile, devicesFile, refreshInterval) {
|
|
11
11
|
super();
|
|
12
12
|
|
|
13
13
|
Accessory = api.platformAccessory;
|
|
@@ -93,7 +93,7 @@ class DeviceErv extends EventEmitter {
|
|
|
93
93
|
//melcloud device
|
|
94
94
|
this.melCloudErv = new MelCloudErv({
|
|
95
95
|
contextKey: contextKey,
|
|
96
|
-
|
|
96
|
+
accountFile: accountFile,
|
|
97
97
|
devicesFile: devicesFile,
|
|
98
98
|
deviceId: deviceId,
|
|
99
99
|
debugLog: account.enableDebugMode,
|
package/src/melcloud.js
CHANGED
|
@@ -8,14 +8,15 @@ 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,
|
|
11
|
+
constructor(user, passwd, language, accountFile, buildingsFile, devicesFile, enableDebugMode, requestConfig) {
|
|
12
12
|
super();
|
|
13
|
-
this.
|
|
13
|
+
this.accountFile = accountFile;
|
|
14
14
|
this.buildingsFile = buildingsFile;
|
|
15
15
|
this.devicesFile = devicesFile;
|
|
16
16
|
this.enableDebugMode = enableDebugMode;
|
|
17
17
|
this.requestConfig = requestConfig;
|
|
18
18
|
this.contextKey = '';
|
|
19
|
+
this.useFahrenheit = 0;
|
|
19
20
|
this.devicesId = [];
|
|
20
21
|
|
|
21
22
|
this.options = {
|
|
@@ -62,6 +63,7 @@ class MelCloud extends EventEmitter {
|
|
|
62
63
|
const account = accountData.data;
|
|
63
64
|
const accountInfo = account.LoginData;
|
|
64
65
|
const contextKey = accountInfo.ContextKey;
|
|
66
|
+
this.useFahrenheit = accountInfo.UseFahrenheit
|
|
65
67
|
this.contextKey = contextKey;
|
|
66
68
|
|
|
67
69
|
//remove sensitive data
|
|
@@ -144,6 +146,7 @@ class MelCloud extends EventEmitter {
|
|
|
144
146
|
];
|
|
145
147
|
|
|
146
148
|
//add all devices to the devices array
|
|
149
|
+
devices.useFahrenheit = this.useFahrenheit;
|
|
147
150
|
devices.push(...allDevices);
|
|
148
151
|
}
|
|
149
152
|
|
|
@@ -152,11 +155,10 @@ class MelCloud extends EventEmitter {
|
|
|
152
155
|
this.emit('warn', `No devices found.`);
|
|
153
156
|
return;
|
|
154
157
|
}
|
|
155
|
-
const debug3 = this.enableDebugMode ? this.emit('debug', `Found: ${devicesCount} devices.`) : false;
|
|
156
158
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
//save buildings to the file
|
|
160
|
+
await this.saveData(this.devicesFile, devices);
|
|
161
|
+
const debug3 = this.enableDebugMode ? this.emit('debug', `${devicesCount} devices saved.`) : false;
|
|
160
162
|
|
|
161
163
|
return devices;
|
|
162
164
|
} catch (error) {
|
package/src/melcloudata.js
CHANGED
|
@@ -11,7 +11,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
11
11
|
constructor(config) {
|
|
12
12
|
super();
|
|
13
13
|
const contextKey = config.contextKey;
|
|
14
|
-
const
|
|
14
|
+
const accountFile = config.accountFile;
|
|
15
15
|
const devicesFile = config.devicesFile;
|
|
16
16
|
const deviceId = config.deviceId;
|
|
17
17
|
const debugLog = config.debugLog;
|
|
@@ -40,7 +40,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
40
40
|
impulseGenerator.on('checkDevice', async () => {
|
|
41
41
|
try {
|
|
42
42
|
//read account info from file
|
|
43
|
-
const accountInfo = await this.readData(
|
|
43
|
+
const accountInfo = await this.readData(accountFile);
|
|
44
44
|
|
|
45
45
|
//remove sensitive data
|
|
46
46
|
const debugData = {
|
package/src/melcloudatw.js
CHANGED
|
@@ -11,7 +11,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
11
11
|
constructor(config) {
|
|
12
12
|
super();
|
|
13
13
|
const contextKey = config.contextKey;
|
|
14
|
-
const
|
|
14
|
+
const accountFile = config.accountFile;
|
|
15
15
|
const devicesFile = config.devicesFile;
|
|
16
16
|
const deviceId = config.deviceId;
|
|
17
17
|
const debugLog = config.debugLog;
|
|
@@ -40,7 +40,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
40
40
|
impulseGenerator.on('checkDevice', async () => {
|
|
41
41
|
try {
|
|
42
42
|
//read account info from file
|
|
43
|
-
const accountInfo = await this.readData(
|
|
43
|
+
const accountInfo = await this.readData(accountFile);
|
|
44
44
|
|
|
45
45
|
//remove sensitive data
|
|
46
46
|
const debugData = {
|
package/src/melclouderv.js
CHANGED
|
@@ -11,7 +11,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
11
11
|
constructor(config) {
|
|
12
12
|
super();
|
|
13
13
|
const contextKey = config.contextKey;
|
|
14
|
-
const
|
|
14
|
+
const accountFile = config.accountFile;
|
|
15
15
|
const devicesFile = config.devicesFile;
|
|
16
16
|
const deviceId = config.deviceId;
|
|
17
17
|
const debugLog = config.debugLog;
|
|
@@ -40,7 +40,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
40
40
|
impulseGenerator.on('checkDevice', async () => {
|
|
41
41
|
try {
|
|
42
42
|
//read account info from file
|
|
43
|
-
const accountInfo = await this.readData(
|
|
43
|
+
const accountInfo = await this.readData(accountFile);
|
|
44
44
|
|
|
45
45
|
//remove sensitive data
|
|
46
46
|
const debugData = {
|