homebridge-melcloud-control 4.3.5-beta.22 → 4.3.5-beta.24
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 +3 -2
- package/package.json +1 -1
- package/src/deviceata.js +3 -2
- package/src/deviceatw.js +1 -1
- package/src/melcloudata.js +8 -3
package/index.js
CHANGED
|
@@ -132,6 +132,7 @@ class MelCloudPlatform {
|
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
if (logLevel.debug) log.info(devicesList.Info);
|
|
135
|
+
const melcloudDevices = devicesList.Devices;
|
|
135
136
|
|
|
136
137
|
//start account impulse generator
|
|
137
138
|
await melcloud.impulseGenerator.state(true, timmers, false);
|
|
@@ -146,7 +147,7 @@ class MelCloudPlatform {
|
|
|
146
147
|
for (const [index, device] of devices.entries()) {
|
|
147
148
|
//chack device from config exist on melcloud
|
|
148
149
|
const displayType = device.displayType > 0;
|
|
149
|
-
const deviceExistInMelCloud =
|
|
150
|
+
const deviceExistInMelCloud = melcloudDevices.some(dev => dev.DeviceID === device.id);
|
|
150
151
|
if (!deviceExistInMelCloud || !displayType) continue;
|
|
151
152
|
|
|
152
153
|
device.id = String(device.id);
|
|
@@ -180,7 +181,7 @@ class MelCloudPlatform {
|
|
|
180
181
|
let configuredDevice;
|
|
181
182
|
switch (deviceType) {
|
|
182
183
|
case 0: //ATA
|
|
183
|
-
configuredDevice = new DeviceAta(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud);
|
|
184
|
+
configuredDevice = new DeviceAta(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, melcloudDevices);
|
|
184
185
|
break;
|
|
185
186
|
case 1: //ATW
|
|
186
187
|
configuredDevice = new DeviceAtw(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud);
|
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.5-beta.
|
|
4
|
+
"version": "4.3.5-beta.24",
|
|
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 @@ import { TemperatureDisplayUnits, AirConditioner } from './constants.js';
|
|
|
7
7
|
let Accessory, Characteristic, Service, Categories, AccessoryUUID;
|
|
8
8
|
|
|
9
9
|
class DeviceAta extends EventEmitter {
|
|
10
|
-
constructor(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud) {
|
|
10
|
+
constructor(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, melcloudDevices) {
|
|
11
11
|
super();
|
|
12
12
|
|
|
13
13
|
Accessory = api.platformAccessory;
|
|
@@ -18,6 +18,7 @@ class DeviceAta extends EventEmitter {
|
|
|
18
18
|
|
|
19
19
|
//account config
|
|
20
20
|
this.melcloud = melcloud;
|
|
21
|
+
this.melcloudDevices = melcloudDevices;
|
|
21
22
|
this.account = account;
|
|
22
23
|
this.accountType = account.type;
|
|
23
24
|
this.accountName = account.name;
|
|
@@ -1320,7 +1321,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1320
1321
|
async start() {
|
|
1321
1322
|
try {
|
|
1322
1323
|
//melcloud device
|
|
1323
|
-
this.melCloudAta = new MelCloudAta(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud)
|
|
1324
|
+
this.melCloudAta = new MelCloudAta(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud, this.melcloudDevices)
|
|
1324
1325
|
.on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
1325
1326
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1326
1327
|
this.emit('devInfo', `---- ${this.deviceTypeString}: ${this.deviceName} ----`);
|
package/src/deviceatw.js
CHANGED
|
@@ -1566,7 +1566,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1566
1566
|
async start() {
|
|
1567
1567
|
try {
|
|
1568
1568
|
//melcloud device
|
|
1569
|
-
this.melCloudAtw = new MelCloudAtw(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud)
|
|
1569
|
+
this.melCloudAtw = new MelCloudAtw(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud, this.melcloudDevices)
|
|
1570
1570
|
.on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, supportsHotWaterTank, supportsZone2) => {
|
|
1571
1571
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1572
1572
|
this.emit('devInfo', `---- ${this.deviceTypeString}: ${this.deviceName} ----`);
|
package/src/melcloudata.js
CHANGED
|
@@ -4,7 +4,7 @@ import Functions from './functions.js';
|
|
|
4
4
|
import { ApiUrls, ApiUrlsHome, AirConditioner } from './constants.js';
|
|
5
5
|
|
|
6
6
|
class MelCloudAta extends EventEmitter {
|
|
7
|
-
constructor(account, device, defaultTempsFile, accountFile, melcloud,
|
|
7
|
+
constructor(account, device, defaultTempsFile, accountFile, melcloud, melcloudDevices) {
|
|
8
8
|
super();
|
|
9
9
|
this.accountType = account.type;
|
|
10
10
|
this.logSuccess = account.log?.success;
|
|
@@ -23,7 +23,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
23
23
|
|
|
24
24
|
//set default values
|
|
25
25
|
this.deviceData = {};
|
|
26
|
-
this.headers =
|
|
26
|
+
this.headers = melcloudDevices.Headers;
|
|
27
27
|
|
|
28
28
|
let deviceData = null;
|
|
29
29
|
melcloud.on('devicesList', async (devicesData) => {
|
|
@@ -32,7 +32,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
32
32
|
if (!deviceData) return;
|
|
33
33
|
deviceData.Scenes = devicesData.Scenes ?? [];
|
|
34
34
|
|
|
35
|
-
if (!this.logDebug) this.emit('debug', `MELCloud: ${JSON.stringify(
|
|
35
|
+
if (!this.logDebug) this.emit('debug', `MELCloud: ${JSON.stringify(melcloudDevices, null, 2)}`);
|
|
36
36
|
|
|
37
37
|
//update state
|
|
38
38
|
await this.updateState(deviceData);
|
|
@@ -93,6 +93,11 @@ class MelCloudAta extends EventEmitter {
|
|
|
93
93
|
if (this.logError) this.emit('error', `Web socket process message error: ${error}`);
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
|
+
|
|
97
|
+
//only update state once at the beginning
|
|
98
|
+
const deviceInMelcloud = melcloudDevices.find(device => device.DeviceID === this.deviceId)
|
|
99
|
+
deviceInMelcloud.Scenes = melcloudDevices.Scenes ?? [];
|
|
100
|
+
this.updateState(deviceInMelcloud);
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
async updateState(deviceData) {
|