homebridge-melcloud-control 4.2.3-beta.2 → 4.2.3-beta.21
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/homebridge-ui/server.js +2 -1
- package/index.js +4 -3
- package/package.json +1 -1
- package/src/constants.js +30 -0
- package/src/deviceata.js +5 -7
- package/src/deviceatw.js +17 -12
- package/src/deviceerv.js +4 -6
- package/src/melcloud.js +32 -364
- package/src/melcloudata.js +7 -20
- package/src/melcloudatw.js +52 -72
- package/src/melclouderv.js +39 -61
- package/src/melcloudhome.js +359 -0
package/homebridge-ui/server.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HomebridgePluginUiServer } from '@homebridge/plugin-ui-utils';
|
|
2
2
|
import MelCloud from '../src/melcloud.js';
|
|
3
|
+
import MelCloudHome from '../src/melcloudhome.js';
|
|
3
4
|
|
|
4
5
|
class PluginUiServer extends HomebridgePluginUiServer {
|
|
5
6
|
constructor() {
|
|
@@ -17,7 +18,7 @@ class PluginUiServer extends HomebridgePluginUiServer {
|
|
|
17
18
|
const accountFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Account`;
|
|
18
19
|
const buildingsFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Buildings`;
|
|
19
20
|
const devicesFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Devices`;
|
|
20
|
-
const melCloud = new MelCloud(account, accountFile, buildingsFile, devicesFile);
|
|
21
|
+
const melCloud = account.type === 'melcloud' ? new MelCloud(account, accountFile, buildingsFile, devicesFile) : new MelCloudHome(account, accountFile, buildingsFile, devicesFile);
|
|
21
22
|
|
|
22
23
|
try {
|
|
23
24
|
const accountInfo = await melCloud.connect();
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { join } from 'path';
|
|
2
2
|
import { mkdirSync, existsSync, writeFileSync } from 'fs';
|
|
3
3
|
import MelCloud from './src/melcloud.js';
|
|
4
|
+
import MelCloudHome from './src/melcloudhome.js';
|
|
4
5
|
import DeviceAta from './src/deviceata.js';
|
|
5
6
|
import DeviceAtw from './src/deviceatw.js';
|
|
6
7
|
import DeviceErv from './src/deviceerv.js';
|
|
@@ -84,8 +85,8 @@ class MelCloudPlatform {
|
|
|
84
85
|
.on('start', async () => {
|
|
85
86
|
try {
|
|
86
87
|
//melcloud account
|
|
87
|
-
const melCloud = new MelCloud(account, accountFile, buildingsFile, devicesFile, true)
|
|
88
|
-
|
|
88
|
+
const melCloud = account.type === 'melcloud' ? new MelCloud(account, accountFile, buildingsFile, devicesFile, true) : new MelCloudHome(account, accountFile, buildingsFile, devicesFile, true);
|
|
89
|
+
melCloud.on('success', (msg) => logLevel.success && log.success(`${accountName}, ${msg}`))
|
|
89
90
|
.on('info', (msg) => logLevel.info && log.info(`${accountName}, ${msg}`))
|
|
90
91
|
.on('debug', (msg) => logLevel.debug && log.info(`${accountName}, debug: ${msg}`))
|
|
91
92
|
.on('warn', (msg) => logLevel.warn && log.warn(`${accountName}, ${msg}`))
|
|
@@ -203,7 +204,7 @@ class MelCloudPlatform {
|
|
|
203
204
|
//start impulse generators\
|
|
204
205
|
const timmers = accountType === 'melcloudhome' ? [{ name: 'connect', sampling: 1800000 }, { name: 'checkDevicesList', sampling: deviceRefreshInterval }] : [{ name: 'checkDevicesList', sampling: refreshInterval }];
|
|
205
206
|
await melCloud.impulseGenerator.state(true, timmers, false);
|
|
206
|
-
await configuredDevice.startStopImpulseGenerator(true, [{ name: 'checkState', sampling: deviceRefreshInterval
|
|
207
|
+
await configuredDevice.startStopImpulseGenerator(true, [{ name: 'checkState', sampling: deviceRefreshInterval }]);
|
|
207
208
|
|
|
208
209
|
//stop impulse generator
|
|
209
210
|
await impulseGenerator.state(false);
|
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.21",
|
|
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",
|
|
@@ -163,3 +164,32 @@ export const AccessLevel = {
|
|
|
163
164
|
Quest: 3,
|
|
164
165
|
Owner: 4
|
|
165
166
|
};
|
|
167
|
+
|
|
168
|
+
export const LanguageLocaleMap = {
|
|
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"
|
|
195
|
+
};
|
package/src/deviceata.js
CHANGED
|
@@ -334,8 +334,6 @@ class DeviceAta extends EventEmitter {
|
|
|
334
334
|
return state;
|
|
335
335
|
})
|
|
336
336
|
.onSet(async (state) => {
|
|
337
|
-
if (!!state === this.accessory.power) return;
|
|
338
|
-
|
|
339
337
|
try {
|
|
340
338
|
deviceData.Device.Power = state ? true : false;
|
|
341
339
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Power);
|
|
@@ -1211,7 +1209,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1211
1209
|
try {
|
|
1212
1210
|
//melcloud device
|
|
1213
1211
|
this.melCloudAta = new MelCloudAta(this.account, this.device, this.devicesFile, this.defaultTempsFile)
|
|
1214
|
-
.on('deviceInfo', (
|
|
1212
|
+
.on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
1215
1213
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1216
1214
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
1217
1215
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
@@ -1219,13 +1217,13 @@ class DeviceAta extends EventEmitter {
|
|
|
1219
1217
|
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
1220
1218
|
if (serialNumber) this.emit('devInfo', `Serial: ${serialNumber}`);
|
|
1221
1219
|
if (firmwareAppVersion) this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
1222
|
-
this.emit('devInfo', `Manufacturer:
|
|
1220
|
+
this.emit('devInfo', `Manufacturer: Mitsubishi`);
|
|
1223
1221
|
this.emit('devInfo', '----------------------------------');
|
|
1224
1222
|
this.displayDeviceInfo = false;
|
|
1225
1223
|
}
|
|
1226
1224
|
|
|
1227
1225
|
//accessory info
|
|
1228
|
-
this.manufacturer =
|
|
1226
|
+
this.manufacturer = 'Mitsubishi';
|
|
1229
1227
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText}`;
|
|
1230
1228
|
this.serialNumber = serialNumber.toString();
|
|
1231
1229
|
this.firmwareRevision = firmwareAppVersion.toString();
|
|
@@ -1331,7 +1329,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1331
1329
|
maxTempHeat: maxTempHeat,
|
|
1332
1330
|
minTempCoolDryAuto: minTempCoolDryAuto,
|
|
1333
1331
|
maxTempCoolDryAuto: maxTempCoolDryAuto,
|
|
1334
|
-
power: power
|
|
1332
|
+
power: power,
|
|
1335
1333
|
inStandbyMode: inStandbyMode,
|
|
1336
1334
|
operationMode: operationMode,
|
|
1337
1335
|
currentOperationMode: 0,
|
|
@@ -1427,7 +1425,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1427
1425
|
|
|
1428
1426
|
//update characteristics
|
|
1429
1427
|
this.melCloudService
|
|
1430
|
-
?.updateCharacteristic(Characteristic.Active, power
|
|
1428
|
+
?.updateCharacteristic(Characteristic.Active, power)
|
|
1431
1429
|
.updateCharacteristic(Characteristic.CurrentHeaterCoolerState, obj.currentOperationMode)
|
|
1432
1430
|
.updateCharacteristic(Characteristic.TargetHeaterCoolerState, obj.targetOperationMode)
|
|
1433
1431
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
package/src/deviceatw.js
CHANGED
|
@@ -340,8 +340,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
340
340
|
return state;
|
|
341
341
|
})
|
|
342
342
|
.onSet(async (state) => {
|
|
343
|
-
if (!!state === this.accessory.power) return;
|
|
344
|
-
|
|
345
343
|
try {
|
|
346
344
|
switch (i) {
|
|
347
345
|
case 0: //Heat Pump
|
|
@@ -1340,8 +1338,15 @@ class DeviceAtw extends EventEmitter {
|
|
|
1340
1338
|
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
1341
1339
|
break;
|
|
1342
1340
|
case 3: //HOLIDAY
|
|
1343
|
-
|
|
1344
|
-
|
|
1341
|
+
if (this.accountType === 'melcloud') {
|
|
1342
|
+
deviceData.Device.HolidayMode = state;
|
|
1343
|
+
effectiveFlags = HeatPump.EffectiveFlags.HolidayMode;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
if (this.accountType === 'melcloudhome') {
|
|
1347
|
+
deviceData.Device.HolidayMode.Enabled = state;
|
|
1348
|
+
effectiveFlags = 'holidaymode';
|
|
1349
|
+
}
|
|
1345
1350
|
break;
|
|
1346
1351
|
case 10: //ALL ZONES PHYSICAL LOCK CONTROL
|
|
1347
1352
|
deviceData.Device.ProhibitZone1 = state;
|
|
@@ -1471,7 +1476,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1471
1476
|
try {
|
|
1472
1477
|
//melcloud device
|
|
1473
1478
|
this.melCloudAtw = new MelCloudAtw(this.account, this.device, this.devicesFile, this.defaultTempsFile)
|
|
1474
|
-
.on('deviceInfo', (
|
|
1479
|
+
.on('deviceInfo', ( modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, supportsHotWaterTank, supportsZone2) => {
|
|
1475
1480
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1476
1481
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
1477
1482
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
@@ -1479,7 +1484,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1479
1484
|
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
1480
1485
|
this.emit('devInfo', `Serial: ${serialNumber}`)
|
|
1481
1486
|
this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
1482
|
-
this.emit('devInfo', `Manufacturer:
|
|
1487
|
+
this.emit('devInfo', `Manufacturer: Mitsubishi`);
|
|
1483
1488
|
this.emit('devInfo', '----------------------------------');
|
|
1484
1489
|
this.emit('devInfo', `Zone 1: Yes`);
|
|
1485
1490
|
this.emit('devInfo', `Hot Water Tank: ${supportsHotWaterTank ? 'Yes' : 'No'}`);
|
|
@@ -1489,7 +1494,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1489
1494
|
}
|
|
1490
1495
|
|
|
1491
1496
|
//accessory info
|
|
1492
|
-
this.manufacturer =
|
|
1497
|
+
this.manufacturer = 'Mitsubishi';
|
|
1493
1498
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
1494
1499
|
this.serialNumber = serialNumber.toString();
|
|
1495
1500
|
this.firmwareRevision = firmwareAppVersion.toString();
|
|
@@ -1510,7 +1515,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
1510
1515
|
const scheduleEnabled = deviceData.ScheduleEnabled;
|
|
1511
1516
|
const schedulesOnServer = deviceData.Schedule ?? [];
|
|
1512
1517
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
1513
|
-
const
|
|
1518
|
+
const holidayMode = deviceData.Device.HolidayMode;
|
|
1519
|
+
const holidayModeEnabled = accountTypeMelcloud ? holidayMode : deviceData.HolidayMode?.Enabled;
|
|
1514
1520
|
const holidayModeActive = deviceData.HolidayMode?.Active ?? false;
|
|
1515
1521
|
|
|
1516
1522
|
//device info
|
|
@@ -1545,12 +1551,11 @@ class DeviceAtw extends EventEmitter {
|
|
|
1545
1551
|
|
|
1546
1552
|
//heat pump
|
|
1547
1553
|
const heatPumpName = 'Heat Pump';
|
|
1548
|
-
const power = deviceData.Device.Power
|
|
1554
|
+
const power = deviceData.Device.Power;
|
|
1549
1555
|
const inStandbyMode = deviceData.Device.InStandbyMode;
|
|
1550
1556
|
const unitStatus = deviceData.Device.UnitStatus ?? 0;
|
|
1551
1557
|
const operationMode = deviceData.Device.OperationMode;
|
|
1552
1558
|
const outdoorTemperature = deviceData.Device.OutdoorTemperature;
|
|
1553
|
-
const holidayMode = deviceData.Device.HolidayMode ?? false;
|
|
1554
1559
|
const flowTemperatureHeatPump = deviceData.Device.FlowTemperature;
|
|
1555
1560
|
const returnTemperatureHeatPump = deviceData.Device.ReturnTemperature;
|
|
1556
1561
|
const isConnected = accountTypeMelcloud ? !deviceData.Device[connectKey] : deviceData.Device[connectKey];
|
|
@@ -1594,7 +1599,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1594
1599
|
const obj = {
|
|
1595
1600
|
presets: presetsOnServer,
|
|
1596
1601
|
schedules: schedulesOnServer,
|
|
1597
|
-
power: power
|
|
1602
|
+
power: power,
|
|
1598
1603
|
inStandbyMode: inStandbyMode,
|
|
1599
1604
|
unitStatus: unitStatus,
|
|
1600
1605
|
idleZone1: idleZone1,
|
|
@@ -2065,7 +2070,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
2065
2070
|
button.state = power ? (operationMode === 1) : false;
|
|
2066
2071
|
break;
|
|
2067
2072
|
case 53: //HOLIDAY
|
|
2068
|
-
button.state = power ? (
|
|
2073
|
+
button.state = power ? (holidayModeEnabled === true) : false;
|
|
2069
2074
|
break;
|
|
2070
2075
|
case 10: //ALL ZONES PHYSICAL LOCK CONTROL
|
|
2071
2076
|
button.state = power ? (prohibitZone1 === true && prohibitHotWater === true && prohibitZone2 === true) : false;
|
package/src/deviceerv.js
CHANGED
|
@@ -305,8 +305,6 @@ class DeviceErv extends EventEmitter {
|
|
|
305
305
|
return state;
|
|
306
306
|
})
|
|
307
307
|
.onSet(async (state) => {
|
|
308
|
-
if (!!state === this.accessory.power) return;
|
|
309
|
-
|
|
310
308
|
try {
|
|
311
309
|
deviceData.Device.Power = state ? true : false;
|
|
312
310
|
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.Power);
|
|
@@ -1023,7 +1021,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1023
1021
|
try {
|
|
1024
1022
|
//melcloud device
|
|
1025
1023
|
this.melCloudErv = new MelCloudErv(this.account, this.device, this.devicesFile, this.defaultTempsFile)
|
|
1026
|
-
.on('deviceInfo', (
|
|
1024
|
+
.on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
1027
1025
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1028
1026
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
1029
1027
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
@@ -1031,13 +1029,13 @@ class DeviceErv extends EventEmitter {
|
|
|
1031
1029
|
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
1032
1030
|
this.emit('devInfo', `Serial: ${serialNumber}`);
|
|
1033
1031
|
this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
1034
|
-
this.emit('devInfo', `Manufacturer:
|
|
1032
|
+
this.emit('devInfo', `Manufacturer: Mitsubishi`);
|
|
1035
1033
|
this.emit('devInfo', '----------------------------------');
|
|
1036
1034
|
this.displayDeviceInfo = false;
|
|
1037
1035
|
}
|
|
1038
1036
|
|
|
1039
1037
|
//accessory info
|
|
1040
|
-
this.manufacturer =
|
|
1038
|
+
this.manufacturer = 'Mitsubishi';
|
|
1041
1039
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
1042
1040
|
this.serialNumber = serialNumber.toString();
|
|
1043
1041
|
this.firmwareRevision = firmwareAppVersion.toString();
|
|
@@ -1136,7 +1134,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1136
1134
|
actualVentilationMode: actualVentilationMode,
|
|
1137
1135
|
numberOfFanSpeeds: numberOfFanSpeeds,
|
|
1138
1136
|
supportsFanSpeed: supportsFanSpeed,
|
|
1139
|
-
power: power
|
|
1137
|
+
power: power,
|
|
1140
1138
|
inStandbyMode: inStandbyMode,
|
|
1141
1139
|
operationMode: operationMode,
|
|
1142
1140
|
currentOperationMode: 0,
|