homebridge-melcloud-control 4.0.0-beta.524 → 4.0.0-beta.527
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/deviceata.js +2 -13
- package/src/deviceatw.js +109 -118
- package/src/deviceerv.js +44 -57
- package/src/melcloudata.js +5 -5
- package/src/melcloudatw.js +7 -6
- package/src/melclouderv.js +7 -6
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.527",
|
|
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
|
@@ -159,72 +159,61 @@ class DeviceAta extends EventEmitter {
|
|
|
159
159
|
case 'Power':
|
|
160
160
|
deviceData.Device[key] = value;
|
|
161
161
|
effectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
162
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
163
162
|
break;
|
|
164
163
|
case 'OperationMode':
|
|
165
164
|
deviceData.Device[key] = value;
|
|
166
165
|
effectiveFlags = AirConditioner.EffectiveFlags.OperationMode
|
|
167
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
168
166
|
break;
|
|
169
167
|
case 'SetTemperature':
|
|
170
168
|
deviceData.Device[key] = value;
|
|
171
169
|
effectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
172
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
173
170
|
break;
|
|
174
171
|
case 'DefaultCoolingSetTemperature':
|
|
175
172
|
deviceData.Device[key] = value;
|
|
176
173
|
effectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
177
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
178
174
|
break;
|
|
179
175
|
case 'DefaultHeatingSetTemperature':
|
|
180
176
|
deviceData.Device[key] = value;
|
|
181
177
|
effectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
182
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
183
178
|
break;
|
|
184
179
|
case 'FanSpeed':
|
|
185
180
|
deviceData.Device[key] = value;
|
|
186
181
|
effectiveFlags = AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
187
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
188
182
|
break;
|
|
189
183
|
case 'VaneHorizontalDirection':
|
|
190
184
|
deviceData.Device[key] = value;
|
|
191
185
|
effectiveFlags = AirConditioner.EffectiveFlags.VaneHorizontalDirection;
|
|
192
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
193
186
|
break;
|
|
194
187
|
case 'VaneVerticalDirection':
|
|
195
188
|
deviceData.Device[key] = value;
|
|
196
189
|
effectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalDirection;
|
|
197
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
198
190
|
break;
|
|
199
191
|
case 'HideVaneControls':
|
|
200
192
|
deviceData[key] = value;
|
|
201
193
|
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
202
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
203
194
|
break;
|
|
204
195
|
case 'HideDryModeControl':
|
|
205
196
|
deviceData[key] = value;
|
|
206
197
|
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
207
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
208
198
|
break;
|
|
209
199
|
case 'ProhibitSetTemperature':
|
|
210
200
|
deviceData.Device[key] = value;
|
|
211
201
|
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
212
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
213
202
|
break;
|
|
214
203
|
case 'ProhibitOperationMode':
|
|
215
204
|
deviceData.Device[key] = value;
|
|
216
205
|
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
217
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
218
206
|
break;
|
|
219
207
|
case 'ProhibitPower':
|
|
220
208
|
deviceData.Device[key] = value;
|
|
221
209
|
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
222
|
-
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
223
210
|
break;
|
|
224
211
|
default:
|
|
225
212
|
this.emit('warn', `${integration}, received key: ${key}, value: ${value}`);
|
|
226
213
|
break;
|
|
227
214
|
};
|
|
215
|
+
|
|
216
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
228
217
|
return set;
|
|
229
218
|
} catch (error) {
|
|
230
219
|
throw new Error(`${integration} set key: ${key}, value: ${value}, error: ${error.message ?? error}`);
|
package/src/deviceatw.js
CHANGED
|
@@ -159,96 +159,82 @@ class DeviceAtw extends EventEmitter {
|
|
|
159
159
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
160
160
|
try {
|
|
161
161
|
let set = false
|
|
162
|
+
let effectiveFlags = null;
|
|
162
163
|
switch (key) {
|
|
163
164
|
case 'Power':
|
|
164
165
|
deviceData.Device[key] = value;
|
|
165
|
-
|
|
166
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
166
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power;
|
|
167
167
|
break;
|
|
168
168
|
case 'OperationMode':
|
|
169
169
|
deviceData.Device[key] = value;
|
|
170
|
-
|
|
171
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
170
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationMode;
|
|
172
171
|
break;
|
|
173
172
|
case 'OperationModeZone1':
|
|
174
173
|
deviceData.Device[key] = value;
|
|
175
|
-
|
|
176
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
174
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone1;
|
|
177
175
|
break;
|
|
178
176
|
case 'OperationModeZone2':
|
|
179
177
|
deviceData.Device[key] = value;
|
|
180
|
-
|
|
181
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
178
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone2;
|
|
182
179
|
break;
|
|
183
180
|
case 'SetTemperatureZone1':
|
|
184
181
|
deviceData.Device[key] = value;
|
|
185
|
-
|
|
186
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
182
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTemperatureZone2;
|
|
187
183
|
break;
|
|
188
184
|
case 'SetTemperatureZone2':
|
|
189
185
|
deviceData.Device[key] = value;
|
|
190
|
-
|
|
191
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
186
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTemperatureZone2;
|
|
192
187
|
break;
|
|
193
188
|
case 'SetHeatFlowTemperatureZone1':
|
|
194
189
|
deviceData.Device[key] = value;
|
|
195
|
-
|
|
196
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
190
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetHeatFlowTemperatureZone1;
|
|
197
191
|
break;
|
|
198
192
|
case 'SetHeatFlowTemperatureZone2':
|
|
199
193
|
deviceData.Device[key] = value;
|
|
200
|
-
|
|
201
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
194
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetHeatFlowTemperatureZone2;
|
|
202
195
|
break;
|
|
203
196
|
case 'SetCoolFlowTemperatureZone1':
|
|
204
197
|
deviceData.Device[key] = value;
|
|
205
|
-
|
|
206
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
198
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetCoolFlowTemperatureZone1;
|
|
207
199
|
break;
|
|
208
200
|
case 'SetCoolFlowTemperatureZone2':
|
|
209
201
|
deviceData.Device[key] = value;
|
|
210
|
-
|
|
211
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
202
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetCoolFlowTemperatureZone2;
|
|
212
203
|
break;
|
|
213
204
|
case 'SetTankWaterTemperature':
|
|
214
205
|
deviceData.Device[key] = value;
|
|
215
|
-
|
|
216
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
206
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTankWaterTemperature;
|
|
217
207
|
break;
|
|
218
208
|
case 'ForcedHotWaterMode':
|
|
219
209
|
deviceData.Device[key] = value;
|
|
220
|
-
|
|
221
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
210
|
+
effectiveFlags = HeatPump.EffectiveFlags.ForcedHotWaterMode;
|
|
222
211
|
break;
|
|
223
212
|
case 'EcoHotWater':
|
|
224
213
|
deviceData.Device[key] = value;
|
|
225
|
-
|
|
226
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
214
|
+
effectiveFlags = HeatPump.EffectiveFlags.EcoHotWater;
|
|
227
215
|
break;
|
|
228
216
|
case 'HolidayMode':
|
|
229
217
|
deviceData.Device[key] = value;
|
|
230
|
-
|
|
231
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
218
|
+
effectiveFlags = HeatPump.EffectiveFlags.HolidayMode;
|
|
232
219
|
break;
|
|
233
220
|
case 'ProhibitZone1':
|
|
234
221
|
deviceData.Device[key] = value;
|
|
235
|
-
|
|
236
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
222
|
+
effectiveFlags = HeatPump.EffectiveFlags.ProhibitZone1;
|
|
237
223
|
break;
|
|
238
224
|
case 'ProhibitZone2':
|
|
239
225
|
deviceData.Device[key] = value;
|
|
240
|
-
|
|
241
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
226
|
+
effectiveFlags = HeatPump.EffectiveFlags.ProhibitZone2;
|
|
242
227
|
break;
|
|
243
228
|
case 'ProhibitHotWater':
|
|
244
229
|
deviceData.Device[key] = value;
|
|
245
|
-
|
|
246
|
-
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
230
|
+
effectiveFlags = HeatPump.EffectiveFlags.ProhibitHotWater;
|
|
247
231
|
break;
|
|
248
232
|
default:
|
|
249
233
|
this.emit('warn', `${integration}, received key: ${key}, value: ${value}`);
|
|
250
234
|
break;
|
|
251
235
|
};
|
|
236
|
+
|
|
237
|
+
set = await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
252
238
|
return set;
|
|
253
239
|
} catch (error) {
|
|
254
240
|
throw new Error(`${integration} set key: ${key}, value: ${value}, error: ${error.message ?? error}`);
|
|
@@ -320,12 +306,13 @@ class DeviceAtw extends EventEmitter {
|
|
|
320
306
|
return state;
|
|
321
307
|
})
|
|
322
308
|
.onSet(async (state) => {
|
|
309
|
+
if (!!state === deviceData.Device.Power) return;
|
|
310
|
+
|
|
323
311
|
try {
|
|
324
312
|
switch (i) {
|
|
325
313
|
case 0: //Heat Pump
|
|
326
|
-
deviceData.Device.Power =
|
|
327
|
-
|
|
328
|
-
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
314
|
+
deviceData.Device.Power = state ? true : false;
|
|
315
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, HeatPump.EffectiveFlags.Power);
|
|
329
316
|
if (this.logInfo) this.emit('info', `${zoneName}, Set power: ${state ? 'ON' : 'OFF'}`);
|
|
330
317
|
break;
|
|
331
318
|
};
|
|
@@ -351,22 +338,23 @@ class DeviceAtw extends EventEmitter {
|
|
|
351
338
|
.onSet(async (value) => {
|
|
352
339
|
try {
|
|
353
340
|
let operationModeText = '';
|
|
341
|
+
let effectiveFlags = null;
|
|
354
342
|
switch (i) {
|
|
355
343
|
case caseHeatPump: //Heat Pump - ON, HEAT, COOL
|
|
356
344
|
switch (value) {
|
|
357
345
|
case caseHeatPump: //AUTO
|
|
358
346
|
deviceData.Device.Power = true;
|
|
359
|
-
|
|
347
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power;
|
|
360
348
|
break;
|
|
361
349
|
case 1: //HEAT
|
|
362
350
|
deviceData.Device.Power = true;
|
|
363
351
|
deviceData.Device.UnitStatus = 0;
|
|
364
|
-
|
|
352
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
365
353
|
break;
|
|
366
354
|
case 2: //COOL
|
|
367
355
|
deviceData.Device.Power = true;
|
|
368
356
|
deviceData.Device.UnitStatus = 1;
|
|
369
|
-
|
|
357
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
370
358
|
break;
|
|
371
359
|
};
|
|
372
360
|
operationModeText = [HeatPump.System[0], HeatPump.System[deviceData.Device.UnitStatus]][this.accessory.power];
|
|
@@ -375,15 +363,15 @@ class DeviceAtw extends EventEmitter {
|
|
|
375
363
|
switch (value) {
|
|
376
364
|
case 0: //AUTO - HEAT CURVE
|
|
377
365
|
deviceData.Device.OperationModeZone1 = 2;
|
|
378
|
-
|
|
366
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone1;
|
|
379
367
|
break;
|
|
380
368
|
case 1: //HEAT - HEAT THERMOSTAT / COOL THERMOSTAT
|
|
381
369
|
deviceData.Device.OperationModeZone1 = [0, 3][this.unitStatus];
|
|
382
|
-
|
|
370
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone1;
|
|
383
371
|
break;
|
|
384
372
|
case 2: //COOL - HEAT FLOW / COOL FLOW
|
|
385
373
|
deviceData.Device.OperationModeZone1 = [1, 4][this.unitStatus];
|
|
386
|
-
|
|
374
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone1;
|
|
387
375
|
break;
|
|
388
376
|
};
|
|
389
377
|
operationModeText = HeatPump.ZoneOperation[deviceData.Device.OperationModeZone1];
|
|
@@ -392,15 +380,15 @@ class DeviceAtw extends EventEmitter {
|
|
|
392
380
|
switch (value) {
|
|
393
381
|
case 0: //AUTO
|
|
394
382
|
deviceData.Device.ForcedHotWaterMode = false;
|
|
395
|
-
|
|
383
|
+
effectiveFlags = HeatPump.EffectiveFlags.ForcedHotWaterMode;
|
|
396
384
|
break;
|
|
397
385
|
case 1: //HEAT
|
|
398
386
|
deviceData.Device.ForcedHotWaterMode = true;
|
|
399
|
-
|
|
387
|
+
effectiveFlags = HeatPump.EffectiveFlags.ForcedHotWaterMode;
|
|
400
388
|
break;
|
|
401
389
|
case 2: //COOL
|
|
402
390
|
deviceData.Device.ForcedHotWaterMode = false;
|
|
403
|
-
|
|
391
|
+
effectiveFlags = HeatPump.EffectiveFlags.ForcedHotWaterMode;
|
|
404
392
|
break
|
|
405
393
|
};
|
|
406
394
|
operationModeText = deviceData.Device.OperationMode === 1 ? HeatPump.ForceDhw[1] : HeatPump.ForceDhw[deviceData.Device.ForcedHotWaterMode ? 1 : 0];
|
|
@@ -409,22 +397,22 @@ class DeviceAtw extends EventEmitter {
|
|
|
409
397
|
switch (value) {
|
|
410
398
|
case 0: //AUTO
|
|
411
399
|
deviceData.Device.OperationModeZone2 = 2;
|
|
412
|
-
|
|
400
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone2;
|
|
413
401
|
break;
|
|
414
402
|
case 1: //HEAT - HEAT THERMOSTAT / COOL THERMOSTAT
|
|
415
403
|
deviceData.Device.OperationModeZone2 = [0, 3][this.unitStatus];
|
|
416
|
-
|
|
404
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone2;
|
|
417
405
|
break;
|
|
418
406
|
case 2: //COOL - HEAT FLOW / COOL FLOW
|
|
419
407
|
deviceData.Device.OperationModeZone2 = [1, 4][this.unitStatus];
|
|
420
|
-
|
|
408
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone2;
|
|
421
409
|
break;
|
|
422
410
|
};
|
|
423
411
|
operationModeText = HeatPump.ZoneOperation[deviceData.Device.OperationModeZone2];
|
|
424
412
|
break;
|
|
425
413
|
};
|
|
426
414
|
|
|
427
|
-
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
415
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
428
416
|
if (this.logInfo) this.emit('info', `${zoneName}, Set operation mode: ${operationModeText}`);
|
|
429
417
|
} catch (error) {
|
|
430
418
|
if (this.logWarn) this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
@@ -454,51 +442,52 @@ class DeviceAtw extends EventEmitter {
|
|
|
454
442
|
})
|
|
455
443
|
.onSet(async (value) => {
|
|
456
444
|
try {
|
|
445
|
+
let effectiveFlags = null;
|
|
457
446
|
switch (i) {
|
|
458
447
|
case caseHeatPump: //Heat Pump
|
|
459
448
|
//deviceData.Device.SetTemperatureZone1 = value;
|
|
460
|
-
//
|
|
449
|
+
//effectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetTemperatureZone1;
|
|
461
450
|
break;
|
|
462
451
|
case caseZone1: //Zone 1
|
|
463
452
|
switch (zone.operationMode) {
|
|
464
453
|
case 1: //HEAT FLOW
|
|
465
454
|
deviceData.Device.SetHeatFlowTemperatureZone1 = value;
|
|
466
|
-
|
|
455
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetHeatFlowTemperatureZone1;
|
|
467
456
|
break;
|
|
468
457
|
case 4: //COOL FLOW
|
|
469
458
|
deviceData.Device.SetCoolFlowTemperatureZone1 = value;
|
|
470
|
-
|
|
459
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetCoolFlowTemperatureZone1;
|
|
471
460
|
break;
|
|
472
461
|
default:
|
|
473
462
|
deviceData.Device.SetTemperatureZone1 = value;
|
|
474
|
-
|
|
463
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTemperatureZone1;
|
|
475
464
|
break
|
|
476
465
|
};
|
|
477
466
|
break;
|
|
478
467
|
case caseHotWater: //Hot Water
|
|
479
468
|
deviceData.Device.SetTankWaterTemperature = value;
|
|
480
|
-
|
|
469
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTankWaterTemperature;
|
|
481
470
|
break;
|
|
482
471
|
case caseZone2: //Zone 2
|
|
483
472
|
switch (zone.operationMode) {
|
|
484
473
|
case 1: //HEAT FLOW
|
|
485
474
|
deviceData.Device.SetHeatFlowTemperatureZone2 = value;
|
|
486
|
-
|
|
475
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetHeatFlowTemperatureZone2;
|
|
487
476
|
break;
|
|
488
477
|
case 4: //COOL FLOW
|
|
489
478
|
deviceData.Device.SetCoolFlowTemperatureZone2 = value;
|
|
490
|
-
|
|
479
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetCoolFlowTemperatureZone2;
|
|
491
480
|
break;
|
|
492
481
|
default:
|
|
493
482
|
deviceData.Device.SetTemperatureZone2 = value;
|
|
494
|
-
|
|
483
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTemperatureZone2;
|
|
495
484
|
break
|
|
496
485
|
};
|
|
497
486
|
break;
|
|
498
487
|
};
|
|
499
488
|
|
|
500
|
-
|
|
501
|
-
|
|
489
|
+
if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
490
|
+
if (this.logInfo && i !== 0) this.emit('info', `${zoneName}, Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
502
491
|
} catch (error) {
|
|
503
492
|
if (this.logWarn) this.emit('warn', `${zoneName}, Set cooling threshold temperature error: ${error}`);
|
|
504
493
|
};
|
|
@@ -518,51 +507,52 @@ class DeviceAtw extends EventEmitter {
|
|
|
518
507
|
})
|
|
519
508
|
.onSet(async (value) => {
|
|
520
509
|
try {
|
|
510
|
+
let effectiveFlags = null;
|
|
521
511
|
switch (i) {
|
|
522
512
|
case caseHeatPump: //Heat Pump
|
|
523
513
|
//deviceData.Device.SetTemperatureZone1 = value;
|
|
524
|
-
//
|
|
514
|
+
//effectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetTemperatureZone1;
|
|
525
515
|
break;
|
|
526
516
|
case caseZone1: //Zone 1
|
|
527
517
|
switch (zone.operationMode) {
|
|
528
518
|
case 1: //HEAT FLOW
|
|
529
519
|
deviceData.Device.SetHeatFlowTemperatureZone1 = value;
|
|
530
|
-
|
|
520
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetHeatFlowTemperatureZone1;
|
|
531
521
|
break;
|
|
532
522
|
case 4: //COOL FLOW
|
|
533
523
|
deviceData.Device.SetCoolFlowTemperatureZone1 = value;
|
|
534
|
-
|
|
524
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetCoolFlowTemperatureZone1;
|
|
535
525
|
break;
|
|
536
526
|
default:
|
|
537
527
|
deviceData.Device.SetTemperatureZone1 = value;
|
|
538
|
-
|
|
528
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTemperatureZone1;
|
|
539
529
|
break
|
|
540
530
|
};
|
|
541
531
|
break;
|
|
542
532
|
case caseHotWater: //Hot Water
|
|
543
533
|
deviceData.Device.SetTankWaterTemperature = value;
|
|
544
|
-
|
|
534
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTankWaterTemperature;
|
|
545
535
|
break;
|
|
546
536
|
case caseZone2: //Zone 2
|
|
547
537
|
switch (zone.operationMode) {
|
|
548
538
|
case 1: //HEAT FLOW
|
|
549
539
|
deviceData.Device.SetHeatFlowTemperatureZone2 = value;
|
|
550
|
-
|
|
540
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetHeatFlowTemperatureZone2;
|
|
551
541
|
break;
|
|
552
542
|
case 4: //COOL FLOW
|
|
553
543
|
deviceData.Device.SetCoolFlowTemperatureZone2 = value;
|
|
554
|
-
|
|
544
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetCoolFlowTemperatureZone2;
|
|
555
545
|
break;
|
|
556
546
|
default:
|
|
557
547
|
deviceData.Device.SetTemperatureZone2 = value;
|
|
558
|
-
|
|
548
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTemperatureZone2;
|
|
559
549
|
break
|
|
560
550
|
};
|
|
561
551
|
break;
|
|
562
552
|
};
|
|
563
553
|
|
|
564
|
-
|
|
565
|
-
|
|
554
|
+
if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
555
|
+
if (this.logInfo && i !== 0) this.emit('info', `${zoneName}, Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
566
556
|
} catch (error) {
|
|
567
557
|
if (this.logWarn) this.emit('warn', `${zoneName}, Set heating threshold temperature error: ${error}`);
|
|
568
558
|
};
|
|
@@ -647,26 +637,27 @@ class DeviceAtw extends EventEmitter {
|
|
|
647
637
|
.onSet(async (value) => {
|
|
648
638
|
try {
|
|
649
639
|
let operationModeText = '';
|
|
640
|
+
let effectiveFlags = null;
|
|
650
641
|
switch (i) {
|
|
651
642
|
case caseHeatPump: //Heat Pump - HEAT, COOL
|
|
652
643
|
switch (value) {
|
|
653
644
|
case 0: //OFF
|
|
654
645
|
deviceData.Device.Power = false;
|
|
655
|
-
|
|
646
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power;
|
|
656
647
|
break;
|
|
657
648
|
case 1: //HEAT
|
|
658
649
|
deviceData.Device.Power = true;
|
|
659
650
|
deviceData.Device.UnitStatus = 0;
|
|
660
|
-
|
|
651
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
661
652
|
break;
|
|
662
653
|
case 2: //COOL
|
|
663
654
|
deviceData.Device.Power = true;
|
|
664
655
|
deviceData.Device.UnitStatus = 1;
|
|
665
|
-
|
|
656
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
666
657
|
break;
|
|
667
658
|
case 3: //AUTO
|
|
668
659
|
deviceData.Device.Power = true;
|
|
669
|
-
|
|
660
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power;
|
|
670
661
|
break;
|
|
671
662
|
};
|
|
672
663
|
operationModeText = [HeatPump.System[0], HeatPump.System[deviceData.Device.UnitStatus]][this.accessory.power];
|
|
@@ -675,19 +666,19 @@ class DeviceAtw extends EventEmitter {
|
|
|
675
666
|
switch (value) {
|
|
676
667
|
case 0: //OFF - HEAT CURVE
|
|
677
668
|
deviceData.Device.OperationModeZone1 = 2;
|
|
678
|
-
|
|
669
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone1;
|
|
679
670
|
break;
|
|
680
671
|
case 1: //HEAT - HEAT THERMOSTAT / COOL THERMOSTAT
|
|
681
672
|
deviceData.Device.OperationModeZone1 = [0, 3][this.unitStatus];
|
|
682
|
-
|
|
673
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone1;
|
|
683
674
|
break;
|
|
684
675
|
case 2: //COOL - HEAT FLOW / COOL FLOW
|
|
685
676
|
deviceData.Device.OperationModeZone1 = [1, 4][this.unitStatus];
|
|
686
|
-
|
|
677
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone1;
|
|
687
678
|
break;
|
|
688
679
|
case 3: //AUTO - HEAT CURVE
|
|
689
680
|
deviceData.Device.OperationModeZone1 = 2;
|
|
690
|
-
|
|
681
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone1;
|
|
691
682
|
break;
|
|
692
683
|
};
|
|
693
684
|
operationModeText = HeatPump.ZoneOperation[deviceData.Device.OperationModeZone1];
|
|
@@ -696,19 +687,19 @@ class DeviceAtw extends EventEmitter {
|
|
|
696
687
|
switch (value) {
|
|
697
688
|
case 0: //OFF
|
|
698
689
|
deviceData.Device.ForcedHotWaterMode = false;
|
|
699
|
-
|
|
690
|
+
effectiveFlags = HeatPump.EffectiveFlags.ForcedHotWaterMode;
|
|
700
691
|
break;
|
|
701
692
|
case 1: //HEAT
|
|
702
693
|
deviceData.Device.ForcedHotWaterMode = true;
|
|
703
|
-
|
|
694
|
+
effectiveFlags = HeatPump.EffectiveFlags.ForcedHotWaterMode;
|
|
704
695
|
break;
|
|
705
696
|
case 2: //COOL
|
|
706
697
|
deviceData.Device.ForcedHotWaterMode = false;
|
|
707
|
-
|
|
698
|
+
effectiveFlags = HeatPump.EffectiveFlags.ForcedHotWaterMode;
|
|
708
699
|
break;
|
|
709
700
|
case 3: //AUTO
|
|
710
701
|
deviceData.Device.ForcedHotWaterMode = false;
|
|
711
|
-
|
|
702
|
+
effectiveFlags = HeatPump.EffectiveFlags.ForcedHotWaterMode;
|
|
712
703
|
break;
|
|
713
704
|
};
|
|
714
705
|
operationModeText = deviceData.Device.OperationMode === 1 ? HeatPump.ForceDhw[1] : HeatPump.ForceDhw[deviceData.Device.ForcedHotWaterMode ? 1 : 0];
|
|
@@ -717,26 +708,26 @@ class DeviceAtw extends EventEmitter {
|
|
|
717
708
|
switch (value) {
|
|
718
709
|
case 0: //OFF - HEAT CURVE
|
|
719
710
|
deviceData.Device.OperationModeZone2 = 2;
|
|
720
|
-
|
|
711
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone2;
|
|
721
712
|
break;
|
|
722
713
|
case 1: //HEAT - HEAT THERMOSTAT / COOL THERMOSTAT
|
|
723
714
|
deviceData.Device.OperationModeZone2 = [0, 3][this.unitStatus];
|
|
724
|
-
|
|
715
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone2;
|
|
725
716
|
break;
|
|
726
717
|
case 2: //COOL - HEAT FLOW / COOL FLOW
|
|
727
718
|
deviceData.Device.OperationModeZone2 = [1, 4][this.unitStatus];
|
|
728
|
-
|
|
719
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone2;
|
|
729
720
|
break;
|
|
730
721
|
case 3: //AUTO - HEAT CURVE
|
|
731
722
|
deviceData.Device.OperationModeZone2 = 2;
|
|
732
|
-
|
|
723
|
+
effectiveFlags = HeatPump.EffectiveFlags.OperationModeZone2;
|
|
733
724
|
break;
|
|
734
725
|
};
|
|
735
726
|
operationModeText = HeatPump.ZoneOperation[deviceData.Device.OperationModeZone2];
|
|
736
727
|
break;
|
|
737
728
|
};
|
|
738
729
|
|
|
739
|
-
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
730
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
740
731
|
if (this.logInfo) this.emit('info', `${zoneName}, Set operation mode: ${operationModeText}`);
|
|
741
732
|
} catch (error) {
|
|
742
733
|
if (this.logWarn) this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
|
|
@@ -764,27 +755,28 @@ class DeviceAtw extends EventEmitter {
|
|
|
764
755
|
})
|
|
765
756
|
.onSet(async (value) => {
|
|
766
757
|
try {
|
|
758
|
+
let effectiveFlags = null;
|
|
767
759
|
switch (i) {
|
|
768
760
|
case caseHeatPump: //Heat Pump
|
|
769
761
|
//deviceData.Device.SetTemperatureZone1 = value;
|
|
770
|
-
//
|
|
762
|
+
//effectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetTemperatureZone1;
|
|
771
763
|
break;
|
|
772
764
|
case caseZone1: //Zone 1
|
|
773
765
|
deviceData.Device.SetTemperatureZone1 = value;
|
|
774
|
-
|
|
766
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTemperatureZone1;
|
|
775
767
|
break;
|
|
776
768
|
case caseHotWater: //Hot Water
|
|
777
769
|
deviceData.Device.SetTankWaterTemperature = value;
|
|
778
|
-
|
|
770
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTankWaterTemperature;
|
|
779
771
|
break;
|
|
780
772
|
case caseZone2: //Zone 2
|
|
781
773
|
deviceData.Device.SetTemperatureZone2 = value;
|
|
782
|
-
|
|
774
|
+
effectiveFlags = HeatPump.EffectiveFlags.SetTemperatureZone2;
|
|
783
775
|
break;
|
|
784
776
|
};
|
|
785
777
|
|
|
786
|
-
|
|
787
|
-
|
|
778
|
+
if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
779
|
+
if (this.logInfo && i !== 0) this.emit('info', `${zoneName}, Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
788
780
|
} catch (error) {
|
|
789
781
|
if (this.logWarn) this.emit('warn', `${zoneName}, Set temperature error: ${error}`);
|
|
790
782
|
};
|
|
@@ -1085,7 +1077,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
1085
1077
|
deviceData.Device.SetHeatFlowTemperatureZone2 = presetData.SetHeatFlowTemperatureZone2;
|
|
1086
1078
|
deviceData.Device.SetCoolFlowTemperatureZone1 = presetData.SetCoolFlowTemperatureZone1;
|
|
1087
1079
|
deviceData.Device.SetCoolFlowTemperatureZone2 = presetData.SetCoolFlowTemperatureZone2;
|
|
1088
|
-
deviceData.Device.EffectiveFlags = HeatPump.EffectiveFlags.Power;
|
|
1089
1080
|
break;
|
|
1090
1081
|
case false:
|
|
1091
1082
|
deviceData.Device.Power = preset.previousSettings.Power;
|
|
@@ -1100,11 +1091,10 @@ class DeviceAtw extends EventEmitter {
|
|
|
1100
1091
|
deviceData.Device.SetHeatFlowTemperatureZone2 = preset.previousSettings.SetHeatFlowTemperatureZone2;
|
|
1101
1092
|
deviceData.Device.SetCoolFlowTemperatureZone1 = preset.previousSettings.SetCoolFlowTemperatureZone1;
|
|
1102
1093
|
deviceData.Device.SetCoolFlowTemperatureZone2 = preset.previousSettings.SetCoolFlowTemperatureZone2;
|
|
1103
|
-
deviceData.Device.EffectiveFlags = HeatPump.EffectiveFlags.Power;
|
|
1104
1094
|
break;
|
|
1105
1095
|
};
|
|
1106
1096
|
|
|
1107
|
-
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
1097
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, HeatPump.EffectiveFlags.Power);
|
|
1108
1098
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
1109
1099
|
} catch (error) {
|
|
1110
1100
|
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
@@ -1146,122 +1136,123 @@ class DeviceAtw extends EventEmitter {
|
|
|
1146
1136
|
.onSet(async (state) => {
|
|
1147
1137
|
if (displayType > 0 && displayType < 3) {
|
|
1148
1138
|
try {
|
|
1139
|
+
let effectiveFlags = null;
|
|
1149
1140
|
switch (mode) {
|
|
1150
1141
|
case 0: //POWER ON,OFF
|
|
1151
1142
|
deviceData.Device.Power = state;
|
|
1152
|
-
|
|
1143
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power;
|
|
1153
1144
|
break;
|
|
1154
1145
|
case 1: //HEAT PUMP HEAT
|
|
1155
1146
|
button.previousValue = state ? deviceData.Device.UnitStatus : button.previousValue ?? deviceData.Device.UnitStatus;
|
|
1156
1147
|
deviceData.Device.Power = true;
|
|
1157
1148
|
deviceData.Device.UnitStatus = state ? 0 : button.previousValue;
|
|
1158
|
-
|
|
1149
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
1159
1150
|
break;
|
|
1160
1151
|
case 2: //COOL
|
|
1161
1152
|
button.previousValue = state ? deviceData.Device.UnitStatus : button.previousValue ?? deviceData.Device.UnitStatus;
|
|
1162
1153
|
deviceData.Device.Power = true;
|
|
1163
1154
|
deviceData.Device.UnitStatus = state ? 1 : button.previousValue;
|
|
1164
|
-
|
|
1155
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationMode;
|
|
1165
1156
|
break;
|
|
1166
1157
|
case 3: //HOLIDAY
|
|
1167
1158
|
deviceData.Device.HolidayMode = state;
|
|
1168
|
-
|
|
1159
|
+
effectiveFlags = HeatPump.EffectiveFlags.HolidayMode;
|
|
1169
1160
|
break;
|
|
1170
1161
|
case 10: //ALL ZONES PHYSICAL LOCK CONTROL
|
|
1171
1162
|
deviceData.Device.ProhibitZone1 = state;
|
|
1172
1163
|
deviceData.Device.ProhibitHotWater = state;
|
|
1173
1164
|
deviceData.Device.ProhibitZone2 = state;
|
|
1174
|
-
|
|
1165
|
+
effectiveFlags = HeatPump.EffectiveFlags.ProhibitHeatingZone1 + HeatPump.EffectiveFlags.ProhibitHotWater + HeatPump.EffectiveFlags.ProhibitHeatingZone2;
|
|
1175
1166
|
break;
|
|
1176
1167
|
case 20: //ZONE 1 HEAT THERMOSTAT
|
|
1177
1168
|
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1178
1169
|
deviceData.Device.Power = true;
|
|
1179
1170
|
deviceData.Device.OperationModeZone1 = state ? 0 : button.previousValue;
|
|
1180
|
-
|
|
1171
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1181
1172
|
break;
|
|
1182
1173
|
case 21: //HEAT FLOW
|
|
1183
1174
|
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1184
1175
|
deviceData.Device.Power = true;
|
|
1185
1176
|
deviceData.Device.OperationModeZone1 = state ? 1 : button.previousValue;
|
|
1186
|
-
|
|
1177
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1187
1178
|
break;
|
|
1188
1179
|
case 22: //HEAT CURVE
|
|
1189
1180
|
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1190
1181
|
deviceData.Device.Power = true;
|
|
1191
1182
|
deviceData.Device.OperationModeZone1 = state ? 2 : button.previousValue;
|
|
1192
|
-
|
|
1183
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1193
1184
|
break;
|
|
1194
1185
|
case 23: //COOL THERMOSTAT
|
|
1195
1186
|
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1196
1187
|
deviceData.Device.Power = true;
|
|
1197
1188
|
deviceData.Device.OperationModeZone1 = state ? 3 : button.previousValue;
|
|
1198
|
-
|
|
1189
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1199
1190
|
break;
|
|
1200
1191
|
case 24: //COOL FLOW
|
|
1201
1192
|
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1202
1193
|
deviceData.Device.Power = true;
|
|
1203
1194
|
deviceData.Device.OperationModeZone1 = state ? 4 : button.previousValue;
|
|
1204
|
-
|
|
1195
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1205
1196
|
break;
|
|
1206
1197
|
case 25: //FLOOR DRY UP
|
|
1207
1198
|
button.previousValue = state ? deviceData.Device.OperationModeZone1 : button.previousValue ?? deviceData.Device.OperationModeZone1;
|
|
1208
1199
|
deviceData.Device.Power = true;
|
|
1209
1200
|
deviceData.Device.OperationModeZone1 = state ? 5 : button.previousValue;
|
|
1210
|
-
|
|
1201
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone1;
|
|
1211
1202
|
break;
|
|
1212
1203
|
case 30: //PHYSICAL LOCK CONTROL
|
|
1213
1204
|
deviceData.Device.ProhibitZone1 = state;
|
|
1214
|
-
HeatPump.EffectiveFlags.ProhibitHeatingZone1;
|
|
1205
|
+
effectiveFlags = HeatPump.EffectiveFlags.ProhibitHeatingZone1;
|
|
1215
1206
|
break;
|
|
1216
1207
|
case 40: //HOT WATER NORMAL/FORCE HOT WATER
|
|
1217
1208
|
deviceData.Device.Power = true;
|
|
1218
1209
|
deviceData.Device.ForcedHotWaterMode = state;
|
|
1219
|
-
|
|
1210
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.ForcedHotWaterMode;
|
|
1220
1211
|
break;
|
|
1221
1212
|
case 41: //NORMAL/ECO
|
|
1222
1213
|
deviceData.Device.Power = true;
|
|
1223
1214
|
deviceData.Device.EcoHotWater = state;
|
|
1224
|
-
|
|
1215
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.EcoHotWater;
|
|
1225
1216
|
break;
|
|
1226
1217
|
case 50: //PHYSICAL LOCK CONTROL
|
|
1227
1218
|
deviceData.Device.ProhibitHotWater = state;
|
|
1228
|
-
HeatPump.EffectiveFlags.ProhibitHotWater;
|
|
1219
|
+
effectiveFlags = HeatPump.EffectiveFlags.ProhibitHotWater;
|
|
1229
1220
|
break;
|
|
1230
1221
|
case 60: //ZONE 2 HEAT THERMOSTAT
|
|
1231
1222
|
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1232
1223
|
deviceData.Device.Power = true;
|
|
1233
1224
|
deviceData.Device.OperationModeZone2 = state ? 0 : button.previousValue;
|
|
1234
|
-
|
|
1225
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1235
1226
|
break;
|
|
1236
1227
|
case 61: // HEAT FLOW
|
|
1237
1228
|
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1238
1229
|
deviceData.Device.Power = true;
|
|
1239
1230
|
deviceData.Device.OperationModeZone2 = state ? 1 : button.previousValue;
|
|
1240
|
-
|
|
1231
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1241
1232
|
break;
|
|
1242
1233
|
case 62: //HEAT CURVE
|
|
1243
1234
|
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1244
1235
|
deviceData.Device.Power = true;
|
|
1245
1236
|
deviceData.Device.OperationModeZone2 = state ? 2 : button.previousValue;
|
|
1246
|
-
|
|
1237
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1247
1238
|
break;
|
|
1248
1239
|
case 63: //COOL THERMOSTAT
|
|
1249
1240
|
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1250
1241
|
deviceData.Device.Power = true;
|
|
1251
1242
|
deviceData.Device.OperationModeZone2 = state ? 3 : button.previousValue;
|
|
1252
|
-
|
|
1243
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1253
1244
|
break;
|
|
1254
1245
|
case 64: //COOL FLOW
|
|
1255
1246
|
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1256
1247
|
deviceData.Device.Power = true;
|
|
1257
1248
|
deviceData.Device.OperationModeZone2 = state ? 4 : button.previousValue;
|
|
1258
|
-
|
|
1249
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1259
1250
|
break;
|
|
1260
1251
|
case 65: //FLOOR DRY UP
|
|
1261
1252
|
button.previousValue = state ? deviceData.Device.OperationModeZone2 : button.previousValue ?? deviceData.Device.OperationModeZone2;
|
|
1262
1253
|
deviceData.Device.Power = true;
|
|
1263
1254
|
deviceData.Device.OperationModeZone2 = state ? 5 : button.previousValue;
|
|
1264
|
-
|
|
1255
|
+
effectiveFlags = HeatPump.EffectiveFlags.Power + HeatPump.EffectiveFlags.OperationModeZone2;
|
|
1265
1256
|
break;
|
|
1266
1257
|
case 70: //PHYSICAL LOCK CONTROL
|
|
1267
1258
|
deviceData.Device.ProhibitZone2 = state;
|
|
@@ -1272,7 +1263,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1272
1263
|
break;
|
|
1273
1264
|
};
|
|
1274
1265
|
|
|
1275
|
-
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
|
|
1266
|
+
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
1276
1267
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
|
|
1277
1268
|
} catch (error) {
|
|
1278
1269
|
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
package/src/deviceerv.js
CHANGED
|
@@ -152,66 +152,58 @@ class DeviceErv extends EventEmitter {
|
|
|
152
152
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
153
153
|
try {
|
|
154
154
|
let set = false
|
|
155
|
+
let effectiveFlags = null;
|
|
155
156
|
switch (key) {
|
|
156
157
|
case 'Power':
|
|
157
158
|
deviceData.Device[key] = value;
|
|
158
|
-
|
|
159
|
-
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
159
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power;
|
|
160
160
|
break;
|
|
161
161
|
case 'OperationMode':
|
|
162
162
|
deviceData.Device[key] = value;
|
|
163
|
-
|
|
164
|
-
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
163
|
+
effectiveFlags = Ventilation.EffectiveFlags.OperationMode;
|
|
165
164
|
break;
|
|
166
165
|
case 'VentilationMode':
|
|
167
166
|
deviceData.Device[key] = value;
|
|
168
|
-
|
|
169
|
-
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
167
|
+
effectiveFlags = Ventilation.EffectiveFlags.VentilationMode;
|
|
170
168
|
break;
|
|
171
169
|
case 'SetTemperature':
|
|
172
170
|
deviceData.Device[key] = value;
|
|
173
|
-
|
|
174
|
-
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
171
|
+
effectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
175
172
|
break;
|
|
176
173
|
case 'DefaultCoolingSetTemperature':
|
|
177
174
|
deviceData.Device[key] = value;
|
|
178
|
-
|
|
179
|
-
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
175
|
+
effectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
180
176
|
break;
|
|
181
177
|
case 'DefaultHeatingSetTemperature':
|
|
182
178
|
deviceData.Device[key] = value;
|
|
183
|
-
|
|
184
|
-
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
179
|
+
effectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
185
180
|
break;
|
|
186
181
|
case 'NightPurgeMode':
|
|
187
182
|
deviceData.Device[key] = value;
|
|
188
|
-
|
|
189
|
-
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
183
|
+
effectiveFlags = Ventilation.EffectiveFlags.NightPurgeMode;
|
|
190
184
|
break;
|
|
191
185
|
case 'SetFanSpeed':
|
|
192
186
|
deviceData.Device[key] = value;
|
|
193
|
-
|
|
194
|
-
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
187
|
+
effectiveFlags = Ventilation.EffectiveFlags.SetFanSpeed;
|
|
195
188
|
break;
|
|
196
189
|
case 'HideRoomTemperature':
|
|
197
190
|
deviceData[key] = value;
|
|
198
|
-
|
|
199
|
-
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
191
|
+
effectiveFlags = Ventilation.EffectiveFlags.Prohibit;
|
|
200
192
|
break;
|
|
201
193
|
case 'HideSupplyTemperature':
|
|
202
194
|
deviceData[key] = value;
|
|
203
|
-
|
|
204
|
-
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
195
|
+
effectiveFlags = Ventilation.EffectiveFlags.Prohibit;
|
|
205
196
|
break;
|
|
206
197
|
case 'HideOutdoorTemperature':
|
|
207
198
|
deviceData[key] = value;
|
|
208
|
-
|
|
209
|
-
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
199
|
+
effectiveFlags = Ventilation.EffectiveFlags.Prohibit;
|
|
210
200
|
break;
|
|
211
201
|
default:
|
|
212
202
|
this.emit('warn', `${integration}, received key: ${key}, value: ${value}`);
|
|
213
203
|
break;
|
|
214
204
|
};
|
|
205
|
+
|
|
206
|
+
set = await this.melCloudErv.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
215
207
|
return set;
|
|
216
208
|
} catch (error) {
|
|
217
209
|
throw new Error(`${integration} set key: ${key}, value: ${value}, error: ${error.message ?? error}`);
|
|
@@ -278,10 +270,11 @@ class DeviceErv extends EventEmitter {
|
|
|
278
270
|
return state;
|
|
279
271
|
})
|
|
280
272
|
.onSet(async (state) => {
|
|
273
|
+
if (!!state === deviceData.Device.Power) return;
|
|
274
|
+
|
|
281
275
|
try {
|
|
282
|
-
deviceData.Device.Power =
|
|
283
|
-
|
|
284
|
-
await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
276
|
+
deviceData.Device.Power = state ? true : false;
|
|
277
|
+
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.Power);
|
|
285
278
|
if (this.logInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
286
279
|
} catch (error) {
|
|
287
280
|
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
@@ -316,8 +309,7 @@ class DeviceErv extends EventEmitter {
|
|
|
316
309
|
break;
|
|
317
310
|
};
|
|
318
311
|
|
|
319
|
-
|
|
320
|
-
await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
312
|
+
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.VentilationMode);
|
|
321
313
|
const operationModeText = Ventilation.VentilationMode[deviceData.Device.VentilationMode];
|
|
322
314
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
323
315
|
} catch (error) {
|
|
@@ -360,8 +352,7 @@ class DeviceErv extends EventEmitter {
|
|
|
360
352
|
deviceData.Device.SetFanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
|
|
361
353
|
break;;
|
|
362
354
|
};
|
|
363
|
-
|
|
364
|
-
await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
355
|
+
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetFanSpeed);
|
|
365
356
|
if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeed[fanSpeedModeText]}`);
|
|
366
357
|
} catch (error) {
|
|
367
358
|
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
@@ -382,8 +373,7 @@ class DeviceErv extends EventEmitter {
|
|
|
382
373
|
.onSet(async (value) => {
|
|
383
374
|
try {
|
|
384
375
|
deviceData.Device.DefaultCoolingSetTemperature = value;
|
|
385
|
-
|
|
386
|
-
await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
376
|
+
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetTemperature);
|
|
387
377
|
if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
388
378
|
} catch (error) {
|
|
389
379
|
if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
@@ -405,8 +395,7 @@ class DeviceErv extends EventEmitter {
|
|
|
405
395
|
.onSet(async (value) => {
|
|
406
396
|
try {
|
|
407
397
|
deviceData.Device.DefaultHeatingSetTemperature = value;
|
|
408
|
-
|
|
409
|
-
await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
398
|
+
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetTemperature);
|
|
410
399
|
if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
411
400
|
} catch (error) {
|
|
412
401
|
if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
@@ -423,8 +412,7 @@ class DeviceErv extends EventEmitter {
|
|
|
423
412
|
// try {
|
|
424
413
|
// value = value ? true : false;
|
|
425
414
|
// deviceData.Device = deviceData.Device;
|
|
426
|
-
//
|
|
427
|
-
// await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
415
|
+
// await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.Prohibit);
|
|
428
416
|
// if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
429
417
|
// } catch (error) {
|
|
430
418
|
// if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
@@ -470,29 +458,30 @@ class DeviceErv extends EventEmitter {
|
|
|
470
458
|
})
|
|
471
459
|
.onSet(async (value) => {
|
|
472
460
|
try {
|
|
461
|
+
let effectiveFlags = null;
|
|
473
462
|
switch (value) {
|
|
474
463
|
case 0: //OFF - POWER OFF
|
|
475
464
|
deviceData.Device.Power = false;
|
|
476
|
-
|
|
465
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power;
|
|
477
466
|
break;
|
|
478
467
|
case 1: //HEAT - LOSSNAY
|
|
479
468
|
deviceData.Device.Power = true;
|
|
480
469
|
deviceData.Device.VentilationMode = 0;
|
|
481
|
-
|
|
470
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.VentilationMode;
|
|
482
471
|
break;
|
|
483
472
|
case 2: //COOL - BYPASS
|
|
484
473
|
deviceData.Device.Power = true;
|
|
485
474
|
deviceData.Device.VentilationMode = hasBypassVentilationMode ? 1 : 0;
|
|
486
|
-
|
|
475
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.VentilationMode;
|
|
487
476
|
break;
|
|
488
477
|
case 3: //AUTO - AUTO
|
|
489
478
|
deviceData.Device.Power = true;
|
|
490
479
|
deviceData.Device.VentilationMode = hasAutoVentilationMode ? 2 : 0;
|
|
491
|
-
|
|
480
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.VentilationMode;
|
|
492
481
|
break;
|
|
493
482
|
};
|
|
494
483
|
|
|
495
|
-
await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
484
|
+
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
496
485
|
const operationModeText = Ventilation.VentilationMode[deviceData.Device.VentilationMode];
|
|
497
486
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
498
487
|
} catch (error) {
|
|
@@ -517,8 +506,7 @@ class DeviceErv extends EventEmitter {
|
|
|
517
506
|
.onSet(async (value) => {
|
|
518
507
|
try {
|
|
519
508
|
deviceData.Device.SetTemperature = value;
|
|
520
|
-
|
|
521
|
-
await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
509
|
+
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetTemperature);
|
|
522
510
|
if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
523
511
|
} catch (error) {
|
|
524
512
|
if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
|
|
@@ -700,7 +688,6 @@ class DeviceErv extends EventEmitter {
|
|
|
700
688
|
deviceData.Device.OperationMode = presetData.OperationMode;
|
|
701
689
|
deviceData.Device.VentilationMode = presetData.VentilationMode;
|
|
702
690
|
deviceData.Device.SetFanSpeed = presetData.FanSpeed;
|
|
703
|
-
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.Power;
|
|
704
691
|
break;
|
|
705
692
|
case false:
|
|
706
693
|
deviceData.Device.SetTemperature = preset.previousSettings.SetTemperature;
|
|
@@ -708,11 +695,10 @@ class DeviceErv extends EventEmitter {
|
|
|
708
695
|
deviceData.Device.OperationMode = preset.previousSettings.OperationMode;
|
|
709
696
|
deviceData.Device.VentilationMode = preset.previousSettings.VentilationMode;
|
|
710
697
|
deviceData.Device.SetFanSpeed = preset.previousSettings.FanSpeed;
|
|
711
|
-
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.Power;
|
|
712
698
|
break;
|
|
713
699
|
};
|
|
714
700
|
|
|
715
|
-
await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
701
|
+
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.Power);
|
|
716
702
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
717
703
|
} catch (error) {
|
|
718
704
|
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
@@ -750,67 +736,68 @@ class DeviceErv extends EventEmitter {
|
|
|
750
736
|
})
|
|
751
737
|
.onSet(async (state) => {
|
|
752
738
|
try {
|
|
739
|
+
let effectiveFlags = null;
|
|
753
740
|
switch (mode) {
|
|
754
741
|
case 0: //POWER ON,OFF
|
|
755
742
|
deviceData.Device.Power = state;
|
|
756
|
-
|
|
743
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power;
|
|
757
744
|
break;
|
|
758
745
|
case 1: //OPERATING MODE RECOVERY
|
|
759
746
|
button.previousValue = state ? deviceData.Device.VentilationMode : button.previousValue ?? deviceData.Device.VentilationMode;
|
|
760
747
|
deviceData.Device.Power = true;
|
|
761
748
|
deviceData.Device.VentilationMode = state ? 0 : button.previousValue;
|
|
762
|
-
|
|
749
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.VentilationMode;
|
|
763
750
|
break;
|
|
764
751
|
case 2: //OPERATING MODE BYPASS
|
|
765
752
|
button.previousValue = state ? deviceData.Device.VentilationMode : button.previousValue ?? deviceData.Device.VentilationMode;
|
|
766
753
|
deviceData.Device.Power = true;
|
|
767
754
|
deviceData.Device.VentilationMode = state ? 1 : button.previousValue;
|
|
768
|
-
|
|
755
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.VentilationMode;
|
|
769
756
|
break
|
|
770
757
|
case 3: //OPERATING MODE AUTO
|
|
771
758
|
button.previousValue = state ? deviceData.Device.VentilationMode : button.previousValue ?? deviceData.Device.VentilationMode;
|
|
772
759
|
deviceData.Device.Power = true;
|
|
773
760
|
deviceData.Device.VentilationMode = state ? 2 : button.previousValue;
|
|
774
|
-
|
|
761
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.VentilationMode;
|
|
775
762
|
break;
|
|
776
763
|
case 4: //NIGHT PURGE MODE
|
|
777
764
|
deviceData.Device.Power = true;
|
|
778
765
|
deviceData.Device.NightPurgeMode = state;
|
|
779
|
-
|
|
766
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power
|
|
780
767
|
break;
|
|
781
768
|
case 10: //FAN SPEED MODE AUTO
|
|
782
769
|
button.previousValue = state ? deviceData.Device.SetFanSpeed : button.previousValue ?? deviceData.Device.SetFanSpeed;
|
|
783
770
|
deviceData.Device.Power = true;
|
|
784
771
|
deviceData.Device.SetFanSpeed = state ? 0 : button.previousValue;
|
|
785
|
-
|
|
772
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.SetFanSpeed;
|
|
786
773
|
break;
|
|
787
774
|
case 11: //FAN SPEED MODE 1
|
|
788
775
|
button.previousValue = state ? deviceData.Device.SetFanSpeed : button.previousValue ?? deviceData.Device.SetFanSpeed;
|
|
789
776
|
deviceData.Device.Power = true;
|
|
790
777
|
deviceData.Device.SetFanSpeed = state ? 1 : button.previousValue;
|
|
791
|
-
|
|
778
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.SetFanSpeed;
|
|
792
779
|
break;
|
|
793
780
|
case 12: //FAN SPEED MODE 2
|
|
794
781
|
button.previousValue = state ? deviceData.Device.SetFanSpeed : button.previousValue ?? deviceData.Device.SetFanSpeed;
|
|
795
782
|
deviceData.Device.Power = true;
|
|
796
783
|
deviceData.Device.SetFanSpeed = state ? 2 : button.previousValue;
|
|
797
|
-
|
|
784
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.SetFanSpeed;
|
|
798
785
|
break;
|
|
799
786
|
case 13: //FAN SPEED MODE 3
|
|
800
787
|
button.previousValue = state ? deviceData.Device.SetFanSpeed : button.previousValue ?? deviceData.Device.SetFanSpeed;
|
|
801
788
|
deviceData.Device.Power = true;
|
|
802
789
|
deviceData.Device.SetFanSpeed = state ? 3 : button.previousValue;
|
|
803
|
-
|
|
790
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.SetFanSpeed;
|
|
804
791
|
break;
|
|
805
792
|
case 14: //FAN MODE 4
|
|
806
793
|
button.previousValue = state ? deviceData.Device.SetFanSpeed : button.previousValue ?? deviceData.Device.SetFanSpeed;
|
|
807
794
|
deviceData.Device.Power = true;
|
|
808
795
|
deviceData.Device.SetFanSpeed = state ? 4 : button.previousValue;
|
|
809
|
-
|
|
796
|
+
effectiveFlags = Ventilation.EffectiveFlags.Power + Ventilation.EffectiveFlags.SetFanSpeed;
|
|
810
797
|
break;
|
|
811
798
|
case 15: //PHYSICAL LOCK CONTROLS
|
|
812
799
|
deviceData.Device = deviceData.Device;
|
|
813
|
-
|
|
800
|
+
effectiveFlags = Ventilation.EffectiveFlags.Prohibit;
|
|
814
801
|
break;
|
|
815
802
|
case 16: //ROOM TEMP HIDE
|
|
816
803
|
deviceData.HideRoomTemperature = state;
|
|
@@ -826,7 +813,7 @@ class DeviceErv extends EventEmitter {
|
|
|
826
813
|
break;
|
|
827
814
|
};
|
|
828
815
|
|
|
829
|
-
await this.melCloudErv.send(this.accountType, this.displayType, deviceData);
|
|
816
|
+
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
830
817
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${buttonName}` : `Unset: ${buttonName}, Set: ${button.previousValue}`}`);
|
|
831
818
|
} catch (error) {
|
|
832
819
|
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
package/src/melcloudata.js
CHANGED
|
@@ -8,10 +8,10 @@ class MelCloudAta extends EventEmitter {
|
|
|
8
8
|
constructor(account, device, devicesFile, defaultTempsFile) {
|
|
9
9
|
super();
|
|
10
10
|
this.accountType = account.type;
|
|
11
|
+
this.logWarn = account.log?.warn;
|
|
12
|
+
this.logError = account.log?.error;
|
|
13
|
+
this.logDebug = account.log?.debug;
|
|
11
14
|
this.deviceId = device.id;
|
|
12
|
-
this.logWarn = device.log?.warn;
|
|
13
|
-
this.logError = device.log?.error;
|
|
14
|
-
this.logDebug = device.log?.debug;
|
|
15
15
|
this.devicesFile = devicesFile;
|
|
16
16
|
this.defaultTempsFile = defaultTempsFile;
|
|
17
17
|
this.functions = new Functions(this.logWarn, this.logError, this.logDebug)
|
|
@@ -59,8 +59,8 @@ class MelCloudAta extends EventEmitter {
|
|
|
59
59
|
}
|
|
60
60
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
61
61
|
if (this.accountType === 'melcloudhome') {
|
|
62
|
-
deviceData.SerialNumber = deviceData.
|
|
63
|
-
deviceData.Device.FirmwareAppVersion = '4.0.0';
|
|
62
|
+
deviceData.SerialNumber = deviceData.DeviceID || '4.0.0';
|
|
63
|
+
deviceData.Device.FirmwareAppVersion = deviceData.ConnectedInterfaceIdetifier || '4.0.0';
|
|
64
64
|
deviceData.Device.OperationMode = AirConditioner.OperationModeMapStringToEnum[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
|
|
65
65
|
deviceData.Device.ActualFanSpeed = AirConditioner.FanSpeedMapStringToEnum[deviceData.Device.ActualFanSpeed] ?? deviceData.Device.ActualFanSpeed;
|
|
66
66
|
deviceData.Device.SetFanSpeed = AirConditioner.FanSpeedMapStringToEnum[deviceData.Device.SetFanSpeed] ?? deviceData.Device.SetFanSpeed;
|
package/src/melcloudatw.js
CHANGED
|
@@ -8,10 +8,10 @@ class MelCloudAtw extends EventEmitter {
|
|
|
8
8
|
constructor(account, device, devicesFile, defaultTempsFile) {
|
|
9
9
|
super();
|
|
10
10
|
this.accountType = account.type;
|
|
11
|
+
this.logWarn = account.log?.warn;
|
|
12
|
+
this.logError = account.log?.error;
|
|
13
|
+
this.logDebug = account.log?.debug;
|
|
11
14
|
this.deviceId = device.id;
|
|
12
|
-
this.logWarn = device.log?.warn;
|
|
13
|
-
this.logError = device.log?.error;
|
|
14
|
-
this.logDebug = device.log?.debug;
|
|
15
15
|
this.devicesFile = devicesFile;
|
|
16
16
|
this.defaultTempsFile = defaultTempsFile;
|
|
17
17
|
this.functions = new Functions(this.logWarn, this.logError, this.logDebug)
|
|
@@ -59,8 +59,8 @@ class MelCloudAtw extends EventEmitter {
|
|
|
59
59
|
}
|
|
60
60
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
61
61
|
if (this.accountType === 'melcloudhome') {
|
|
62
|
-
deviceData.SerialNumber = deviceData.
|
|
63
|
-
deviceData.Device.FirmwareAppVersion = '4.0.0';
|
|
62
|
+
deviceData.SerialNumber = deviceData.DeviceID || '4.0.0';
|
|
63
|
+
deviceData.Device.FirmwareAppVersion = deviceData.ConnectedInterfaceIdetifier || '4.0.0';
|
|
64
64
|
}
|
|
65
65
|
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
|
|
66
66
|
|
|
@@ -177,7 +177,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
-
async send(accountType, displayType, deviceData) {
|
|
180
|
+
async send(accountType, displayType, deviceData, effectiveFlags) {
|
|
181
181
|
try {
|
|
182
182
|
switch (accountType) {
|
|
183
183
|
case "melcloud":
|
|
@@ -205,6 +205,7 @@ class MelCloudAtw extends EventEmitter {
|
|
|
205
205
|
deviceData.Device.SetTankWaterTemperature = deviceData.Device.SetTankWaterTemperature < minTempWaterTank ? minTempWaterTank : deviceData.Device.SetTankWaterTemperature;
|
|
206
206
|
deviceData.Device.SetTankWaterTemperature = deviceData.Device.SetTankWaterTemperature > maxTempWaterTank ? maxTempWaterTank : deviceData.Device.SetTankWaterTemperature;
|
|
207
207
|
|
|
208
|
+
deviceData.Device.EffectiveFlags = effectiveFlags;
|
|
208
209
|
const payload = {
|
|
209
210
|
data: {
|
|
210
211
|
DeviceID: deviceData.Device.DeviceID,
|
package/src/melclouderv.js
CHANGED
|
@@ -8,10 +8,10 @@ class MelCloudErv extends EventEmitter {
|
|
|
8
8
|
constructor(account, device, devicesFile, defaultTempsFile) {
|
|
9
9
|
super();
|
|
10
10
|
this.accountType = account.type;
|
|
11
|
+
this.logWarn = account.log?.warn;
|
|
12
|
+
this.logError = account.log?.error;
|
|
13
|
+
this.logDebug = account.log?.debug;
|
|
11
14
|
this.deviceId = device.id;
|
|
12
|
-
this.logWarn = device.log?.warn;
|
|
13
|
-
this.logError = device.log?.error;
|
|
14
|
-
this.logDebug = device.log?.debug;
|
|
15
15
|
this.devicesFile = devicesFile;
|
|
16
16
|
this.defaultTempsFile = defaultTempsFile;
|
|
17
17
|
this.functions = new Functions(this.logWarn, this.logError, this.logDebug)
|
|
@@ -59,8 +59,8 @@ class MelCloudErv extends EventEmitter {
|
|
|
59
59
|
}
|
|
60
60
|
const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
|
|
61
61
|
if (this.accountType === 'melcloudhome') {
|
|
62
|
-
deviceData.SerialNumber = deviceData.
|
|
63
|
-
deviceData.Device.FirmwareAppVersion = '4.0.0';
|
|
62
|
+
deviceData.SerialNumber = deviceData.DeviceID || '4.0.0';
|
|
63
|
+
deviceData.Device.FirmwareAppVersion = deviceData.ConnectedInterfaceIdetifier || '4.0.0';
|
|
64
64
|
}
|
|
65
65
|
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
|
|
66
66
|
|
|
@@ -169,7 +169,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
169
169
|
};
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
async send(accountType, displayType, deviceData) {
|
|
172
|
+
async send(accountType, displayType, deviceData, effectiveFlags) {
|
|
173
173
|
try {
|
|
174
174
|
switch (accountType) {
|
|
175
175
|
case "melcloud":
|
|
@@ -205,6 +205,7 @@ class MelCloudErv extends EventEmitter {
|
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
//device state
|
|
208
|
+
deviceData.Device.EffectiveFlags = effectiveFlags;
|
|
208
209
|
const payload = {
|
|
209
210
|
data: {
|
|
210
211
|
DeviceID: deviceData.Device.DeviceID,
|