homebridge-melcloud-control 4.0.0-beta.67 → 4.0.0-beta.69
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 +4 -3
- package/src/deviceata.js +5 -4
- package/src/deviceatw.js +2 -1
- package/src/deviceerv.js +2 -1
- package/src/melcloudata.js +4 -3
- package/src/melcloudatw.js +1 -0
- package/src/melclouderv.js +1 -0
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.69",
|
|
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
|
@@ -18,7 +18,7 @@ export const ApiUrls = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const ApiUrlsHome = {
|
|
21
|
-
LoginUrl:"https://live-melcloudhome.auth.eu-west-1.amazoncognito.com/login?client_id=3g4d5l5kivuqi7oia68gib7uso&redirect_uri=https%3A%2F%2Fauth.melcloudhome.com%2Fsignin-oidc-meu&response_type=code&scope=openid%20profile&response_mode=form_post",
|
|
21
|
+
LoginUrl: "https://live-melcloudhome.auth.eu-west-1.amazoncognito.com/login?client_id=3g4d5l5kivuqi7oia68gib7uso&redirect_uri=https%3A%2F%2Fauth.melcloudhome.com%2Fsignin-oidc-meu&response_type=code&scope=openid%20profile&response_mode=form_post",
|
|
22
22
|
BaseURL: 'https://melcloudhome.com',
|
|
23
23
|
GetUserContext: "/api/user/context",
|
|
24
24
|
SetAta: "/api/ataunit/deviceid",
|
|
@@ -37,7 +37,7 @@ export const TemperatureDisplayUnits = ["°C", "°F"];
|
|
|
37
37
|
|
|
38
38
|
export const AirConditioner = {
|
|
39
39
|
System: ["AIR CONDITIONER OFF", "AIR CONDITIONER ON", "AIR CONDITIONER OFFLINE"],
|
|
40
|
-
|
|
40
|
+
OperationMode: [
|
|
41
41
|
"0", "HEAT", "DRY", "COOL", "4", "5", "6", "FAN", "AUTO",
|
|
42
42
|
"ISEE HEAT", "ISEE DRY", "ISEE COOL"
|
|
43
43
|
],
|
|
@@ -74,7 +74,8 @@ export const AirConditioner = {
|
|
|
74
74
|
Presets: 287,
|
|
75
75
|
HolidayMode: 131072,
|
|
76
76
|
All: 281483566710825
|
|
77
|
-
}
|
|
77
|
+
},
|
|
78
|
+
OperationModeMap: { "0": 0, "Heat": 1, "Dry": 2, "Cool": 3, "4": 4, "5": 5, "6": 6, "Fan": 7, "Auto": 8, "Isee Heat": 9, "Isee Dry": 10, "Isee Cool": 11 },
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
export const HeatPump = {
|
package/src/deviceata.js
CHANGED
|
@@ -16,6 +16,7 @@ class DeviceAta extends EventEmitter {
|
|
|
16
16
|
AccessoryUUID = api.hap.uuid;
|
|
17
17
|
|
|
18
18
|
//account config
|
|
19
|
+
this.account = account;
|
|
19
20
|
this.device = device;
|
|
20
21
|
this.displayMode = device.displayMode;
|
|
21
22
|
this.temperatureSensor = device.temperatureSensor || false;
|
|
@@ -327,7 +328,7 @@ class DeviceAta extends EventEmitter {
|
|
|
327
328
|
|
|
328
329
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.OperationModeSetTemperature;
|
|
329
330
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
330
|
-
const operationModeText = AirConditioner.
|
|
331
|
+
const operationModeText = AirConditioner.OperationMode[deviceData.Device.OperationMode];
|
|
331
332
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
332
333
|
} catch (error) {
|
|
333
334
|
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
@@ -522,7 +523,7 @@ class DeviceAta extends EventEmitter {
|
|
|
522
523
|
};
|
|
523
524
|
|
|
524
525
|
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
525
|
-
const operationModeText = AirConditioner.
|
|
526
|
+
const operationModeText = AirConditioner.OperationMode[deviceData.Device.OperationMode];
|
|
526
527
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
527
528
|
} catch (error) {
|
|
528
529
|
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
@@ -918,7 +919,7 @@ class DeviceAta extends EventEmitter {
|
|
|
918
919
|
async start() {
|
|
919
920
|
try {
|
|
920
921
|
//melcloud device
|
|
921
|
-
this.melCloudAta = new MelCloudAta(this.device, this.contextKey, this.devicesFile)
|
|
922
|
+
this.melCloudAta = new MelCloudAta(this.account, this.device, this.contextKey, this.devicesFile)
|
|
922
923
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
923
924
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
924
925
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
@@ -1312,7 +1313,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1312
1313
|
//log current state
|
|
1313
1314
|
if (this.logInfo) {
|
|
1314
1315
|
this.emit('info', `Power: ${power ? 'ON' : 'OFF'}`);
|
|
1315
|
-
this.emit('info', `Target operation mode: ${AirConditioner.
|
|
1316
|
+
this.emit('info', `Target operation mode: ${AirConditioner.OperationMode[operationMode]}`);
|
|
1316
1317
|
this.emit('info', `Current operation mode: ${this.displayMode === 1 ? AirConditioner.CurrentOperationModeHeatherCooler[obj.currentOperationMode] : AirConditioner.CurrentOperationModeThermostat[obj.currentOperationMode]}`);
|
|
1317
1318
|
this.emit('info', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
|
|
1318
1319
|
this.emit('info', `Current temperature: ${roomTemperature}${obj.temperatureUnit}`);
|
package/src/deviceatw.js
CHANGED
|
@@ -16,6 +16,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
16
16
|
AccessoryUUID = api.hap.uuid;
|
|
17
17
|
|
|
18
18
|
//account config
|
|
19
|
+
this.account = account;
|
|
19
20
|
this.device = device;
|
|
20
21
|
this.displayMode = device.displayMode;
|
|
21
22
|
this.hideZone = device.hideZone;
|
|
@@ -1284,7 +1285,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1284
1285
|
async start() {
|
|
1285
1286
|
try {
|
|
1286
1287
|
//melcloud device
|
|
1287
|
-
this.melCloudAtw = new MelCloudAtw(this.device, this.contextKey, this.devicesFile)
|
|
1288
|
+
this.melCloudAtw = new MelCloudAtw(this.account, this.device, this.contextKey, this.devicesFile)
|
|
1288
1289
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, hasHotWaterTank, hasZone2) => {
|
|
1289
1290
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1290
1291
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
package/src/deviceerv.js
CHANGED
|
@@ -16,6 +16,7 @@ class DeviceErv extends EventEmitter {
|
|
|
16
16
|
AccessoryUUID = api.hap.uuid;
|
|
17
17
|
|
|
18
18
|
//account config
|
|
19
|
+
this.account = account;
|
|
19
20
|
this.device = device;
|
|
20
21
|
this.displayMode = device.displayMode;
|
|
21
22
|
this.temperatureSensor = device.temperatureSensor || false;
|
|
@@ -839,7 +840,7 @@ class DeviceErv extends EventEmitter {
|
|
|
839
840
|
async start() {
|
|
840
841
|
try {
|
|
841
842
|
//melcloud device
|
|
842
|
-
this.melCloudErv = new MelCloudErv(this.device, this.contextKey, this.devicesFile)
|
|
843
|
+
this.melCloudErv = new MelCloudErv(this.account, this.device, this.contextKey, this.devicesFile)
|
|
843
844
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
844
845
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
845
846
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
package/src/melcloudata.js
CHANGED
|
@@ -3,11 +3,12 @@ import axios from 'axios';
|
|
|
3
3
|
import EventEmitter from 'events';
|
|
4
4
|
import ImpulseGenerator from './impulsegenerator.js';
|
|
5
5
|
import Functions from './functions.js';
|
|
6
|
-
import { ApiUrls } from './constants.js';
|
|
6
|
+
import { ApiUrls, AirConditioner } from './constants.js';
|
|
7
7
|
|
|
8
8
|
class MelCloudAta extends EventEmitter {
|
|
9
|
-
constructor(device, contextKey, devicesFile) {
|
|
9
|
+
constructor(account, device, contextKey, devicesFile) {
|
|
10
10
|
super();
|
|
11
|
+
this.accountType = account.displayType
|
|
11
12
|
this.deviceId = device.id;
|
|
12
13
|
this.logWarn = device.log?.warn;
|
|
13
14
|
this.logDebug = device.log?.debug;
|
|
@@ -92,7 +93,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
92
93
|
const vaneVerticalSwing = device.VaneVerticalSwing;
|
|
93
94
|
const vaneHorizontalDirection = device.VaneHorizontalDirection;
|
|
94
95
|
const vaneHorizontalSwing = device.VaneHorizontalSwing;
|
|
95
|
-
const operationMode = device.OperationMode;
|
|
96
|
+
const operationMode = this.accountType === 'melcloud' ? device.OperationMode : AirConditioner.OperationModeMap[device.OperationMode];
|
|
96
97
|
const inStandbyMode = device.InStandbyMode;
|
|
97
98
|
const defaultCoolingSetTemperature = device.DefaultCoolingSetTemperature;
|
|
98
99
|
const defaultHeatingSetTemperature = device.DefaultHeatingSetTemperature;
|
package/src/melcloudatw.js
CHANGED
|
@@ -8,6 +8,7 @@ import { ApiUrls } from './constants.js';
|
|
|
8
8
|
class MelCloudAtw extends EventEmitter {
|
|
9
9
|
constructor(device, contextKey, devicesFile) {
|
|
10
10
|
super();
|
|
11
|
+
this.accountType = account.displayType
|
|
11
12
|
this.deviceId = device.id;
|
|
12
13
|
this.logWarn = device.log?.warn;
|
|
13
14
|
this.logDebug = device.log?.debug;
|
package/src/melclouderv.js
CHANGED
|
@@ -8,6 +8,7 @@ import { ApiUrls } from './constants.js';
|
|
|
8
8
|
class MelCloudErv extends EventEmitter {
|
|
9
9
|
constructor(device, contextKey, devicesFile) {
|
|
10
10
|
super();
|
|
11
|
+
this.accountType = account.displayType
|
|
11
12
|
this.deviceId = device.id;
|
|
12
13
|
this.logWarn = device.log?.warn;
|
|
13
14
|
this.logDebug = device.log?.debug;
|