homebridge-melcloud-control 4.7.6-beta.4 → 4.7.6-beta.5
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 +5 -4
- package/package.json +1 -1
- package/src/deviceata.js +38 -34
- package/src/deviceatw.js +36 -31
- package/src/deviceerv.js +21 -17
- package/src/melcloudata.js +2 -2
- package/src/melcloudatw.js +2 -2
- package/src/melclouderv.js +2 -2
package/index.js
CHANGED
|
@@ -37,7 +37,8 @@ class MelCloudPlatform {
|
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
39
39
|
accountsName.push(name);
|
|
40
|
-
const accountRefreshInterval = (account.refreshInterval ?? 120) * 1000
|
|
40
|
+
const accountRefreshInterval = (account.refreshInterval ?? 120) * 1000;
|
|
41
|
+
const accountMelcloud = account.type === 'melcloud';
|
|
41
42
|
|
|
42
43
|
//log config
|
|
43
44
|
const logLevel = {
|
|
@@ -133,15 +134,15 @@ class MelCloudPlatform {
|
|
|
133
134
|
|
|
134
135
|
//presets
|
|
135
136
|
const presetIds = (melCloudDeviceData.Presets ?? []).map(p => String(p.ID));
|
|
136
|
-
const presets =
|
|
137
|
+
const presets = accountMelcloud ? (device.presets || []).filter(p => (p.displayType ?? 0) > 0 && presetIds.includes(p.id)) : [];
|
|
137
138
|
|
|
138
139
|
//schedules
|
|
139
140
|
const schedulesIds = (melCloudDeviceData.Schedule ?? []).map(s => String(s.Id));
|
|
140
|
-
const schedules =
|
|
141
|
+
const schedules = !accountMelcloud ? (device.schedules || []).filter(s => (s.displayType ?? 0) > 0 && schedulesIds.includes(s.id)) : [];
|
|
141
142
|
|
|
142
143
|
//scenes
|
|
143
144
|
const scenesIds = (melCloudDevicesData.Scenes ?? []).map(s => String(s.Id));
|
|
144
|
-
const scenes =
|
|
145
|
+
const scenes = !accountMelcloud ? (device.scenes || []).filter(s => (s.displayType ?? 0) > 0 && scenesIds.includes(s.id)) : [];
|
|
145
146
|
|
|
146
147
|
//buttons
|
|
147
148
|
const buttons = (device.buttonsSensors || []).filter(b => (b.displayType ?? 0) > 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.7.6-beta.
|
|
4
|
+
"version": "4.7.6-beta.5",
|
|
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
|
@@ -17,11 +17,10 @@ class DeviceAta extends EventEmitter {
|
|
|
17
17
|
AccessoryUUID = api.hap.uuid;
|
|
18
18
|
|
|
19
19
|
//account config
|
|
20
|
-
this.melCloudClass = melCloudClass;
|
|
21
|
-
this.melCloudDeviceData = melCloudDeviceData;
|
|
22
20
|
this.account = account;
|
|
23
21
|
this.accountType = account.type;
|
|
24
22
|
this.accountName = account.name;
|
|
23
|
+
this.accountTypeMelCloud = account.type === 'melcloud';
|
|
25
24
|
this.logDeviceInfo = account.log?.deviceInfo || false;
|
|
26
25
|
this.logInfo = account.log?.info || false;
|
|
27
26
|
this.logWarn = account.log?.warn || false;
|
|
@@ -51,6 +50,10 @@ class DeviceAta extends EventEmitter {
|
|
|
51
50
|
|
|
52
51
|
//files
|
|
53
52
|
this.defaultTempsFile = defaultTempsFile;
|
|
53
|
+
|
|
54
|
+
//melcloud
|
|
55
|
+
this.melCloudClass = melCloudClass;
|
|
56
|
+
this.melCloudDeviceData = melCloudDeviceData;
|
|
54
57
|
this.melCloudAccountData = melCloudAccountData;
|
|
55
58
|
|
|
56
59
|
//external integrations
|
|
@@ -185,6 +188,7 @@ class DeviceAta extends EventEmitter {
|
|
|
185
188
|
|
|
186
189
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
187
190
|
try {
|
|
191
|
+
const accountTypeMelCloud = this.accountTypeMelCloud;
|
|
188
192
|
let set = false
|
|
189
193
|
let flag = null;
|
|
190
194
|
switch (key) {
|
|
@@ -209,7 +213,7 @@ class DeviceAta extends EventEmitter {
|
|
|
209
213
|
flag = AirConditioner.EffectiveFlags.SetTemperature;
|
|
210
214
|
break;
|
|
211
215
|
case 'FanSpeed':
|
|
212
|
-
key =
|
|
216
|
+
key = accountTypeMelCloud ? key : 'SetFanSpeed';
|
|
213
217
|
deviceData.Device[key] = value;
|
|
214
218
|
flag = AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
215
219
|
break;
|
|
@@ -222,55 +226,55 @@ class DeviceAta extends EventEmitter {
|
|
|
222
226
|
flag = AirConditioner.EffectiveFlags.VaneVerticalDirection;
|
|
223
227
|
break;
|
|
224
228
|
case 'HideVaneControls':
|
|
225
|
-
if (
|
|
229
|
+
if (!accountTypeMelCloud) return;
|
|
226
230
|
|
|
227
231
|
deviceData[key] = value;
|
|
228
232
|
flag = AirConditioner.EffectiveFlags.Prohibit;
|
|
229
233
|
break;
|
|
230
234
|
case 'HideDryModeControl':
|
|
231
|
-
if (
|
|
235
|
+
if (!accountTypeMelCloud) return;
|
|
232
236
|
|
|
233
237
|
deviceData[key] = value;
|
|
234
238
|
flag = AirConditioner.EffectiveFlags.Prohibit;
|
|
235
239
|
break;
|
|
236
240
|
case 'ProhibitSetTemperature':
|
|
237
|
-
if (
|
|
241
|
+
if (!accountTypeMelCloud) return;
|
|
238
242
|
|
|
239
243
|
deviceData.Device[key] = value;
|
|
240
244
|
flag = AirConditioner.EffectiveFlags.Prohibit;
|
|
241
245
|
break;
|
|
242
246
|
case 'ProhibitOperationMode':
|
|
243
|
-
if (
|
|
247
|
+
if (!accountTypeMelCloud) return;
|
|
244
248
|
|
|
245
249
|
deviceData.Device[key] = value;
|
|
246
250
|
flag = AirConditioner.EffectiveFlags.Prohibit;
|
|
247
251
|
break;
|
|
248
252
|
case 'ProhibitPower':
|
|
249
|
-
if (
|
|
253
|
+
if (!accountTypeMelCloud) return;
|
|
250
254
|
|
|
251
255
|
deviceData.Device[key] = value;
|
|
252
256
|
flag = AirConditioner.EffectiveFlags.Prohibit;
|
|
253
257
|
break;
|
|
254
258
|
case 'FrostProtection':
|
|
255
|
-
if (
|
|
259
|
+
if (accountTypeMelCloud) return;
|
|
256
260
|
|
|
257
261
|
deviceData.Device[key].Enabled = value;
|
|
258
262
|
flag = 'frostprotection';
|
|
259
263
|
break;
|
|
260
264
|
case 'OverheatProtection':
|
|
261
|
-
if (
|
|
265
|
+
if (accountTypeMelCloud) return;
|
|
262
266
|
|
|
263
267
|
deviceData.Device[key].Enabled = value;
|
|
264
268
|
flag = 'overheatprotection';
|
|
265
269
|
break;
|
|
266
270
|
case 'Schedules':
|
|
267
|
-
if (
|
|
271
|
+
if (accountTypeMelCloud) return;
|
|
268
272
|
|
|
269
273
|
deviceData.Device[key].Enabled = value;
|
|
270
274
|
flag = 'schedule';
|
|
271
275
|
break;
|
|
272
276
|
case 'HolidayMode':
|
|
273
|
-
if (
|
|
277
|
+
if (accountTypeMelCloud) return;
|
|
274
278
|
|
|
275
279
|
deviceData.Device[key].Enabled = value;
|
|
276
280
|
flag = 'holidaymode';
|
|
@@ -403,7 +407,7 @@ class DeviceAta extends EventEmitter {
|
|
|
403
407
|
})
|
|
404
408
|
.onSet(async (value) => {
|
|
405
409
|
try {
|
|
406
|
-
const fanKey = this.
|
|
410
|
+
const fanKey = this.accountTypeMelCloud ? 'FanSpeed' : 'SetFanSpeed';
|
|
407
411
|
switch (numberOfFanSpeeds) {
|
|
408
412
|
case 2: //Fan speed mode 2
|
|
409
413
|
value = supportsAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
|
|
@@ -494,7 +498,7 @@ class DeviceAta extends EventEmitter {
|
|
|
494
498
|
return value;
|
|
495
499
|
})
|
|
496
500
|
.onSet(async (value) => {
|
|
497
|
-
if (this.
|
|
501
|
+
if (!this.accountTypeMelCloud) return;
|
|
498
502
|
|
|
499
503
|
try {
|
|
500
504
|
value = value ? true : false;
|
|
@@ -513,7 +517,7 @@ class DeviceAta extends EventEmitter {
|
|
|
513
517
|
return value;
|
|
514
518
|
})
|
|
515
519
|
.onSet(async (value) => {
|
|
516
|
-
if (this.
|
|
520
|
+
if (!this.accountTypeMelCloud) return;
|
|
517
521
|
|
|
518
522
|
try {
|
|
519
523
|
this.accessory.useFahrenheit = value ? true : false;
|
|
@@ -612,7 +616,7 @@ class DeviceAta extends EventEmitter {
|
|
|
612
616
|
return value;
|
|
613
617
|
})
|
|
614
618
|
.onSet(async (value) => {
|
|
615
|
-
if (this.
|
|
619
|
+
if (!this.accountTypeMelCloud) return;
|
|
616
620
|
|
|
617
621
|
try {
|
|
618
622
|
this.accessory.useFahrenheit = value ? true : false;
|
|
@@ -1225,7 +1229,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1225
1229
|
})
|
|
1226
1230
|
.onSet(async (state) => {
|
|
1227
1231
|
try {
|
|
1228
|
-
const fanKey = this.
|
|
1232
|
+
const fanKey = this.accountTypeMelCloud ? 'FanSpeed' : 'SetFanSpeed';
|
|
1229
1233
|
let flag = null;
|
|
1230
1234
|
switch (mode) {
|
|
1231
1235
|
case 0: //POWER ON,OFF
|
|
@@ -1492,19 +1496,19 @@ class DeviceAta extends EventEmitter {
|
|
|
1492
1496
|
this.deviceData = deviceData;
|
|
1493
1497
|
|
|
1494
1498
|
//keys
|
|
1495
|
-
const
|
|
1496
|
-
const fanKey =
|
|
1497
|
-
const tempStepKey =
|
|
1498
|
-
const connectKey =
|
|
1499
|
-
const errorKey =
|
|
1500
|
-
const supportAirDirectionKey =
|
|
1501
|
-
const supportSwingKey =
|
|
1502
|
-
const supportVideWaneKey =
|
|
1503
|
-
const supportAutoKey =
|
|
1504
|
-
const supportHeatKey =
|
|
1505
|
-
const supportDryKey =
|
|
1506
|
-
const supportCoolKey =
|
|
1507
|
-
const supportStandbyKey =
|
|
1499
|
+
const accountTypeMelCloud = this.accountTypeMelCloud;
|
|
1500
|
+
const fanKey = accountTypeMelCloud ? 'FanSpeed' : 'SetFanSpeed';
|
|
1501
|
+
const tempStepKey = accountTypeMelCloud ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
1502
|
+
const connectKey = accountTypeMelCloud ? 'Offline' : 'IsConnected';
|
|
1503
|
+
const errorKey = accountTypeMelCloud ? 'HasError' : 'IsInError';
|
|
1504
|
+
const supportAirDirectionKey = accountTypeMelCloud ? 'AirDirectionFunction' : 'HasAirDirectionFunction';
|
|
1505
|
+
const supportSwingKey = accountTypeMelCloud ? 'SwingFunction' : 'HasSwing';
|
|
1506
|
+
const supportVideWaneKey = accountTypeMelCloud ? 'ModelSupportsWideVane' : 'SupportsWideVane';
|
|
1507
|
+
const supportAutoKey = accountTypeMelCloud ? 'ModelSupportsAuto' : 'HasAutoOperationMode';
|
|
1508
|
+
const supportHeatKey = accountTypeMelCloud ? 'ModelSupportsHeat' : 'HasHeatOperationMode';
|
|
1509
|
+
const supportDryKey = accountTypeMelCloud ? 'ModelSupportsDry' : 'HasDryOperationMode';
|
|
1510
|
+
const supportCoolKey = accountTypeMelCloud ? 'ModelSupportsCool' : 'HasCoolOperationMode';
|
|
1511
|
+
const supportStandbyKey = accountTypeMelCloud ? 'ModelSupportsStandbyMode' : 'HasStandby';
|
|
1508
1512
|
|
|
1509
1513
|
//presets schedules
|
|
1510
1514
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
@@ -1528,7 +1532,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1528
1532
|
const supportsSwingFunction = deviceData.Device[supportSwingKey];
|
|
1529
1533
|
const supportsWideVane = deviceData.Device[supportVideWaneKey];
|
|
1530
1534
|
const supportsOutdoorTemperature = deviceData.Device.HasOutdoorTemperature;
|
|
1531
|
-
const supportsFanSpeed =
|
|
1535
|
+
const supportsFanSpeed = accountTypeMelCloud ? deviceData.Device.ModelSupportsFanSpeed : deviceData.Device.NumberOfFanSpeeds > 0;
|
|
1532
1536
|
const supportsAuto1 = deviceData.Device[supportAutoKey];
|
|
1533
1537
|
const supportsAuto = this.autoDryFanMode >= 1 && supportsAuto1
|
|
1534
1538
|
const supportsHeat1 = deviceData.Device[supportHeatKey];
|
|
@@ -1539,7 +1543,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1539
1543
|
const numberOfFanSpeeds = deviceData.Device.NumberOfFanSpeeds;
|
|
1540
1544
|
const minSetHeatRoomTemperature = 10;
|
|
1541
1545
|
const maxSetHeatCoolDryAutoRoomTemperature = 31;
|
|
1542
|
-
const minSetCoolDryAutoRoomTemperature =
|
|
1546
|
+
const minSetCoolDryAutoRoomTemperature = accountTypeMelCloud ? 4 : deviceData.Device.MinTempAutomatic ?? 16;
|
|
1543
1547
|
|
|
1544
1548
|
//device state
|
|
1545
1549
|
const power = deviceData.Device.Power ?? false;
|
|
@@ -1561,7 +1565,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1561
1565
|
const prohibitPower = deviceData.Device.ProhibitPower ?? false;
|
|
1562
1566
|
const temperatureStep = deviceData.Device[tempStepKey] ? 0.5 : 1;
|
|
1563
1567
|
const outdoorTemperature = deviceData.Device.OutdoorTemperature;
|
|
1564
|
-
const isConnected =
|
|
1568
|
+
const isConnected = accountTypeMelCloud ? !deviceData.Device[connectKey] : deviceData.Device[connectKey];
|
|
1565
1569
|
const isInError = deviceData.Device[errorKey];
|
|
1566
1570
|
const currentSwingMode = supportsSwingFunction ? (supportsWideVane ? vaneHorizontalDirection === 12 && vaneVerticalDirection === 7 ? 1 : 0 : vaneVerticalDirection === 7 ? 1 : 0) : 0;
|
|
1567
1571
|
|
|
@@ -2015,7 +2019,7 @@ class DeviceAta extends EventEmitter {
|
|
|
2015
2019
|
if (supportsSwingFunction) this.emit('info', `Air direction: ${AirConditioner.AirDirectionMapEnumToString[currentSwingMode]}`);
|
|
2016
2020
|
this.emit('info', `Temperature display unit: ${obj.temperatureUnit}`);
|
|
2017
2021
|
this.emit('info', `Lock physical controls: ${obj.lockPhysicalControl ? 'Locked' : 'Unlocked'}`);
|
|
2018
|
-
if (this.
|
|
2022
|
+
if (!this.accountTypeMelCloud) this.emit('info', `Signal strength: ${deviceData.Rssi}dBm`);
|
|
2019
2023
|
}
|
|
2020
2024
|
})
|
|
2021
2025
|
.on('success', (success) => this.emit('success', success))
|
package/src/deviceatw.js
CHANGED
|
@@ -17,11 +17,10 @@ class DeviceAtw extends EventEmitter {
|
|
|
17
17
|
AccessoryUUID = api.hap.uuid;
|
|
18
18
|
|
|
19
19
|
//account config
|
|
20
|
-
this.melCloudClass = melCloudClass;
|
|
21
|
-
this.melCloudDeviceData = melCloudDeviceData;
|
|
22
20
|
this.account = account;
|
|
23
21
|
this.accountType = account.type;
|
|
24
22
|
this.accountName = account.name;
|
|
23
|
+
this.accountTypeMelCloud = account.type === 'melcloud';
|
|
25
24
|
this.logDeviceInfo = account.log?.deviceInfo || false;
|
|
26
25
|
this.logInfo = account.log?.info || false;
|
|
27
26
|
this.logWarn = account.log?.warn || false;
|
|
@@ -59,6 +58,10 @@ class DeviceAtw extends EventEmitter {
|
|
|
59
58
|
|
|
60
59
|
//files
|
|
61
60
|
this.defaultTempsFile = defaultTempsFile;
|
|
61
|
+
|
|
62
|
+
//melcloud
|
|
63
|
+
this.melCloudClass = melCloudClass;
|
|
64
|
+
this.melCloudDeviceData = melCloudDeviceData;
|
|
62
65
|
this.melCloudAccountData = melCloudAccountData;
|
|
63
66
|
|
|
64
67
|
//external integrations
|
|
@@ -192,6 +195,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
192
195
|
|
|
193
196
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
194
197
|
try {
|
|
198
|
+
const accountTypeMelCloud = this.accountTypeMelCloud;
|
|
195
199
|
let set = false
|
|
196
200
|
let flag = null;
|
|
197
201
|
switch (key) {
|
|
@@ -248,36 +252,36 @@ class DeviceAtw extends EventEmitter {
|
|
|
248
252
|
flag = HeatPump.EffectiveFlags.EcoHotWater;
|
|
249
253
|
break;
|
|
250
254
|
case 'ProhibitZone1':
|
|
251
|
-
if (
|
|
255
|
+
if (!accountTypeMelCloud) return;
|
|
252
256
|
|
|
253
257
|
deviceData.Device[key] = value;
|
|
254
258
|
flag = HeatPump.EffectiveFlags.ProhibitZone1;
|
|
255
259
|
break;
|
|
256
260
|
case 'ProhibitZone2':
|
|
257
|
-
if (
|
|
261
|
+
if (!accountTypeMelCloud) return;
|
|
258
262
|
|
|
259
263
|
deviceData.Device[key] = value;
|
|
260
264
|
flag = HeatPump.EffectiveFlags.ProhibitZone2;
|
|
261
265
|
break;
|
|
262
266
|
case 'ProhibitHotWater':
|
|
263
|
-
if (
|
|
267
|
+
if (!accountTypeMelCloud) return;
|
|
264
268
|
|
|
265
269
|
deviceData.Device[key] = value;
|
|
266
270
|
flag = HeatPump.EffectiveFlags.ProhibitHotWater;
|
|
267
271
|
break;
|
|
268
272
|
case 'ScheduleEnabled':
|
|
269
|
-
if (
|
|
273
|
+
if (accountTypeMelCloud) return;
|
|
270
274
|
|
|
271
275
|
deviceData.Device[key].Enabled = value;
|
|
272
276
|
flag = 'schedule';
|
|
273
277
|
break;
|
|
274
278
|
case 'HolidayMode':
|
|
275
|
-
if (
|
|
279
|
+
if (accountTypeMelCloud) {
|
|
276
280
|
deviceData.Device[key] = value;
|
|
277
281
|
flag = HeatPump.EffectiveFlags.HolidayMode;
|
|
278
282
|
}
|
|
279
283
|
|
|
280
|
-
if (
|
|
284
|
+
if (!accountTypeMelCloud) {
|
|
281
285
|
deviceData.Device[key].Enabled = value;
|
|
282
286
|
flag = 'holidaymode';
|
|
283
287
|
}
|
|
@@ -297,7 +301,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
297
301
|
//prepare accessory
|
|
298
302
|
async prepareAccessory() {
|
|
299
303
|
try {
|
|
300
|
-
const
|
|
304
|
+
const accountTypeMelCloud = this.accountTypeMelCloud;
|
|
301
305
|
const deviceData = this.deviceData;
|
|
302
306
|
const deviceId = this.deviceId;
|
|
303
307
|
const deviceTypeString = this.deviceTypeString;
|
|
@@ -485,7 +489,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
485
489
|
.onSet(async (value) => {
|
|
486
490
|
try {
|
|
487
491
|
let flag = null;
|
|
488
|
-
switch (
|
|
492
|
+
switch (accountTypeMelCloud) {
|
|
489
493
|
case true: //Melcloud
|
|
490
494
|
switch (i) {
|
|
491
495
|
case caseHeatPump: //Heat Pump
|
|
@@ -571,7 +575,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
571
575
|
.onSet(async (value) => {
|
|
572
576
|
try {
|
|
573
577
|
let flag = null;
|
|
574
|
-
switch (
|
|
578
|
+
switch (accountTypeMelCloud) {
|
|
575
579
|
case true: //Melcloud
|
|
576
580
|
switch (i) {
|
|
577
581
|
case caseHeatPump: //Heat Pump
|
|
@@ -648,7 +652,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
648
652
|
return value;
|
|
649
653
|
})
|
|
650
654
|
.onSet(async (value) => {
|
|
651
|
-
if (this.
|
|
655
|
+
if (!this.accountTypeMelCloud) return;
|
|
652
656
|
|
|
653
657
|
try {
|
|
654
658
|
value = value ? true : false;
|
|
@@ -687,7 +691,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
687
691
|
return value;
|
|
688
692
|
})
|
|
689
693
|
.onSet(async (value) => {
|
|
690
|
-
if (this.
|
|
694
|
+
if (!this.accountTypeMelCloud) return;
|
|
691
695
|
|
|
692
696
|
try {
|
|
693
697
|
this.accessory.useFahrenheit = value ? true : false;
|
|
@@ -837,7 +841,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
837
841
|
.onSet(async (value) => {
|
|
838
842
|
try {
|
|
839
843
|
let flag = null;
|
|
840
|
-
switch (
|
|
844
|
+
switch (accountTypeMelCloud) {
|
|
841
845
|
case true: //Melcloud
|
|
842
846
|
switch (i) {
|
|
843
847
|
case caseHeatPump: //Heat Pump
|
|
@@ -913,7 +917,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
913
917
|
return value;
|
|
914
918
|
})
|
|
915
919
|
.onSet(async (value) => {
|
|
916
|
-
if (this.
|
|
920
|
+
if (!this.accountTypeMelCloud) return;
|
|
917
921
|
|
|
918
922
|
try {
|
|
919
923
|
this.accessory.useFahrenheit = value ? true : false;
|
|
@@ -1588,12 +1592,12 @@ class DeviceAtw extends EventEmitter {
|
|
|
1588
1592
|
flag = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
1589
1593
|
break;
|
|
1590
1594
|
case 3: //HOLIDAY
|
|
1591
|
-
if (this.
|
|
1595
|
+
if (this.accountTypeMelCloud) {
|
|
1592
1596
|
deviceData.Device.HolidayMode = state;
|
|
1593
1597
|
flag = HeatPump.EffectiveFlags.HolidayMode;
|
|
1594
1598
|
}
|
|
1595
1599
|
|
|
1596
|
-
if (
|
|
1600
|
+
if (!accountTypeMelCloud) {
|
|
1597
1601
|
deviceData.Device.HolidayMode.Enabled = state;
|
|
1598
1602
|
flag = 'holidaymode';
|
|
1599
1603
|
}
|
|
@@ -1756,6 +1760,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1756
1760
|
this.emit('devInfo', `Hot Water Tank: ${supportsHotWaterTank ? 'Yes' : 'No'}`);
|
|
1757
1761
|
this.emit('devInfo', `Zone 2: ${supportsZone2 ? 'Yes' : 'No'}`);
|
|
1758
1762
|
this.emit('devInfo', '----------------------------------');
|
|
1763
|
+
if (!this.accountTypeMelCloud) this.emit('info', `Signal strength: ${deviceData.Rssi}dBm`);
|
|
1759
1764
|
this.displayDeviceInfo = false;
|
|
1760
1765
|
}
|
|
1761
1766
|
|
|
@@ -1771,14 +1776,14 @@ class DeviceAtw extends EventEmitter {
|
|
|
1771
1776
|
this.deviceData = deviceData;
|
|
1772
1777
|
|
|
1773
1778
|
//keys
|
|
1774
|
-
const
|
|
1775
|
-
const tempStepKey =
|
|
1776
|
-
const connectKey =
|
|
1777
|
-
const errorKey =
|
|
1778
|
-
const supportStandbyKey =
|
|
1779
|
-
const supportHeatKey =
|
|
1780
|
-
const supportCoolKey =
|
|
1781
|
-
const supportHotWaterKey =
|
|
1779
|
+
const accountTypeMelCloud = this.accountTypeMelCloud;
|
|
1780
|
+
const tempStepKey = accountTypeMelCloud ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
1781
|
+
const connectKey = accountTypeMelCloud ? 'Offline' : 'IsConnected';
|
|
1782
|
+
const errorKey = accountTypeMelCloud ? 'HasError' : 'IsInError';
|
|
1783
|
+
const supportStandbyKey = accountTypeMelCloud ? 'ModelSupportsStandbyMode' : 'HasStandby';
|
|
1784
|
+
const supportHeatKey = accountTypeMelCloud ? 'CanHeat' : 'HasHeatMode';
|
|
1785
|
+
const supportCoolKey = accountTypeMelCloud ? 'CanCool' : 'HasCoolingMode';
|
|
1786
|
+
const supportHotWaterKey = accountTypeMelCloud ? 'HasHotWaterTank' : 'HasHotWater';
|
|
1782
1787
|
|
|
1783
1788
|
//presets schedule
|
|
1784
1789
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
@@ -1872,7 +1877,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1872
1877
|
const returnTemperatureZone2 = deviceData.Device.ReturnTemperatureZone2;
|
|
1873
1878
|
|
|
1874
1879
|
//device
|
|
1875
|
-
const isConnected =
|
|
1880
|
+
const isConnected = accountTypeMelCloud ? !deviceData.Device[connectKey] : deviceData.Device[connectKey];
|
|
1876
1881
|
const isInError = deviceData.Device[errorKey];
|
|
1877
1882
|
|
|
1878
1883
|
//accessory
|
|
@@ -1957,7 +1962,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1957
1962
|
currentOperationMode = !power ? 0 : (idleZone1 ? 1 : [2, 2, 2, 3, 3, 2][operationModeZone1]); //INACTIVE, IDLE, HEATING, COOLING
|
|
1958
1963
|
targetOperationMode = [1, 2, 0, 1, 2, 1][operationModeZone1]; //AUTO, HEAT, COOL
|
|
1959
1964
|
|
|
1960
|
-
switch (
|
|
1965
|
+
switch (accountTypeMelCloud) {
|
|
1961
1966
|
case true: //Melcloud
|
|
1962
1967
|
switch (operationModeZone1) {
|
|
1963
1968
|
case 1: //HEAT FLOW
|
|
@@ -2027,7 +2032,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
2027
2032
|
currentOperationMode = !power ? 0 : (idleZone2 ? 1 : [2, 2, 2, 3, 3, 2][operationModeZone2]); //INACTIVE, IDLE, HEATING, COOLING
|
|
2028
2033
|
targetOperationMode = [1, 2, 0, 1, 2, 1][operationModeZone2]; //AUTO, HEAT, COOL
|
|
2029
2034
|
|
|
2030
|
-
switch (
|
|
2035
|
+
switch (accountTypeMelCloud) {
|
|
2031
2036
|
case true: //Melcloud
|
|
2032
2037
|
switch (operationModeZone2) {
|
|
2033
2038
|
case 1: //HEAT FLOW
|
|
@@ -2116,7 +2121,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
2116
2121
|
currentOperationMode = !power ? 0 : idleZone1 ? 0 : [1, 1, 1, 2, 2, 1][operationModeZone1]; //OFF, HEAT, COOL
|
|
2117
2122
|
targetOperationMode = [1, 2, 3, 1, 2, 1][operationModeZone1]; //OFF, HEAT, COOL, AUTO
|
|
2118
2123
|
|
|
2119
|
-
switch (
|
|
2124
|
+
switch (accountTypeMelCloud) {
|
|
2120
2125
|
case true: //Melcloud
|
|
2121
2126
|
switch (operationModeZone1) {
|
|
2122
2127
|
case 1: //HEAT FLOW
|
|
@@ -2184,7 +2189,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
2184
2189
|
currentOperationMode = !power ? 0 : (idleZone2 ? 0 : [1, 1, 1, 2, 2, 1][operationModeZone2]); //OFF, HEAT, COOL
|
|
2185
2190
|
targetOperationMode = [1, 2, 3, 1, 2, 1][operationModeZone2]; //OFF, HEAT, COOL, AUTO
|
|
2186
2191
|
|
|
2187
|
-
switch (
|
|
2192
|
+
switch (accountTypeMelCloud) {
|
|
2188
2193
|
case true: //Melcloud
|
|
2189
2194
|
switch (operationModeZone2) {
|
|
2190
2195
|
case 1: //HEAT FLOW
|
|
@@ -2282,7 +2287,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
2282
2287
|
this.emit('info', `${name} Outdoor temperature: ${roomTemperature}${obj.temperatureUnit}`);
|
|
2283
2288
|
this.emit('info', `${name} Temperature display unit: ${obj.temperatureUnit}`);
|
|
2284
2289
|
this.emit('info', `${name} Lock physical controls: ${lockPhysicalControl ? 'Locked' : 'Unlocked'}`);
|
|
2285
|
-
if (!
|
|
2290
|
+
if (!accountTypeMelCloud) this.emit('info', `Signal strength: ${deviceData.Rssi}dBm`);
|
|
2286
2291
|
break;
|
|
2287
2292
|
case caseZone1: //Zone 1 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
|
|
2288
2293
|
operationModeText = idleZone1 ? HeatPump.OperationModeZoneMapEnumToStringInfo[6] : HeatPump.OperationModeZoneMapEnumToStringInfo[operationModeZone];
|
package/src/deviceerv.js
CHANGED
|
@@ -17,11 +17,10 @@ class DeviceErv extends EventEmitter {
|
|
|
17
17
|
AccessoryUUID = api.hap.uuid;
|
|
18
18
|
|
|
19
19
|
//account config
|
|
20
|
-
this.melCloudClass = melCloudClass;
|
|
21
|
-
this.melCloudDeviceData = melCloudDeviceData;
|
|
22
20
|
this.account = account;
|
|
23
21
|
this.accountType = account.type;
|
|
24
22
|
this.accountName = account.name;
|
|
23
|
+
this.accountTypeMelCloud = account.type === 'melcloud';
|
|
25
24
|
this.logDeviceInfo = account.log?.deviceInfo || false;
|
|
26
25
|
this.logInfo = account.log?.info || false;
|
|
27
26
|
this.logWarn = account.log?.warn || false;
|
|
@@ -47,6 +46,10 @@ class DeviceErv extends EventEmitter {
|
|
|
47
46
|
|
|
48
47
|
//files
|
|
49
48
|
this.defaultTempsFile = defaultTempsFile;
|
|
49
|
+
|
|
50
|
+
//melcloud
|
|
51
|
+
this.melCloudClass = melCloudClass;
|
|
52
|
+
this.melCloudDeviceData = melCloudDeviceData;
|
|
50
53
|
this.melCloudAccountData = melCloudAccountData;
|
|
51
54
|
|
|
52
55
|
//external integrations
|
|
@@ -179,6 +182,7 @@ class DeviceErv extends EventEmitter {
|
|
|
179
182
|
|
|
180
183
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
181
184
|
try {
|
|
185
|
+
const accountTypeMelCloud = this.accountTypeMelCloud;
|
|
182
186
|
let set = false
|
|
183
187
|
let flag = null;
|
|
184
188
|
switch (key) {
|
|
@@ -207,7 +211,7 @@ class DeviceErv extends EventEmitter {
|
|
|
207
211
|
flag = Ventilation.EffectiveFlags.SetTemperature;
|
|
208
212
|
break;
|
|
209
213
|
case 'NightPurgeMode':
|
|
210
|
-
if (
|
|
214
|
+
if (!accountTypeMelCloud) return;
|
|
211
215
|
|
|
212
216
|
deviceData.Device[key] = value;
|
|
213
217
|
flag = Ventilation.EffectiveFlags.NightPurgeMode;
|
|
@@ -217,31 +221,31 @@ class DeviceErv extends EventEmitter {
|
|
|
217
221
|
flag = Ventilation.EffectiveFlags.SetFanSpeed;
|
|
218
222
|
break;
|
|
219
223
|
case 'HideRoomTemperature':
|
|
220
|
-
if (
|
|
224
|
+
if (!accountTypeMelCloud) return;
|
|
221
225
|
|
|
222
226
|
deviceData[key] = value;
|
|
223
227
|
flag = Ventilation.EffectiveFlags.Prohibit;
|
|
224
228
|
break;
|
|
225
229
|
case 'HideSupplyTemperature':
|
|
226
|
-
if (
|
|
230
|
+
if (!accountTypeMelCloud) return;
|
|
227
231
|
|
|
228
232
|
deviceData[key] = value;
|
|
229
233
|
flag = Ventilation.EffectiveFlags.Prohibit;
|
|
230
234
|
break;
|
|
231
235
|
case 'HideOutdoorTemperature':
|
|
232
|
-
if (
|
|
236
|
+
if (!accountTypeMelCloud) return;
|
|
233
237
|
|
|
234
238
|
deviceData[key] = value;
|
|
235
239
|
flag = Ventilation.EffectiveFlags.Prohibit;
|
|
236
240
|
break;
|
|
237
241
|
case 'ScheduleEnabled':
|
|
238
|
-
if (
|
|
242
|
+
if (accountTypeMelCloud) return;
|
|
239
243
|
|
|
240
244
|
deviceData.Device[key].Enabled = value;
|
|
241
245
|
flag = 'schedule';
|
|
242
246
|
break;
|
|
243
247
|
case 'HolidayMode':
|
|
244
|
-
if (
|
|
248
|
+
if (accountTypeMelCloud) return;
|
|
245
249
|
|
|
246
250
|
deviceData.Device[key].Enabled = value;
|
|
247
251
|
flag = 'holidaymode';
|
|
@@ -445,7 +449,7 @@ class DeviceErv extends EventEmitter {
|
|
|
445
449
|
return value;
|
|
446
450
|
})
|
|
447
451
|
.onSet(async (value) => {
|
|
448
|
-
if (this.
|
|
452
|
+
if (!this.accountTypeMelCloud) return;
|
|
449
453
|
|
|
450
454
|
try {
|
|
451
455
|
this.accessory.useFahrenheit = value ? true : false;
|
|
@@ -539,7 +543,7 @@ class DeviceErv extends EventEmitter {
|
|
|
539
543
|
return value;
|
|
540
544
|
})
|
|
541
545
|
.onSet(async (value) => {
|
|
542
|
-
if (this.
|
|
546
|
+
if (!this.accountTypeMelCloud) return;
|
|
543
547
|
|
|
544
548
|
try {
|
|
545
549
|
this.accessory.useFahrenheit = value ? true : false;
|
|
@@ -1138,11 +1142,11 @@ class DeviceErv extends EventEmitter {
|
|
|
1138
1142
|
this.deviceData = deviceData;
|
|
1139
1143
|
|
|
1140
1144
|
//keys
|
|
1141
|
-
const
|
|
1142
|
-
const tempStepKey =
|
|
1143
|
-
const connectKey =
|
|
1144
|
-
const errorKey =
|
|
1145
|
-
const supportStandbyKey =
|
|
1145
|
+
const accountTypeMelCloud = this.accountTypeMelCloud;
|
|
1146
|
+
const tempStepKey = accountTypeMelCloud ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
1147
|
+
const connectKey = accountTypeMelCloud ? 'Offline' : 'IsConnected';
|
|
1148
|
+
const errorKey = accountTypeMelCloud ? 'HasError' : 'IsInError';
|
|
1149
|
+
const supportStandbyKey = accountTypeMelCloud ? 'ModelSupportsStandbyMode' : 'HasStandby';
|
|
1146
1150
|
|
|
1147
1151
|
//presets schedule
|
|
1148
1152
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
@@ -1200,7 +1204,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1200
1204
|
const setFanSpeed = deviceData.Device.SetFanSpeed;
|
|
1201
1205
|
const operationMode = deviceData.Device.OperationMode;
|
|
1202
1206
|
const ventilationMode = deviceData.Device.VentilationMode;
|
|
1203
|
-
const isConnected =
|
|
1207
|
+
const isConnected = accountTypeMelCloud ? !deviceData.Device[connectKey] : deviceData.Device[connectKey];
|
|
1204
1208
|
const isInError = deviceData.Device[errorKey];
|
|
1205
1209
|
|
|
1206
1210
|
//accessory
|
|
@@ -1562,7 +1566,7 @@ class DeviceErv extends EventEmitter {
|
|
|
1562
1566
|
if (supportsCO2Sensor) this.emit('info', `CO2 level: ${roomCO2Level} ppm`);
|
|
1563
1567
|
if (supportsPM25Sensor) this.emit('info', `PM2.5 air quality: ${Ventilation.PM25AirQualityMapEnumToString[pM25AirQuality]}`);
|
|
1564
1568
|
if (supportsPM25Sensor) this.emit('info', `PM2.5 level: ${pM25Level} µg/m`);
|
|
1565
|
-
if (this.
|
|
1569
|
+
if (!this.accountTypeMelCloud) this.emit('info', `Signal strength: ${deviceData.Rssi}dBm`);
|
|
1566
1570
|
}
|
|
1567
1571
|
})
|
|
1568
1572
|
.on('success', (success) => this.emit('success', success))
|
package/src/melcloudata.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ApiUrls, AirConditioner } from './constants.js';
|
|
|
5
5
|
class MelCloudAta extends EventEmitter {
|
|
6
6
|
constructor(account, device, defaultTempsFile, melCloudClass) {
|
|
7
7
|
super();
|
|
8
|
-
this.
|
|
8
|
+
this.accountTypeMelcloud = account.type === 'melcloud';
|
|
9
9
|
this.logSuccess = account.log?.success;
|
|
10
10
|
this.logWarn = account.log?.warn;
|
|
11
11
|
this.logError = account.log?.error;
|
|
@@ -123,7 +123,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
123
123
|
|
|
124
124
|
async updateState(type, deviceData) {
|
|
125
125
|
try {
|
|
126
|
-
if (this.
|
|
126
|
+
if (!this.accountTypeMelcloud) {
|
|
127
127
|
if (type === 'ws') {
|
|
128
128
|
deviceData.Device.OperationMode = AirConditioner.OperationModeMapEnumToEnumWs[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
|
|
129
129
|
deviceData.Device.VaneHorizontalDirection = AirConditioner.VaneHorizontalDirectionMapEnumToEnumWs[deviceData.Device.VaneHorizontalDirection] ?? deviceData.Device.VaneHorizontalDirection;
|
package/src/melcloudatw.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ApiUrls, HeatPump } from './constants.js';
|
|
|
5
5
|
class MelCloudAtw extends EventEmitter {
|
|
6
6
|
constructor(account, device, defaultTempsFile, melCloudClass) {
|
|
7
7
|
super();
|
|
8
|
-
this.
|
|
8
|
+
this.accountTypeMelCloud = account.type === 'melcloud';
|
|
9
9
|
this.logSuccess = account.log?.success;
|
|
10
10
|
this.logWarn = account.log?.warn;
|
|
11
11
|
this.logError = account.log?.error;
|
|
@@ -110,7 +110,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
110
110
|
|
|
111
111
|
async updateState(type, deviceData) {
|
|
112
112
|
try {
|
|
113
|
-
if (this.
|
|
113
|
+
if (!this.accountTypeMelCloud) {
|
|
114
114
|
deviceData.Device.OperationMode = HeatPump.OperationModeMapStringToEnum[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
|
|
115
115
|
deviceData.Device.OperationModeZone1 = HeatPump.OperationModeZoneMapStringToEnum[deviceData.Device.OperationModeZone1] ?? deviceData.Device.OperationModeZone1;
|
|
116
116
|
deviceData.Device.OperationModeZone2 = HeatPump.OperationModeZoneMapStringToEnum[deviceData.Device.OperationModeZone2] ?? deviceData.Device.OperationModeZone2;
|
package/src/melclouderv.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ApiUrls, Ventilation } from './constants.js';
|
|
|
5
5
|
class MelCloudErv extends EventEmitter {
|
|
6
6
|
constructor(account, device, defaultTempsFile, melCloudClass) {
|
|
7
7
|
super();
|
|
8
|
-
this.
|
|
8
|
+
this.accountTypeMelCloud = account.type === 'melcloud';
|
|
9
9
|
this.logSuccess = account.log?.success;
|
|
10
10
|
this.logWarn = account.log?.warn;
|
|
11
11
|
this.logError = account.log?.error;
|
|
@@ -110,7 +110,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
110
110
|
|
|
111
111
|
async updateState(type, deviceData) {
|
|
112
112
|
try {
|
|
113
|
-
if (this.
|
|
113
|
+
if (!this.accountTypeMelCloud) {
|
|
114
114
|
//read default temps
|
|
115
115
|
const temps = await this.functions.readData(this.defaultTempsFile, true);
|
|
116
116
|
deviceData.Device.DefaultHeatingSetTemperature = temps?.defaultHeatingSetTemperature ?? 20;
|