homebridge-melcloud-control 4.3.5-beta.23 → 4.3.5-beta.25
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 +2 -3
- package/package.json +1 -1
- package/src/deviceata.js +3 -3
- package/src/deviceatw.js +1 -1
- package/src/melcloudata.js +6 -5
package/index.js
CHANGED
|
@@ -132,7 +132,6 @@ class MelCloudPlatform {
|
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
if (logLevel.debug) log.info(devicesList.Info);
|
|
135
|
-
const melcloudDevices = devicesList.Devices;
|
|
136
135
|
|
|
137
136
|
//start account impulse generator
|
|
138
137
|
await melcloud.impulseGenerator.state(true, timmers, false);
|
|
@@ -147,7 +146,7 @@ class MelCloudPlatform {
|
|
|
147
146
|
for (const [index, device] of devices.entries()) {
|
|
148
147
|
//chack device from config exist on melcloud
|
|
149
148
|
const displayType = device.displayType > 0;
|
|
150
|
-
const deviceExistInMelCloud =
|
|
149
|
+
const deviceExistInMelCloud = devicesList.Devices.some(dev => dev.DeviceID === device.id);
|
|
151
150
|
if (!deviceExistInMelCloud || !displayType) continue;
|
|
152
151
|
|
|
153
152
|
device.id = String(device.id);
|
|
@@ -181,7 +180,7 @@ class MelCloudPlatform {
|
|
|
181
180
|
let configuredDevice;
|
|
182
181
|
switch (deviceType) {
|
|
183
182
|
case 0: //ATA
|
|
184
|
-
configuredDevice = new DeviceAta(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud,
|
|
183
|
+
configuredDevice = new DeviceAta(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, devicesList);
|
|
185
184
|
break;
|
|
186
185
|
case 1: //ATW
|
|
187
186
|
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.25",
|
|
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, melcloudDevicesList) {
|
|
11
11
|
super();
|
|
12
12
|
|
|
13
13
|
Accessory = api.platformAccessory;
|
|
@@ -18,7 +18,7 @@ class DeviceAta extends EventEmitter {
|
|
|
18
18
|
|
|
19
19
|
//account config
|
|
20
20
|
this.melcloud = melcloud;
|
|
21
|
-
this.
|
|
21
|
+
this.melcloudDevicesList = melcloudDevicesList;
|
|
22
22
|
this.account = account;
|
|
23
23
|
this.accountType = account.type;
|
|
24
24
|
this.accountName = account.name;
|
|
@@ -1321,7 +1321,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1321
1321
|
async start() {
|
|
1322
1322
|
try {
|
|
1323
1323
|
//melcloud device
|
|
1324
|
-
this.melCloudAta = new MelCloudAta(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud, this.
|
|
1324
|
+
this.melCloudAta = new MelCloudAta(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud, this.melcloudDevicesList)
|
|
1325
1325
|
.on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
1326
1326
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1327
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, melcloudDevicesList) {
|
|
8
8
|
super();
|
|
9
9
|
this.accountType = account.type;
|
|
10
10
|
this.logSuccess = account.log?.success;
|
|
@@ -23,12 +23,12 @@ class MelCloudAta extends EventEmitter {
|
|
|
23
23
|
|
|
24
24
|
//set default values
|
|
25
25
|
this.deviceData = {};
|
|
26
|
-
this.headers =
|
|
26
|
+
this.headers = {}
|
|
27
27
|
|
|
28
28
|
let deviceData = null;
|
|
29
29
|
melcloud.on('devicesList', async (devicesData) => {
|
|
30
30
|
this.headers = devicesData.Headers;
|
|
31
|
-
deviceData = devicesData.Devices.find(device => device.DeviceID ===
|
|
31
|
+
deviceData = devicesData.Devices.find(device => device.DeviceID === device.id);
|
|
32
32
|
if (!deviceData) return;
|
|
33
33
|
deviceData.Scenes = devicesData.Scenes ?? [];
|
|
34
34
|
|
|
@@ -95,8 +95,9 @@ class MelCloudAta extends EventEmitter {
|
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
//only update state once at the beginning
|
|
98
|
-
const deviceInMelcloud =
|
|
99
|
-
deviceInMelcloud.Scenes =
|
|
98
|
+
const deviceInMelcloud = melcloudDevicesList.Devices.find(device => device.DeviceID === this.deviceId)
|
|
99
|
+
deviceInMelcloud.Scenes = melcloudDevicesList.Scenes ?? [];
|
|
100
|
+
this.headers = melcloudDevicesList.Headers;
|
|
100
101
|
this.updateState(deviceInMelcloud);
|
|
101
102
|
}
|
|
102
103
|
|