homebridge-melcloud-control 4.2.3-beta.16 → 4.2.3-beta.18
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/package.json +1 -1
- package/src/constants.js +27 -26
- package/src/deviceata.js +3 -3
- package/src/deviceatw.js +3 -3
- package/src/deviceerv.js +3 -3
- package/src/melcloudata.js +3 -6
- package/src/melcloudatw.js +6 -7
- package/src/melclouderv.js +5 -8
- package/src/melcloudhome.js +4 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.2.3-beta.
|
|
4
|
+
"version": "4.2.3-beta.18",
|
|
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/constants.js
CHANGED
|
@@ -19,6 +19,7 @@ export const ApiUrls = {
|
|
|
19
19
|
|
|
20
20
|
export const ApiUrlsHome = {
|
|
21
21
|
BaseURL: "https://melcloudhome.com",
|
|
22
|
+
Dashboard: "https://melcloudhome.com/dashboard",
|
|
22
23
|
GetUserContext: "/api/user/context",
|
|
23
24
|
SetAta: "/api/ataunit/deviceid",
|
|
24
25
|
SetAtw: "/api/atwunit/deviceid",
|
|
@@ -165,30 +166,30 @@ export const AccessLevel = {
|
|
|
165
166
|
};
|
|
166
167
|
|
|
167
168
|
export const LanguageLocaleMap = {
|
|
168
|
-
"0": "en-US,en",
|
|
169
|
-
"1": "bg-BG,bg",
|
|
170
|
-
"2": "cs-CZ,
|
|
171
|
-
"3": "da-DK,da",
|
|
172
|
-
"4": "de-DE,de",
|
|
173
|
-
"5": "et-EE,et",
|
|
174
|
-
"6": "es-ES,es",
|
|
175
|
-
"7": "fr-FR,fr",
|
|
176
|
-
"8": "hy-AM,hy",
|
|
177
|
-
"9": "lv-LV,lv",
|
|
178
|
-
"10": "lt-LT,lt",
|
|
179
|
-
"11": "hu-HU,hu",
|
|
180
|
-
"12": "nl-NL,nl",
|
|
181
|
-
"13": "no-NO,no",
|
|
182
|
-
"14": "pl-PL,pl",
|
|
183
|
-
"15": "pt-PT,pt",
|
|
184
|
-
"16": "ru-RU,ru",
|
|
185
|
-
"17": "fi-FI,fi",
|
|
186
|
-
"18": "sv-SE,sv",
|
|
187
|
-
"19": "it-IT,it",
|
|
188
|
-
"20": "uk-UA,uk",
|
|
189
|
-
"21": "tr-TR,tr",
|
|
190
|
-
"22": "el-GR,el",
|
|
191
|
-
"23": "hr-HR,hr",
|
|
192
|
-
"24": "ro-RO,ro",
|
|
193
|
-
"25": "sl-SI,sl"
|
|
169
|
+
"0": "en-US,en;q=0.9",
|
|
170
|
+
"1": "bg-BG,bg;q=0.9",
|
|
171
|
+
"2": "cs-CZ,cs;q=0.9",
|
|
172
|
+
"3": "da-DK,da;q=0.9",
|
|
173
|
+
"4": "de-DE,de;q=0.9",
|
|
174
|
+
"5": "et-EE,et;q=0.9",
|
|
175
|
+
"6": "es-ES,es;q=0.9",
|
|
176
|
+
"7": "fr-FR,fr;q=0.9",
|
|
177
|
+
"8": "hy-AM,hy;q=0.9",
|
|
178
|
+
"9": "lv-LV,lv;q=0.9",
|
|
179
|
+
"10": "lt-LT,lt;q=0.9",
|
|
180
|
+
"11": "hu-HU,hu;q=0.9",
|
|
181
|
+
"12": "nl-NL,nl;q=0.9",
|
|
182
|
+
"13": "no-NO,no;q=0.9",
|
|
183
|
+
"14": "pl-PL,pl;q=0.9",
|
|
184
|
+
"15": "pt-PT,pt;q=0.9",
|
|
185
|
+
"16": "ru-RU,ru;q=0.9",
|
|
186
|
+
"17": "fi-FI,fi;q=0.9",
|
|
187
|
+
"18": "sv-SE,sv;q=0.9",
|
|
188
|
+
"19": "it-IT,it;q=0.9",
|
|
189
|
+
"20": "uk-UA,uk;q=0.9",
|
|
190
|
+
"21": "tr-TR,tr;q=0.9",
|
|
191
|
+
"22": "el-GR,el;q=0.9",
|
|
192
|
+
"23": "hr-HR,hr;q=0.9",
|
|
193
|
+
"24": "ro-RO,ro;q=0.9",
|
|
194
|
+
"25": "sl-SI,sl;q=0.9"
|
|
194
195
|
};
|
package/src/deviceata.js
CHANGED
|
@@ -1209,7 +1209,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1209
1209
|
try {
|
|
1210
1210
|
//melcloud device
|
|
1211
1211
|
this.melCloudAta = new MelCloudAta(this.account, this.device, this.devicesFile, this.defaultTempsFile)
|
|
1212
|
-
.on('deviceInfo', (
|
|
1212
|
+
.on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
1213
1213
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1214
1214
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
1215
1215
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
@@ -1217,13 +1217,13 @@ class DeviceAta extends EventEmitter {
|
|
|
1217
1217
|
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
1218
1218
|
if (serialNumber) this.emit('devInfo', `Serial: ${serialNumber}`);
|
|
1219
1219
|
if (firmwareAppVersion) this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
1220
|
-
this.emit('devInfo', `Manufacturer:
|
|
1220
|
+
this.emit('devInfo', `Manufacturer: Mitsubishi`);
|
|
1221
1221
|
this.emit('devInfo', '----------------------------------');
|
|
1222
1222
|
this.displayDeviceInfo = false;
|
|
1223
1223
|
}
|
|
1224
1224
|
|
|
1225
1225
|
//accessory info
|
|
1226
|
-
this.manufacturer =
|
|
1226
|
+
this.manufacturer = 'Mitsubishi';
|
|
1227
1227
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText}`;
|
|
1228
1228
|
this.serialNumber = serialNumber.toString();
|
|
1229
1229
|
this.firmwareRevision = firmwareAppVersion.toString();
|
package/src/deviceatw.js
CHANGED
|
@@ -1476,7 +1476,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1476
1476
|
try {
|
|
1477
1477
|
//melcloud device
|
|
1478
1478
|
this.melCloudAtw = new MelCloudAtw(this.account, this.device, this.devicesFile, this.defaultTempsFile)
|
|
1479
|
-
.on('deviceInfo', (
|
|
1479
|
+
.on('deviceInfo', ( modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, supportsHotWaterTank, supportsZone2) => {
|
|
1480
1480
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1481
1481
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
1482
1482
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
@@ -1484,7 +1484,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1484
1484
|
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
1485
1485
|
this.emit('devInfo', `Serial: ${serialNumber}`)
|
|
1486
1486
|
this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
1487
|
-
this.emit('devInfo', `Manufacturer:
|
|
1487
|
+
this.emit('devInfo', `Manufacturer: Mitsubishi`);
|
|
1488
1488
|
this.emit('devInfo', '----------------------------------');
|
|
1489
1489
|
this.emit('devInfo', `Zone 1: Yes`);
|
|
1490
1490
|
this.emit('devInfo', `Hot Water Tank: ${supportsHotWaterTank ? 'Yes' : 'No'}`);
|
|
@@ -1494,7 +1494,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1494
1494
|
}
|
|
1495
1495
|
|
|
1496
1496
|
//accessory info
|
|
1497
|
-
this.manufacturer =
|
|
1497
|
+
this.manufacturer = 'Mitsubishi';
|
|
1498
1498
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
1499
1499
|
this.serialNumber = serialNumber.toString();
|
|
1500
1500
|
this.firmwareRevision = firmwareAppVersion.toString();
|
package/src/deviceerv.js
CHANGED
|
@@ -1021,7 +1021,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1021
1021
|
try {
|
|
1022
1022
|
//melcloud device
|
|
1023
1023
|
this.melCloudErv = new MelCloudErv(this.account, this.device, this.devicesFile, this.defaultTempsFile)
|
|
1024
|
-
.on('deviceInfo', (
|
|
1024
|
+
.on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
1025
1025
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1026
1026
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
1027
1027
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
@@ -1029,13 +1029,13 @@ class DeviceErv extends EventEmitter {
|
|
|
1029
1029
|
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
1030
1030
|
this.emit('devInfo', `Serial: ${serialNumber}`);
|
|
1031
1031
|
this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
1032
|
-
this.emit('devInfo', `Manufacturer:
|
|
1032
|
+
this.emit('devInfo', `Manufacturer: Mitsubishi`);
|
|
1033
1033
|
this.emit('devInfo', '----------------------------------');
|
|
1034
1034
|
this.displayDeviceInfo = false;
|
|
1035
1035
|
}
|
|
1036
1036
|
|
|
1037
1037
|
//accessory info
|
|
1038
|
-
this.manufacturer =
|
|
1038
|
+
this.manufacturer = 'Mitsubishi';
|
|
1039
1039
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
1040
1040
|
this.serialNumber = serialNumber.toString();
|
|
1041
1041
|
this.firmwareRevision = firmwareAppVersion.toString();
|
package/src/melcloudata.js
CHANGED
|
@@ -55,8 +55,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
55
55
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
56
56
|
|
|
57
57
|
if (this.accountType === 'melcloudhome') {
|
|
58
|
-
deviceData.SerialNumber = deviceData.DeviceID || '4.0.0';
|
|
59
|
-
deviceData.Device.FirmwareAppVersion = deviceData.ConnectedInterfaceIdentifier || '4.0.0';
|
|
60
58
|
deviceData.Device.OperationMode = AirConditioner.OperationModeMapStringToEnum[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
|
|
61
59
|
deviceData.Device.ActualFanSpeed = AirConditioner.FanSpeedMapStringToEnum[deviceData.Device.ActualFanSpeed] ?? deviceData.Device.ActualFanSpeed;
|
|
62
60
|
deviceData.Device.SetFanSpeed = AirConditioner.FanSpeedMapStringToEnum[deviceData.Device.SetFanSpeed] ?? deviceData.Device.SetFanSpeed;
|
|
@@ -76,13 +74,12 @@ class MelCloudAta extends EventEmitter {
|
|
|
76
74
|
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(safeConfig, null, 2)}`);
|
|
77
75
|
|
|
78
76
|
//device
|
|
79
|
-
const serialNumber = deviceData.SerialNumber;
|
|
80
|
-
const firmwareAppVersion = deviceData.Device?.FirmwareAppVersion;
|
|
77
|
+
const serialNumber = deviceData.SerialNumber || '4.0.0';
|
|
78
|
+
const firmwareAppVersion = deviceData.Device?.FirmwareAppVersion || '4.0.0';
|
|
81
79
|
|
|
82
80
|
//units
|
|
83
81
|
const units = Array.isArray(deviceData.Device?.Units) ? deviceData.Device?.Units : [];
|
|
84
82
|
const unitsCount = units.length;
|
|
85
|
-
const manufacturer = 'Mitsubishi';
|
|
86
83
|
|
|
87
84
|
const { indoor, outdoor } = units.reduce((acc, unit) => {
|
|
88
85
|
const target = unit.IsIndoor ? 'indoor' : 'outdoor';
|
|
@@ -118,7 +115,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
118
115
|
this.deviceData = deviceData;
|
|
119
116
|
|
|
120
117
|
//emit info
|
|
121
|
-
this.emit('deviceInfo',
|
|
118
|
+
this.emit('deviceInfo', indoor.model, outdoor.model, serialNumber, firmwareAppVersion);
|
|
122
119
|
|
|
123
120
|
//emit state
|
|
124
121
|
this.emit('deviceState', deviceData);
|
package/src/melcloudatw.js
CHANGED
|
@@ -55,9 +55,8 @@ class MelCloudAtw extends EventEmitter {
|
|
|
55
55
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
56
56
|
|
|
57
57
|
if (this.accountType === 'melcloudhome') {
|
|
58
|
-
deviceData.SerialNumber = deviceData.DeviceID || '4.0.0';
|
|
59
|
-
deviceData.Device.FirmwareAppVersion = deviceData.ConnectedInterfaceIdentifier || '4.0.0';
|
|
60
58
|
}
|
|
59
|
+
|
|
61
60
|
const safeConfig = {
|
|
62
61
|
...deviceData,
|
|
63
62
|
Headers: 'removed',
|
|
@@ -65,15 +64,15 @@ class MelCloudAtw extends EventEmitter {
|
|
|
65
64
|
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(safeConfig, null, 2)}`);
|
|
66
65
|
|
|
67
66
|
//device
|
|
68
|
-
|
|
67
|
+
//device
|
|
68
|
+
const serialNumber = deviceData.SerialNumber || '4.0.0';
|
|
69
|
+
const firmwareAppVersion = deviceData.Device?.FirmwareAppVersion || '4.0.0';
|
|
69
70
|
const hasHotWaterTank = deviceData.Device?.HasHotWaterTank;
|
|
70
|
-
const firmwareAppVersion = deviceData.Device?.FirmwareAppVersion;
|
|
71
71
|
const hasZone2 = deviceData.Device?.HasZone2;
|
|
72
72
|
|
|
73
73
|
//units
|
|
74
74
|
const units = Array.isArray(deviceData.Device?.Units) ? deviceData.Device?.Units : [];
|
|
75
75
|
const unitsCount = units.length;
|
|
76
|
-
const manufacturer = 'Mitsubishi';
|
|
77
76
|
|
|
78
77
|
const { indoor, outdoor } = units.reduce((acc, unit) => {
|
|
79
78
|
const target = unit.IsIndoor ? 'indoor' : 'outdoor';
|
|
@@ -105,11 +104,11 @@ class MelCloudAtw extends EventEmitter {
|
|
|
105
104
|
|
|
106
105
|
//check state changes
|
|
107
106
|
const deviceDataHasNotChanged = JSON.stringify(devicesData) === JSON.stringify(this.devicesData);
|
|
108
|
-
if (deviceDataHasNotChanged)
|
|
107
|
+
if (deviceDataHasNotChanged) return;
|
|
109
108
|
this.devicesData = devicesData;
|
|
110
109
|
|
|
111
110
|
//emit info
|
|
112
|
-
this.emit('deviceInfo',
|
|
111
|
+
this.emit('deviceInfo', indoor.model, outdoor.model, serialNumber, firmwareAppVersion, hasHotWaterTank, hasZone2);
|
|
113
112
|
|
|
114
113
|
//emit state
|
|
115
114
|
this.emit('deviceState', deviceData);
|
package/src/melclouderv.js
CHANGED
|
@@ -55,28 +55,25 @@ class MelCloudErv extends EventEmitter {
|
|
|
55
55
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
56
56
|
|
|
57
57
|
if (this.accountType === 'melcloudhome') {
|
|
58
|
-
deviceData.SerialNumber = deviceData.DeviceID || '4.0.0';
|
|
59
|
-
deviceData.Device.FirmwareAppVersion = deviceData.ConnectedInterfaceIdentifier || '4.0.0';
|
|
60
|
-
|
|
61
58
|
//read default temps
|
|
62
59
|
const temps = await this.functions.readData(this.defaultTempsFile, true);
|
|
63
60
|
deviceData.Device.DefaultHeatingSetTemperature = temps?.defaultHeatingSetTemperature ?? 20;
|
|
64
61
|
deviceData.Device.DefaultCoolingSetTemperature = temps?.defaultCoolingSetTemperature ?? 24;
|
|
65
62
|
}
|
|
63
|
+
|
|
66
64
|
const safeConfig = {
|
|
67
65
|
...deviceData,
|
|
68
66
|
Headers: 'removed',
|
|
69
67
|
};
|
|
70
68
|
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(safeConfig, null, 2)}`);
|
|
71
69
|
|
|
72
|
-
//
|
|
73
|
-
const serialNumber = deviceData.SerialNumber;
|
|
74
|
-
const firmwareAppVersion = deviceData.Device?.FirmwareAppVersion;
|
|
70
|
+
//device
|
|
71
|
+
const serialNumber = deviceData.SerialNumber || '4.0.0';
|
|
72
|
+
const firmwareAppVersion = deviceData.Device?.FirmwareAppVersion || '4.0.0';
|
|
75
73
|
|
|
76
74
|
//units
|
|
77
75
|
const units = Array.isArray(deviceData.Device?.Units) ? deviceData.Device?.Units : [];
|
|
78
76
|
const unitsCount = units.length;
|
|
79
|
-
const manufacturer = 'Mitsubishi';
|
|
80
77
|
|
|
81
78
|
const { indoor, outdoor } = units.reduce((acc, unit) => {
|
|
82
79
|
const target = unit.IsIndoor ? 'indoor' : 'outdoor';
|
|
@@ -112,7 +109,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
112
109
|
this.devicesData = devicesData;
|
|
113
110
|
|
|
114
111
|
//emit info
|
|
115
|
-
this.emit('deviceInfo',
|
|
112
|
+
this.emit('deviceInfo', indoor.model, outdoor.model, serialNumber, firmwareAppVersion);
|
|
116
113
|
|
|
117
114
|
//emit state
|
|
118
115
|
this.emit('deviceState', deviceData);
|
package/src/melcloudhome.js
CHANGED
|
@@ -67,11 +67,10 @@ class MelCloud extends EventEmitter {
|
|
|
67
67
|
const headers = {
|
|
68
68
|
'Accept': '*/*',
|
|
69
69
|
'Accept-Encoding': 'gzip, deflate, br',
|
|
70
|
-
'Accept-Language':
|
|
70
|
+
'Accept-Language': LanguageLocaleMap[this.language],
|
|
71
71
|
'Cookie': this.contextKey,
|
|
72
|
-
'DNT': '1',
|
|
73
72
|
'Priority': 'u=3, i',
|
|
74
|
-
'Referer':
|
|
73
|
+
'Referer': ApiUrlsHome.Dashboard,
|
|
75
74
|
'Sec-Fetch-Dest': 'empty',
|
|
76
75
|
'Sec-Fetch-Mode': 'cors',
|
|
77
76
|
'Sec-Fetch-Site': 'same-origin',
|
|
@@ -142,6 +141,7 @@ class MelCloud extends EventEmitter {
|
|
|
142
141
|
...capitalizeKeys(device.Capabilities || {}),
|
|
143
142
|
...settingsObject,
|
|
144
143
|
DeviceType: type,
|
|
144
|
+
FirmvareAppVersion: device.ConnectedInterfaceIdentifier,
|
|
145
145
|
IsConnected: device.IsConnected
|
|
146
146
|
};
|
|
147
147
|
|
|
@@ -159,6 +159,7 @@ class MelCloud extends EventEmitter {
|
|
|
159
159
|
Type: type,
|
|
160
160
|
DeviceID: Id,
|
|
161
161
|
DeviceName: GivenDisplayName,
|
|
162
|
+
SerialNumber: Id,
|
|
162
163
|
Device: deviceObject,
|
|
163
164
|
Headers: headers
|
|
164
165
|
};
|