homebridge-melcloud-control 4.0.0-beta.500 → 4.0.0-beta.501
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 +1 -3
- package/package.json +1 -1
- package/src/deviceatw.js +3 -3
- package/src/deviceerv.js +3 -3
- package/src/melcloud.js +3 -3
- package/src/melcloudata.js +0 -1
- package/src/melcloudatw.js +16 -49
- package/src/melclouderv.js +16 -49
package/index.js
CHANGED
|
@@ -109,8 +109,6 @@ class MelCloudPlatform {
|
|
|
109
109
|
if (logLevel.warn) log.warn(`${accountName}, ${accountInfo.Info}`);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
const contextKey = accountInfo.ContextKey;
|
|
114
112
|
const useFahrenheit = accountInfo.UseFahrenheit;
|
|
115
113
|
|
|
116
114
|
//check devices list
|
|
@@ -183,7 +181,7 @@ class MelCloudPlatform {
|
|
|
183
181
|
|
|
184
182
|
configuredDevice.on('melCloud', async (key, value) => {
|
|
185
183
|
try {
|
|
186
|
-
accountInfo[key] = value;
|
|
184
|
+
accountInfo.LoginData[key] = value;
|
|
187
185
|
await melCloud.send(accountInfo);
|
|
188
186
|
} catch (error) {
|
|
189
187
|
if (logLevel.error) log.error(`${accountName}, ${deviceTypeText}, ${deviceName}, ${error.message ?? error}.`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.501",
|
|
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/deviceatw.js
CHANGED
|
@@ -1315,10 +1315,10 @@ class DeviceAtw extends EventEmitter {
|
|
|
1315
1315
|
//accessory info
|
|
1316
1316
|
this.manufacturer = manufacturer;
|
|
1317
1317
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
1318
|
-
this.serialNumber = serialNumber;
|
|
1319
|
-
this.firmwareRevision = firmwareAppVersion;
|
|
1318
|
+
this.serialNumber = serialNumber.toString();
|
|
1319
|
+
this.firmwareRevision = firmwareAppVersion.toString();
|
|
1320
1320
|
|
|
1321
|
-
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, firmwareAppVersion);
|
|
1321
|
+
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, this.firmwareAppVersion);
|
|
1322
1322
|
})
|
|
1323
1323
|
.on('deviceState', async (deviceData) => {
|
|
1324
1324
|
this.deviceData = deviceData;
|
package/src/deviceerv.js
CHANGED
|
@@ -864,10 +864,10 @@ class DeviceErv extends EventEmitter {
|
|
|
864
864
|
//accessory info
|
|
865
865
|
this.manufacturer = manufacturer;
|
|
866
866
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
867
|
-
this.serialNumber = serialNumber;
|
|
868
|
-
this.firmwareRevision = firmwareAppVersion;
|
|
867
|
+
this.serialNumber = serialNumber.toString();
|
|
868
|
+
this.firmwareRevision = firmwareAppVersion.toString();
|
|
869
869
|
|
|
870
|
-
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, firmwareAppVersion);
|
|
870
|
+
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, this.firmwareAppVersion);
|
|
871
871
|
})
|
|
872
872
|
.on('deviceState', async (deviceData) => {
|
|
873
873
|
this.deviceData = deviceData;
|
package/src/melcloud.js
CHANGED
|
@@ -140,7 +140,7 @@ class MelCloud extends EventEmitter {
|
|
|
140
140
|
if (this.logDebug) this.emit('debug', `Connecting to MELCloud`);
|
|
141
141
|
|
|
142
142
|
try {
|
|
143
|
-
const accountInfo = { State: false, Info: '', ContextKey: null, UseFahrenheit: false }
|
|
143
|
+
const accountInfo = { State: false, Info: '', LoginData: null, ContextKey: null, UseFahrenheit: false }
|
|
144
144
|
const axiosInstance = axios.create({
|
|
145
145
|
method: 'POST',
|
|
146
146
|
baseURL: ApiUrls.BaseURL,
|
|
@@ -486,12 +486,12 @@ class MelCloud extends EventEmitter {
|
|
|
486
486
|
baseURL: ApiUrls.BaseURL,
|
|
487
487
|
timeout: 15000,
|
|
488
488
|
headers: {
|
|
489
|
-
'X-MitsContextKey':
|
|
489
|
+
'X-MitsContextKey': accountInfo.ContextKey,
|
|
490
490
|
'content-type': 'application/json'
|
|
491
491
|
}
|
|
492
492
|
});
|
|
493
493
|
|
|
494
|
-
const options = { data: accountInfo };
|
|
494
|
+
const options = { data: accountInfo.LoginData };
|
|
495
495
|
await axiosInstance.post(ApiUrls.UpdateApplicationOptions, options);
|
|
496
496
|
await this.functions.saveData(this.accountFile, accountInfo);
|
|
497
497
|
return true;
|
package/src/melcloudata.js
CHANGED
package/src/melcloudatw.js
CHANGED
|
@@ -61,7 +61,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
61
61
|
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
|
|
62
62
|
|
|
63
63
|
//device info
|
|
64
|
-
const serialNumber = deviceData.SerialNumber
|
|
64
|
+
const serialNumber = deviceData.SerialNumber;
|
|
65
65
|
|
|
66
66
|
//device
|
|
67
67
|
const device = deviceData.Device ?? {};
|
|
@@ -91,7 +91,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
91
91
|
const setCoolFlowTemperatureZone2 = device.SetCoolFlowTemperatureZone2;
|
|
92
92
|
const idleZone1 = device.IdleZone1 ?? false;
|
|
93
93
|
const idleZone2 = device.IdleZone2 ?? false;
|
|
94
|
-
const firmwareAppVersion = device.FirmwareAppVersion
|
|
94
|
+
const firmwareAppVersion = device.FirmwareAppVersion;
|
|
95
95
|
const hasZone2 = device.HasZone2 ?? false;
|
|
96
96
|
|
|
97
97
|
//units
|
|
@@ -99,55 +99,22 @@ class MelCloudAtw extends EventEmitter {
|
|
|
99
99
|
const unitsCount = units.length;
|
|
100
100
|
const manufacturer = 'Mitsubishi';
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
let modelNumberOutdoor = 0;
|
|
115
|
-
let modelOutdoor = false;
|
|
116
|
-
let typeOutdoor = 0;
|
|
117
|
-
|
|
118
|
-
//units array
|
|
119
|
-
for (const unit of units) {
|
|
120
|
-
const unitId = unit.ID;
|
|
121
|
-
const unitDevice = unit.Device;
|
|
122
|
-
const unitSerialNumber = unit.SerialNumber ?? 'Undefined';
|
|
123
|
-
const unitModelNumber = unit.ModelNumber;
|
|
124
|
-
const unitModel = unit.Model ?? false;
|
|
125
|
-
const unitType = unit.UnitType;
|
|
126
|
-
const unitIsIndoor = unit.IsIndoor ?? false;
|
|
127
|
-
|
|
128
|
-
switch (unitIsIndoor) {
|
|
129
|
-
case true:
|
|
130
|
-
idIndoor = unitId;
|
|
131
|
-
deviceIndoor = unitDevice;
|
|
132
|
-
serialNumberIndoor = unitSerialNumber;
|
|
133
|
-
modelNumberIndoor = unitModelNumber;
|
|
134
|
-
modelIndoor = unitModel;
|
|
135
|
-
typeIndoor = unitType;
|
|
136
|
-
break;
|
|
137
|
-
case false:
|
|
138
|
-
idOutdoor = unitId;
|
|
139
|
-
deviceOutdoor = unitDevice;
|
|
140
|
-
serialNumberOutdoor = unitSerialNumber;
|
|
141
|
-
modelNumberOutdoor = unitModelNumber;
|
|
142
|
-
modelOutdoor = unitModel;
|
|
143
|
-
typeOutdoor = unitType;
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
102
|
+
const { indoor, outdoor } = units.reduce((acc, unit) => {
|
|
103
|
+
const target = unit.IsIndoor ? 'indoor' : 'outdoor';
|
|
104
|
+
acc[target] = {
|
|
105
|
+
id: unit.ID,
|
|
106
|
+
device: unit.Device,
|
|
107
|
+
serialNumber: unit.SerialNumber ?? 'Undefined',
|
|
108
|
+
modelNumber: unit.ModelNumber ?? 0,
|
|
109
|
+
model: unit.Model ?? false,
|
|
110
|
+
type: unit.UnitType ?? 0
|
|
111
|
+
};
|
|
112
|
+
return acc;
|
|
113
|
+
}, { indoor: {}, outdoor: {} });
|
|
147
114
|
|
|
148
115
|
//display info if units are not configured in MELCloud service
|
|
149
116
|
if (unitsCount === 0) {
|
|
150
|
-
this.emit('
|
|
117
|
+
if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
|
|
151
118
|
};
|
|
152
119
|
|
|
153
120
|
const deviceState = {
|
|
@@ -195,7 +162,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
195
162
|
this.deviceState = deviceState;
|
|
196
163
|
|
|
197
164
|
//emit info
|
|
198
|
-
this.emit('deviceInfo', manufacturer,
|
|
165
|
+
this.emit('deviceInfo', manufacturer, indoor.model, outdoor.model, serialNumber, firmwareAppVersion, hasHotWaterTank, hasZone2);
|
|
199
166
|
|
|
200
167
|
//emit state
|
|
201
168
|
this.emit('deviceState', deviceData);
|
package/src/melclouderv.js
CHANGED
|
@@ -64,7 +64,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
64
64
|
const hideRoomTemperature = deviceData.HideRoomTemperature ?? false;
|
|
65
65
|
const hideSupplyTemperature = deviceData.HideSupplyTemperature ?? false;
|
|
66
66
|
const hideOutdoorTemperature = deviceData.HideOutdoorTemperature ?? false;
|
|
67
|
-
const serialNumber = deviceData.SerialNumber
|
|
67
|
+
const serialNumber = deviceData.SerialNumber;
|
|
68
68
|
|
|
69
69
|
//device
|
|
70
70
|
const device = deviceData.Device ?? {};
|
|
@@ -87,62 +87,29 @@ class MelCloudErv extends EventEmitter {
|
|
|
87
87
|
const ventilationMode = device.VentilationMode; //Lossnay, Bypass, Auto
|
|
88
88
|
const defaultCoolingSetTemperature = device.DefaultCoolingSetTemperature ?? 23;
|
|
89
89
|
const defaultHeatingSetTemperature = device.DefaultHeatingSetTemperature ?? 21;
|
|
90
|
-
const firmwareAppVersion = device.FirmwareAppVersion
|
|
90
|
+
const firmwareAppVersion = device.FirmwareAppVersion;
|
|
91
91
|
|
|
92
92
|
//units
|
|
93
93
|
const units = Array.isArray(device.Units) ? device.Units : [];
|
|
94
94
|
const unitsCount = units.length;
|
|
95
95
|
const manufacturer = 'Mitsubishi';
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
let modelNumberOutdoor = 0;
|
|
110
|
-
let modelOutdoor = false;
|
|
111
|
-
let typeOutdoor = 0;
|
|
112
|
-
|
|
113
|
-
//units array
|
|
114
|
-
for (const unit of units) {
|
|
115
|
-
const unitId = unit.ID;
|
|
116
|
-
const unitDevice = unit.Device;
|
|
117
|
-
const unitSerialNumber = unit.SerialNumber ?? 'Undefined';
|
|
118
|
-
const unitModelNumber = unit.ModelNumber;
|
|
119
|
-
const unitModel = unit.Model ?? false;
|
|
120
|
-
const unitType = unit.UnitType;
|
|
121
|
-
const unitIsIndoor = unit.IsIndoor ?? false;
|
|
122
|
-
|
|
123
|
-
switch (unitIsIndoor) {
|
|
124
|
-
case true:
|
|
125
|
-
idIndoor = unitId;
|
|
126
|
-
deviceIndoor = unitDevice;
|
|
127
|
-
serialNumberIndoor = unitSerialNumber;
|
|
128
|
-
modelNumberIndoor = unitModelNumber;
|
|
129
|
-
modelIndoor = unitModel;
|
|
130
|
-
typeIndoor = unitType;
|
|
131
|
-
break;
|
|
132
|
-
case false:
|
|
133
|
-
idOutdoor = unitId;
|
|
134
|
-
deviceOutdoor = unitDevice;
|
|
135
|
-
serialNumberOutdoor = unitSerialNumber;
|
|
136
|
-
modelNumberOutdoor = unitModelNumber;
|
|
137
|
-
modelOutdoor = unitModel;
|
|
138
|
-
typeOutdoor = unitType;
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
97
|
+
const { indoor, outdoor } = units.reduce((acc, unit) => {
|
|
98
|
+
const target = unit.IsIndoor ? 'indoor' : 'outdoor';
|
|
99
|
+
acc[target] = {
|
|
100
|
+
id: unit.ID,
|
|
101
|
+
device: unit.Device,
|
|
102
|
+
serialNumber: unit.SerialNumber ?? 'Undefined',
|
|
103
|
+
modelNumber: unit.ModelNumber ?? 0,
|
|
104
|
+
model: unit.Model ?? false,
|
|
105
|
+
type: unit.UnitType ?? 0
|
|
106
|
+
};
|
|
107
|
+
return acc;
|
|
108
|
+
}, { indoor: {}, outdoor: {} });
|
|
142
109
|
|
|
143
110
|
//display info if units are not configured in MELCloud service
|
|
144
111
|
if (unitsCount === 0) {
|
|
145
|
-
this.emit('
|
|
112
|
+
if (this.logDebug) this.emit('debug', `Units are not configured in MELCloud service`);
|
|
146
113
|
};
|
|
147
114
|
|
|
148
115
|
const deviceState = {
|
|
@@ -187,7 +154,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
187
154
|
this.deviceState = deviceState;
|
|
188
155
|
|
|
189
156
|
//emit info
|
|
190
|
-
this.emit('deviceInfo', manufacturer,
|
|
157
|
+
this.emit('deviceInfo', manufacturer, indoor.model, outdoor.model, serialNumber, firmwareAppVersion);
|
|
191
158
|
|
|
192
159
|
//emit state
|
|
193
160
|
this.emit('deviceState', deviceData);
|