homebridge-melcloud-control 4.0.0-beta.52 → 4.0.0-beta.521
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/CHANGELOG.md +9 -4
- package/README.md +10 -12
- package/config.schema.json +294 -336
- package/homebridge-ui/public/index.html +110 -64
- package/homebridge-ui/server.js +7 -9
- package/index.js +45 -28
- package/package.json +5 -4
- package/src/constants.js +15 -22
- package/src/deviceata.js +252 -243
- package/src/deviceatw.js +50 -40
- package/src/deviceerv.js +43 -35
- package/src/functions.js +155 -5
- package/src/melcloud.js +345 -180
- package/src/melcloudata.js +146 -306
- package/src/melcloudatw.js +145 -340
- package/src/melclouderv.js +144 -271
- package/src/restful.js +1 -1
package/src/deviceata.js
CHANGED
|
@@ -6,7 +6,7 @@ import { TemperatureDisplayUnits, AirConditioner } from './constants.js';
|
|
|
6
6
|
let Accessory, Characteristic, Service, Categories, AccessoryUUID;
|
|
7
7
|
|
|
8
8
|
class DeviceAta extends EventEmitter {
|
|
9
|
-
constructor(api, account, device,
|
|
9
|
+
constructor(api, account, device, devicesFile, defaultTempsFile, useFahrenheit, restFul, mqtt) {
|
|
10
10
|
super();
|
|
11
11
|
|
|
12
12
|
Accessory = api.platformAccessory;
|
|
@@ -16,8 +16,17 @@ class DeviceAta extends EventEmitter {
|
|
|
16
16
|
AccessoryUUID = api.hap.uuid;
|
|
17
17
|
|
|
18
18
|
//account config
|
|
19
|
+
this.account = account;
|
|
20
|
+
this.accountType = account.type;
|
|
21
|
+
this.accountName = account.name;
|
|
22
|
+
this.logDeviceInfo = account.log?.deviceInfo || false;
|
|
23
|
+
this.logInfo = account.log?.info || false;
|
|
24
|
+
this.logWarn = account.log?.warn || false;
|
|
25
|
+
this.logDebug = account.log?.debug || false;
|
|
26
|
+
|
|
27
|
+
//device config
|
|
19
28
|
this.device = device;
|
|
20
|
-
this.
|
|
29
|
+
this.displayType = device.displayType;
|
|
21
30
|
this.temperatureSensor = device.temperatureSensor || false;
|
|
22
31
|
this.temperatureSensorOutdoor = device.temperatureSensorOutdoor || false;
|
|
23
32
|
this.heatDryFanMode = device.heatDryFanMode || 1; //NONE, HEAT, DRY, FAN
|
|
@@ -25,16 +34,11 @@ class DeviceAta extends EventEmitter {
|
|
|
25
34
|
this.autoDryFanMode = device.autoDryFanMode || 1; //NONE, AUTO, DRY, FAN
|
|
26
35
|
this.presets = (device.presets || []).filter(preset => (preset.displayType ?? 0) > 0);
|
|
27
36
|
this.buttons = (device.buttonsSensors || []).filter(sensor => (sensor.displayType ?? 0) > 0);
|
|
28
|
-
this.logDeviceInfo = account.log?.deviceInfo || false;
|
|
29
|
-
this.logInfo = account.log?.info || false;
|
|
30
|
-
this.logWarn = account.log?.warn || false;
|
|
31
|
-
this.logDebug = account.log?.debug || false;
|
|
32
|
-
this.contextKey = contextKey;
|
|
33
|
-
this.accountName = account.name;
|
|
34
37
|
this.deviceId = device.id;
|
|
35
38
|
this.deviceName = device.name;
|
|
36
39
|
this.deviceTypeText = device.typeString;
|
|
37
40
|
this.devicesFile = devicesFile;
|
|
41
|
+
this.defaultTempsFile = defaultTempsFile;
|
|
38
42
|
this.displayDeviceInfo = true;
|
|
39
43
|
|
|
40
44
|
//external integrations
|
|
@@ -150,71 +154,72 @@ class DeviceAta extends EventEmitter {
|
|
|
150
154
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
151
155
|
try {
|
|
152
156
|
let set = false
|
|
157
|
+
let effectiveFlags = null;
|
|
153
158
|
switch (key) {
|
|
154
159
|
case 'Power':
|
|
155
160
|
deviceData.Device[key] = value;
|
|
156
|
-
|
|
157
|
-
set = await this.melCloudAta.send(
|
|
161
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
162
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
158
163
|
break;
|
|
159
164
|
case 'OperationMode':
|
|
160
165
|
deviceData.Device[key] = value;
|
|
161
|
-
|
|
162
|
-
set = await this.melCloudAta.send(
|
|
166
|
+
effectiveFlags = AirConditioner.EffectiveFlags.OperationMode
|
|
167
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
163
168
|
break;
|
|
164
169
|
case 'SetTemperature':
|
|
165
170
|
deviceData.Device[key] = value;
|
|
166
|
-
|
|
167
|
-
set = await this.melCloudAta.send(
|
|
171
|
+
effectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
172
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
168
173
|
break;
|
|
169
174
|
case 'DefaultCoolingSetTemperature':
|
|
170
175
|
deviceData.Device[key] = value;
|
|
171
|
-
|
|
172
|
-
set = await this.melCloudAta.send(
|
|
176
|
+
effectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
177
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
173
178
|
break;
|
|
174
179
|
case 'DefaultHeatingSetTemperature':
|
|
175
180
|
deviceData.Device[key] = value;
|
|
176
|
-
|
|
177
|
-
set = await this.melCloudAta.send(
|
|
181
|
+
effectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
182
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
178
183
|
break;
|
|
179
184
|
case 'FanSpeed':
|
|
180
185
|
deviceData.Device[key] = value;
|
|
181
|
-
|
|
182
|
-
set = await this.melCloudAta.send(
|
|
186
|
+
effectiveFlags = AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
187
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
183
188
|
break;
|
|
184
189
|
case 'VaneHorizontalDirection':
|
|
185
190
|
deviceData.Device[key] = value;
|
|
186
|
-
|
|
187
|
-
set = await this.melCloudAta.send(
|
|
191
|
+
effectiveFlags = AirConditioner.EffectiveFlags.VaneHorizontalDirection;
|
|
192
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
188
193
|
break;
|
|
189
194
|
case 'VaneVerticalDirection':
|
|
190
195
|
deviceData.Device[key] = value;
|
|
191
|
-
|
|
192
|
-
set = await this.melCloudAta.send(
|
|
196
|
+
effectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalDirection;
|
|
197
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
193
198
|
break;
|
|
194
199
|
case 'HideVaneControls':
|
|
195
200
|
deviceData[key] = value;
|
|
196
|
-
|
|
197
|
-
set = await this.melCloudAta.send(
|
|
201
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
202
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
198
203
|
break;
|
|
199
204
|
case 'HideDryModeControl':
|
|
200
205
|
deviceData[key] = value;
|
|
201
|
-
|
|
202
|
-
await this.melCloudAta.send(
|
|
206
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
207
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
203
208
|
break;
|
|
204
209
|
case 'ProhibitSetTemperature':
|
|
205
210
|
deviceData.Device[key] = value;
|
|
206
|
-
|
|
207
|
-
set = await this.melCloudAta.send(
|
|
211
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
212
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
208
213
|
break;
|
|
209
214
|
case 'ProhibitOperationMode':
|
|
210
215
|
deviceData.Device[key] = value;
|
|
211
|
-
|
|
212
|
-
await this.melCloudAta.send(
|
|
216
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
217
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
213
218
|
break;
|
|
214
219
|
case 'ProhibitPower':
|
|
215
220
|
deviceData.Device[key] = value;
|
|
216
|
-
|
|
217
|
-
set = await this.melCloudAta.send(
|
|
221
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
222
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
218
223
|
break;
|
|
219
224
|
default:
|
|
220
225
|
this.emit('warn', `${integration}, received key: ${key}, value: ${value}`);
|
|
@@ -245,18 +250,18 @@ class DeviceAta extends EventEmitter {
|
|
|
245
250
|
const deviceName = this.deviceName;
|
|
246
251
|
const accountName = this.accountName;
|
|
247
252
|
const presetsOnServer = this.accessory.presets;
|
|
248
|
-
const
|
|
249
|
-
const
|
|
250
|
-
const
|
|
251
|
-
const
|
|
252
|
-
const
|
|
253
|
-
const
|
|
254
|
-
const
|
|
253
|
+
const supportsHeat = this.accessory.supportsHeat;
|
|
254
|
+
const supportsDry = this.accessory.supportsDry;
|
|
255
|
+
const supportsCool = this.accessory.supportsCool;
|
|
256
|
+
const supportsAuto = this.accessory.supportsAuto;
|
|
257
|
+
const supportsFanSpeed = this.accessory.supportsFanSpeed;
|
|
258
|
+
const supportsAutomaticFanSpeed = this.accessory.supportsAutomaticFanSpeed;
|
|
259
|
+
const supportsOutdoorTemperature = this.accessory.supportsOutdoorTemperature;
|
|
255
260
|
const numberOfFanSpeeds = this.accessory.numberOfFanSpeeds;
|
|
256
|
-
const
|
|
257
|
-
const autoDryFanMode = [this.accessory.operationMode, 8,
|
|
258
|
-
const heatDryFanMode = [this.accessory.operationMode, 1,
|
|
259
|
-
const coolDryFanMode = [this.accessory.operationMode, 3,
|
|
261
|
+
const supportsSwingFunction = this.accessory.supportsSwingFunction;
|
|
262
|
+
const autoDryFanMode = [this.accessory.operationMode, 8, supportsDry ? 2 : 8, 7][this.autoDryFanMode]; //NONE, AUTO - 8, DRY - 2, FAN - 7
|
|
263
|
+
const heatDryFanMode = [this.accessory.operationMode, 1, supportsDry ? 2 : 1, 7][this.heatDryFanMode]; //NONE, HEAT - 1, DRY - 2, FAN - 7
|
|
264
|
+
const coolDryFanMode = [this.accessory.operationMode, 3, supportsDry ? 2 : 3, 7][this.coolDryFanMode]; //NONE, COOL - 3, DRY - 2, FAN - 7
|
|
260
265
|
|
|
261
266
|
//accessory
|
|
262
267
|
if (this.logDebug) this.emit('debug', `Prepare accessory`);
|
|
@@ -276,7 +281,7 @@ class DeviceAta extends EventEmitter {
|
|
|
276
281
|
|
|
277
282
|
//melcloud services
|
|
278
283
|
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
279
|
-
switch (this.
|
|
284
|
+
switch (this.displayType) {
|
|
280
285
|
case 1: //Heater Cooler
|
|
281
286
|
if (this.logDebug) this.emit('debug', `Prepare heater/cooler service`);
|
|
282
287
|
this.melCloudService = new Service.HeaterCooler(serviceName, `HeaterCooler ${deviceId}`);
|
|
@@ -287,10 +292,11 @@ class DeviceAta extends EventEmitter {
|
|
|
287
292
|
return state;
|
|
288
293
|
})
|
|
289
294
|
.onSet(async (state) => {
|
|
295
|
+
if (!!state === deviceData.Device.Power) return;
|
|
296
|
+
|
|
290
297
|
try {
|
|
291
|
-
deviceData.Device.Power =
|
|
292
|
-
|
|
293
|
-
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
298
|
+
deviceData.Device.Power = state
|
|
299
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Power);
|
|
294
300
|
if (this.logInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
295
301
|
} catch (error) {
|
|
296
302
|
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
@@ -315,20 +321,21 @@ class DeviceAta extends EventEmitter {
|
|
|
315
321
|
try {
|
|
316
322
|
switch (value) {
|
|
317
323
|
case 0: //AUTO - AUTO
|
|
318
|
-
|
|
324
|
+
value = autoDryFanMode;
|
|
325
|
+
deviceData.Device.OperationMode = value;
|
|
319
326
|
break;
|
|
320
327
|
case 1: //HEAT - HEAT
|
|
321
|
-
|
|
328
|
+
value = heatDryFanMode;
|
|
329
|
+
deviceData.Device.OperationMode = value;
|
|
322
330
|
break;
|
|
323
331
|
case 2: //COOL - COOL
|
|
324
|
-
|
|
332
|
+
value = coolDryFanMode;
|
|
333
|
+
deviceData.Device.OperationMode = value;
|
|
325
334
|
break;
|
|
326
335
|
};
|
|
327
336
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const operationModeText = AirConditioner.DriveMode[deviceData.Device.OperationMode];
|
|
331
|
-
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
337
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.OperationMode);
|
|
338
|
+
if (this.logInfo) this.emit('info', `Set operation mode: ${AirConditioner.OperationModeMapEnumToString[value]}`);
|
|
332
339
|
} catch (error) {
|
|
333
340
|
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
334
341
|
};
|
|
@@ -338,7 +345,7 @@ class DeviceAta extends EventEmitter {
|
|
|
338
345
|
const value = this.accessory.roomTemperature;
|
|
339
346
|
return value;
|
|
340
347
|
});
|
|
341
|
-
if (
|
|
348
|
+
if (supportsFanSpeed) {
|
|
342
349
|
this.melCloudService.getCharacteristic(Characteristic.RotationSpeed)
|
|
343
350
|
.setProps({
|
|
344
351
|
minValue: 0,
|
|
@@ -346,56 +353,48 @@ class DeviceAta extends EventEmitter {
|
|
|
346
353
|
minStep: 1
|
|
347
354
|
})
|
|
348
355
|
.onGet(async () => {
|
|
349
|
-
const value = this.accessory.
|
|
356
|
+
const value = this.accessory.currentFanSpeed; //AUTO, 1, 2, 3, 4, 5, 6, OFF
|
|
350
357
|
return value;
|
|
351
358
|
})
|
|
352
359
|
.onSet(async (value) => {
|
|
353
360
|
try {
|
|
354
|
-
|
|
361
|
+
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
355
362
|
switch (numberOfFanSpeeds) {
|
|
356
363
|
case 2: //Fan speed mode 2
|
|
357
|
-
|
|
358
|
-
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
|
|
364
|
+
value = supportsAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
|
|
359
365
|
break;
|
|
360
366
|
case 3: //Fan speed mode 3
|
|
361
|
-
|
|
362
|
-
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
|
|
367
|
+
value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
|
|
363
368
|
break;
|
|
364
369
|
case 4: //Fan speed mode 4
|
|
365
|
-
|
|
366
|
-
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
|
|
370
|
+
value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
|
|
367
371
|
break;
|
|
368
372
|
case 5: //Fan speed mode 5
|
|
369
|
-
|
|
370
|
-
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
|
|
371
|
-
break;
|
|
372
|
-
case 6: //Fan speed mode 6
|
|
373
|
-
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6, 0][value] : [7, 1, 2, 3, 4, 5, 6][value];
|
|
374
|
-
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 6, 0][value] : [1, 1, 2, 3, 4, 5, 6][value];
|
|
373
|
+
value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
|
|
375
374
|
break;
|
|
376
375
|
};
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
376
|
+
|
|
377
|
+
deviceData.Device[fanKey] = value
|
|
378
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetFanSpeed);
|
|
379
|
+
if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeedMapEnumToString[value]}`);
|
|
380
380
|
} catch (error) {
|
|
381
381
|
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
382
382
|
};
|
|
383
383
|
});
|
|
384
384
|
};
|
|
385
|
-
if (
|
|
385
|
+
if (supportsSwingFunction) {
|
|
386
386
|
this.melCloudService.getCharacteristic(Characteristic.SwingMode)
|
|
387
387
|
.onGet(async () => {
|
|
388
|
-
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
|
|
389
|
-
const value = this.accessory.
|
|
388
|
+
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 7 = Sp;it, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
|
|
389
|
+
const value = this.accessory.currentSwingMode;
|
|
390
390
|
return value;
|
|
391
391
|
})
|
|
392
392
|
.onSet(async (value) => {
|
|
393
393
|
try {
|
|
394
|
-
deviceData.Device.
|
|
395
|
-
deviceData.Device.
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirection[value]}`);
|
|
394
|
+
deviceData.Device.VaneHorizontalDirection = value ? 12 : 0;
|
|
395
|
+
deviceData.Device.VaneVerticalDirection = value ? 7 : 0;
|
|
396
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.VaneVerticalVaneHorizontal);
|
|
397
|
+
if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirectionMapEnumToString[value]}`);
|
|
399
398
|
} catch (error) {
|
|
400
399
|
if (this.logWarn) this.emit('warn', `Set vane swing mode error: ${error}`);
|
|
401
400
|
};
|
|
@@ -403,9 +402,9 @@ class DeviceAta extends EventEmitter {
|
|
|
403
402
|
};
|
|
404
403
|
this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
|
|
405
404
|
.setProps({
|
|
406
|
-
minValue: this.accessory.
|
|
407
|
-
maxValue: this.accessory.
|
|
408
|
-
minStep: this.accessory.
|
|
405
|
+
minValue: this.accessory.minTempCoolDryAuto,
|
|
406
|
+
maxValue: this.accessory.maxTempCoolDryAuto,
|
|
407
|
+
minStep: this.accessory.temperatureStep
|
|
409
408
|
})
|
|
410
409
|
.onGet(async () => {
|
|
411
410
|
const value = this.accessory.operationMode === 8 ? this.accessory.defaultCoolingSetTemperature : this.accessory.setTemperature;
|
|
@@ -413,20 +412,20 @@ class DeviceAta extends EventEmitter {
|
|
|
413
412
|
})
|
|
414
413
|
.onSet(async (value) => {
|
|
415
414
|
try {
|
|
416
|
-
|
|
417
|
-
deviceData.Device
|
|
418
|
-
await this.melCloudAta.send(
|
|
415
|
+
const tempKey = this.accessory.operationMode === 8 ? 'DefaultCoolingSetTemperature' : 'SetTemperature';
|
|
416
|
+
deviceData.Device[tempKey] = value;
|
|
417
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
|
|
419
418
|
if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
420
419
|
} catch (error) {
|
|
421
420
|
if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
422
421
|
};
|
|
423
422
|
});
|
|
424
|
-
if (
|
|
423
|
+
if (supportsHeat) {
|
|
425
424
|
this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
|
|
426
425
|
.setProps({
|
|
427
426
|
minValue: this.accessory.minTempHeat,
|
|
428
427
|
maxValue: this.accessory.maxTempHeat,
|
|
429
|
-
minStep: this.accessory.
|
|
428
|
+
minStep: this.accessory.temperatureStep
|
|
430
429
|
})
|
|
431
430
|
.onGet(async () => {
|
|
432
431
|
const value = this.accessory.operationMode === 8 ? this.accessory.defaultHeatingSetTemperature : this.accessory.setTemperature;
|
|
@@ -434,9 +433,9 @@ class DeviceAta extends EventEmitter {
|
|
|
434
433
|
})
|
|
435
434
|
.onSet(async (value) => {
|
|
436
435
|
try {
|
|
437
|
-
|
|
438
|
-
deviceData.Device
|
|
439
|
-
await this.melCloudAta.send(
|
|
436
|
+
const tempKey = this.accessory.operationMode === 8 ? 'DefaultHeatingSetTemperature' : 'SetTemperature';
|
|
437
|
+
deviceData.Device[tempKey] = value;
|
|
438
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
|
|
440
439
|
if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
441
440
|
} catch (error) {
|
|
442
441
|
if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
@@ -449,13 +448,14 @@ class DeviceAta extends EventEmitter {
|
|
|
449
448
|
return value;
|
|
450
449
|
})
|
|
451
450
|
.onSet(async (value) => {
|
|
451
|
+
if (this.account.type === 'melcloudhome') return;
|
|
452
|
+
|
|
452
453
|
try {
|
|
453
454
|
value = value ? true : false;
|
|
454
455
|
deviceData.Device.ProhibitSetTemperature = value;
|
|
455
456
|
deviceData.Device.ProhibitOperationMode = value;
|
|
456
457
|
deviceData.Device.ProhibitPower = value;
|
|
457
|
-
|
|
458
|
-
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
458
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Prohibit);
|
|
459
459
|
if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
460
460
|
} catch (error) {
|
|
461
461
|
if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
@@ -467,6 +467,8 @@ class DeviceAta extends EventEmitter {
|
|
|
467
467
|
return value;
|
|
468
468
|
})
|
|
469
469
|
.onSet(async (value) => {
|
|
470
|
+
if (this.account.type === 'melcloudhome') return;
|
|
471
|
+
|
|
470
472
|
try {
|
|
471
473
|
value = [false, true][value];
|
|
472
474
|
this.accessory.useFahrenheit = value;
|
|
@@ -499,30 +501,33 @@ class DeviceAta extends EventEmitter {
|
|
|
499
501
|
})
|
|
500
502
|
.onSet(async (value) => {
|
|
501
503
|
try {
|
|
504
|
+
let effectiveFlags = null;
|
|
502
505
|
switch (value) {
|
|
503
506
|
case 0: //OFF - POWER OFF
|
|
507
|
+
value = deviceData.Device.OperationMode;
|
|
504
508
|
deviceData.Device.Power = false;
|
|
505
|
-
|
|
509
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
506
510
|
break;
|
|
507
511
|
case 1: //HEAT - HEAT
|
|
508
512
|
deviceData.Device.Power = true;
|
|
509
|
-
|
|
510
|
-
|
|
513
|
+
value = heatDryFanMode;
|
|
514
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
511
515
|
break;
|
|
512
516
|
case 2: //COOL - COOL
|
|
517
|
+
value = coolDryFanMode;
|
|
513
518
|
deviceData.Device.Power = true;
|
|
514
|
-
|
|
515
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature
|
|
519
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature
|
|
516
520
|
break;
|
|
517
521
|
case 3: //AUTO - AUTO
|
|
522
|
+
value = autoDryFanMode;
|
|
518
523
|
deviceData.Device.Power = true;
|
|
519
|
-
|
|
520
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
524
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
521
525
|
break;
|
|
522
526
|
};
|
|
523
527
|
|
|
524
|
-
|
|
525
|
-
|
|
528
|
+
deviceData.Device.OperationMode = value;
|
|
529
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
530
|
+
const operationModeText = AirConditioner.OperationModeMapEnumToString[value];
|
|
526
531
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
527
532
|
} catch (error) {
|
|
528
533
|
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
@@ -537,7 +542,7 @@ class DeviceAta extends EventEmitter {
|
|
|
537
542
|
.setProps({
|
|
538
543
|
minValue: this.accessory.minTempHeat,
|
|
539
544
|
maxValue: this.accessory.maxTempHeat,
|
|
540
|
-
minStep: this.accessory.
|
|
545
|
+
minStep: this.accessory.temperatureStep
|
|
541
546
|
})
|
|
542
547
|
.onGet(async () => {
|
|
543
548
|
const value = this.accessory.setTemperature;
|
|
@@ -546,8 +551,7 @@ class DeviceAta extends EventEmitter {
|
|
|
546
551
|
.onSet(async (value) => {
|
|
547
552
|
try {
|
|
548
553
|
deviceData.Device.SetTemperature = value;
|
|
549
|
-
|
|
550
|
-
await this.melCloudAta.send(deviceData, this.displayMode);
|
|
554
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
|
|
551
555
|
if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
552
556
|
} catch (error) {
|
|
553
557
|
if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
|
|
@@ -559,6 +563,8 @@ class DeviceAta extends EventEmitter {
|
|
|
559
563
|
return value;
|
|
560
564
|
})
|
|
561
565
|
.onSet(async (value) => {
|
|
566
|
+
if (this.account.type === 'melcloudhome') return;
|
|
567
|
+
|
|
562
568
|
try {
|
|
563
569
|
value = [false, true][value];
|
|
564
570
|
this.accessory.useFahrenheit = value;
|
|
@@ -591,7 +597,7 @@ class DeviceAta extends EventEmitter {
|
|
|
591
597
|
accessory.addService(this.roomTemperatureSensorService);
|
|
592
598
|
};
|
|
593
599
|
|
|
594
|
-
if (this.temperatureSensorOutdoor &&
|
|
600
|
+
if (this.temperatureSensorOutdoor && supportsOutdoorTemperature && this.accessory.outdoorTemperature !== null) {
|
|
595
601
|
if (this.logDebug) this.emit('debug', `Prepare outdoor temperature sensor service`);
|
|
596
602
|
this.outdoorTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Outdoor`, `Outdoor Temperature Sensor ${deviceId}`);
|
|
597
603
|
this.outdoorTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -635,16 +641,16 @@ class DeviceAta extends EventEmitter {
|
|
|
635
641
|
})
|
|
636
642
|
.onSet(async (state) => {
|
|
637
643
|
try {
|
|
644
|
+
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
638
645
|
switch (state) {
|
|
639
646
|
case true:
|
|
640
647
|
preset.previousSettings = deviceData.Device;
|
|
641
648
|
deviceData.Device.Power = presetData.Power;
|
|
642
649
|
deviceData.Device.OperationMode = presetData.OperationMode;
|
|
643
650
|
deviceData.Device.SetTemperature = presetData.SetTemperature;
|
|
644
|
-
deviceData.Device.VaneHorizontalDirection = presetData.
|
|
645
|
-
deviceData.Device.VaneVerticalDirection = presetData.
|
|
646
|
-
deviceData.Device
|
|
647
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
651
|
+
deviceData.Device.VaneHorizontalDirection = presetData.VaneHorizontalDirection;
|
|
652
|
+
deviceData.Device.VaneVerticalDirection = presetData.VaneVerticalDirection;
|
|
653
|
+
deviceData.Device[fanKey] = presetData[fanKey];
|
|
648
654
|
break;
|
|
649
655
|
case false:
|
|
650
656
|
deviceData.Device.Power = preset.previousSettings.Power;
|
|
@@ -652,12 +658,11 @@ class DeviceAta extends EventEmitter {
|
|
|
652
658
|
deviceData.Device.SetTemperature = preset.previousSettings.SetTemperature;
|
|
653
659
|
deviceData.Device.VaneHorizontalDirection = preset.previousSettings.VaneHorizontalDirection;
|
|
654
660
|
deviceData.Device.VaneVerticalDirection = preset.previousSettings.VaneVerticalDirection;
|
|
655
|
-
deviceData.Device
|
|
656
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
661
|
+
deviceData.Device[fanKey] = preset.previousSettings[fanKey];
|
|
657
662
|
break;
|
|
658
663
|
};
|
|
659
664
|
|
|
660
|
-
await this.melCloudAta.send(
|
|
665
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Presets);
|
|
661
666
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
662
667
|
} catch (error) {
|
|
663
668
|
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
@@ -695,46 +700,48 @@ class DeviceAta extends EventEmitter {
|
|
|
695
700
|
})
|
|
696
701
|
.onSet(async (state) => {
|
|
697
702
|
try {
|
|
703
|
+
const key = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
704
|
+
let effectiveFlags = null;
|
|
698
705
|
switch (mode) {
|
|
699
706
|
case 0: //POWER ON,OFF
|
|
700
707
|
deviceData.Device.Power = state;
|
|
701
|
-
|
|
708
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
702
709
|
break;
|
|
703
710
|
case 1: //OPERATING MODE HEAT
|
|
704
711
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
705
712
|
deviceData.Device.Power = true;
|
|
706
713
|
deviceData.Device.OperationMode = state ? 1 : button.previousValue === 9 ? 1 : button.previousValue;
|
|
707
|
-
|
|
714
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
708
715
|
break;
|
|
709
716
|
case 2: //OPERATING MODE DRY
|
|
710
717
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
711
718
|
deviceData.Device.Power = true;
|
|
712
719
|
deviceData.Device.OperationMode = state ? 2 : button.previousValue === 10 ? 2 : button.previousValue;
|
|
713
|
-
|
|
720
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
714
721
|
break
|
|
715
722
|
case 3: //OPERATING MODE COOL
|
|
716
723
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
717
724
|
deviceData.Device.Power = true;
|
|
718
725
|
deviceData.Device.OperationMode = state ? 3 : button.previousValue === 11 ? 3 : button.previousValue;
|
|
719
|
-
|
|
726
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
720
727
|
break;
|
|
721
728
|
case 4: //OPERATING MODE FAN
|
|
722
729
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
723
730
|
deviceData.Device.Power = true;
|
|
724
731
|
deviceData.Device.OperationMode = state ? 7 : button.previousValue;
|
|
725
|
-
|
|
732
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
726
733
|
break;
|
|
727
734
|
case 5: //OPERATING MODE AUTO
|
|
728
735
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
729
736
|
deviceData.Device.Power = true;
|
|
730
737
|
deviceData.Device.OperationMode = state ? 8 : button.previousValue;
|
|
731
|
-
|
|
738
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
732
739
|
break;
|
|
733
740
|
case 6: //OPERATING MODE PURIFY
|
|
734
741
|
button.previousValue = state ? deviceData.Device.OperationMode : button.previousValue ?? deviceData.Device.OperationMode;
|
|
735
742
|
deviceData.Device.Power = true;
|
|
736
743
|
deviceData.Device.OperationMode = state ? 12 : button.previousValue;
|
|
737
|
-
|
|
744
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
|
|
738
745
|
break;
|
|
739
746
|
case 7: //OPERATING MODE DRY CONTROL HIDE
|
|
740
747
|
deviceData.HideDryModeControl = state;
|
|
@@ -743,161 +750,161 @@ class DeviceAta extends EventEmitter {
|
|
|
743
750
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
744
751
|
deviceData.Device.Power = true;
|
|
745
752
|
deviceData.Device.VaneHorizontalDirection = state ? 0 : button.previousValue;
|
|
746
|
-
|
|
753
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
747
754
|
break;
|
|
748
755
|
case 11: //VANE H SWING MODE 1
|
|
749
756
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
750
757
|
deviceData.Device.Power = true;
|
|
751
758
|
deviceData.Device.VaneHorizontalDirection = state ? 1 : button.previousValue;
|
|
752
|
-
|
|
759
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
753
760
|
break;
|
|
754
761
|
case 12: //VANE H SWING MODE 2
|
|
755
762
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
756
763
|
deviceData.Device.Power = true;
|
|
757
764
|
deviceData.Device.VaneHorizontalDirection = state ? 2 : button.previousValue;
|
|
758
|
-
|
|
765
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
759
766
|
break;
|
|
760
767
|
case 13: //VANE H SWING MODE 3
|
|
761
768
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
762
769
|
deviceData.Device.Power = true;
|
|
763
770
|
deviceData.Device.VaneHorizontalDirection = state ? 3 : button.previousValue;
|
|
764
|
-
|
|
771
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
765
772
|
break;
|
|
766
773
|
case 14: //VANE H SWING MODE 4
|
|
767
774
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
768
775
|
deviceData.Device.Power = true;
|
|
769
776
|
deviceData.Device.VaneHorizontalDirection = state ? 4 : button.previousValue;
|
|
770
|
-
|
|
777
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
771
778
|
break;
|
|
772
779
|
case 15: //VANE H SWING MODE 5
|
|
773
780
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
774
781
|
deviceData.Device.Power = true;
|
|
775
782
|
deviceData.Device.VaneHorizontalDirection = state ? 5 : button.previousValue;
|
|
776
|
-
|
|
783
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
777
784
|
break;
|
|
778
785
|
case 16: //VANE H SWING MODE SPLIT
|
|
779
786
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
780
787
|
deviceData.Device.Power = true;
|
|
781
788
|
deviceData.Device.VaneHorizontalDirection = state ? 8 : button.previousValue;
|
|
782
|
-
|
|
789
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
783
790
|
break;
|
|
784
791
|
case 17: //VANE H SWING MODE SWING
|
|
785
792
|
button.previousValue = state ? deviceData.Device.VaneHorizontalDirection : button.previousValue ?? deviceData.Device.VaneHorizontalDirection;
|
|
786
793
|
deviceData.Device.Power = true;
|
|
787
794
|
deviceData.Device.VaneHorizontalDirection = state ? 12 : button.previousValue;
|
|
788
|
-
|
|
795
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneHorizontal;
|
|
789
796
|
break;
|
|
790
797
|
case 20: //VANE V SWING MODE AUTO
|
|
791
798
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
792
799
|
deviceData.Device.Power = true;
|
|
793
800
|
deviceData.Device.VaneVerticalDirection = state ? 0 : button.previousValue;
|
|
794
|
-
|
|
801
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
795
802
|
break;
|
|
796
803
|
case 21: //VANE V SWING MODE 1
|
|
797
804
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
798
805
|
deviceData.Device.Power = true;
|
|
799
806
|
deviceData.Device.VaneVerticalDirection = state ? 1 : button.previousValue;
|
|
800
|
-
|
|
807
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
801
808
|
break;
|
|
802
809
|
case 22: //VANE V SWING MODE 2
|
|
803
810
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
804
811
|
deviceData.Device.Power = true;
|
|
805
812
|
deviceData.Device.VaneVerticalDirection = state ? 2 : button.previousValue;
|
|
806
|
-
|
|
813
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
807
814
|
break;
|
|
808
815
|
case 23: //VANE V SWING MODE 3
|
|
809
816
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
810
817
|
deviceData.Device.Power = true;
|
|
811
818
|
deviceData.Device.VaneVerticalDirection = state ? 3 : button.previousValue;
|
|
812
|
-
|
|
819
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
813
820
|
break;
|
|
814
821
|
case 24: //VANE V SWING MODE 4
|
|
815
822
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
816
823
|
deviceData.Device.Power = true;
|
|
817
824
|
deviceData.Device.VaneVerticalDirection = state ? 4 : button.previousValue;
|
|
818
|
-
|
|
825
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
819
826
|
break;
|
|
820
827
|
case 25: //VANE V SWING MODE 5
|
|
821
828
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
822
829
|
deviceData.Device.Power = true;
|
|
823
830
|
deviceData.Device.VaneVerticalDirection = state ? 5 : button.previousValue;
|
|
824
|
-
|
|
831
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
825
832
|
break;
|
|
826
833
|
case 26: //VANE V SWING MODE SWING
|
|
827
834
|
button.previousValue = state ? deviceData.Device.VaneVerticalDirection : button.previousValue ?? deviceData.Device.VaneVerticalDirection;
|
|
828
835
|
deviceData.Device.Power = true;
|
|
829
836
|
deviceData.Device.VaneVerticalDirection = state ? 7 : button.previousValue;
|
|
830
|
-
|
|
837
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerVaneVertical;
|
|
831
838
|
break;
|
|
832
839
|
case 27: //VANE H/V CONTROLS HIDE
|
|
833
840
|
deviceData.HideVaneControls = state;
|
|
834
841
|
break;
|
|
835
842
|
case 30: //FAN SPEED MODE AUTO
|
|
836
|
-
button.previousValue = state ? deviceData.Device
|
|
843
|
+
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
837
844
|
deviceData.Device.Power = true;
|
|
838
|
-
deviceData.Device
|
|
839
|
-
|
|
845
|
+
deviceData.Device[fanKey] = state ? 0 : button.previousValue;
|
|
846
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
840
847
|
break;
|
|
841
848
|
case 31: //FAN SPEED MODE 1
|
|
842
|
-
button.previousValue = state ? deviceData.Device
|
|
849
|
+
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
843
850
|
deviceData.Device.Power = true;
|
|
844
|
-
deviceData.Device
|
|
845
|
-
|
|
851
|
+
deviceData.Device[fanKey] = state ? 1 : button.previousValue;
|
|
852
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
846
853
|
break;
|
|
847
854
|
case 32: //FAN SPEED MODE 2
|
|
848
|
-
button.previousValue = state ? deviceData.Device
|
|
855
|
+
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
849
856
|
deviceData.Device.Power = true;
|
|
850
|
-
deviceData.Device
|
|
851
|
-
|
|
857
|
+
deviceData.Device[fanKey] = state ? 2 : button.previousValue;
|
|
858
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
852
859
|
break;
|
|
853
860
|
case 33: //FAN SPEED MODE 3
|
|
854
|
-
button.previousValue = state ? deviceData.Device
|
|
861
|
+
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
855
862
|
deviceData.Device.Power = true;
|
|
856
|
-
deviceData.Device
|
|
857
|
-
|
|
863
|
+
deviceData.Device[fanKey] = state ? 3 : button.previousValue;
|
|
864
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
858
865
|
break;
|
|
859
866
|
case 34: //FAN MODE 4
|
|
860
|
-
button.previousValue = state ? deviceData.Device
|
|
867
|
+
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
861
868
|
deviceData.Device.Power = true;
|
|
862
|
-
deviceData.Device
|
|
863
|
-
|
|
869
|
+
deviceData.Device[fanKey] = state ? 4 : button.previousValue;
|
|
870
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
864
871
|
break;
|
|
865
872
|
case 35: //FAN SPEED MODE 5
|
|
866
|
-
button.previousValue = state ? deviceData.Device
|
|
873
|
+
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
867
874
|
deviceData.Device.Power = true;
|
|
868
|
-
deviceData.Device
|
|
869
|
-
|
|
875
|
+
deviceData.Device[fanKey] = state ? 5 : button.previousValue;
|
|
876
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
870
877
|
break;
|
|
871
878
|
case 36: //FAN SPEED MODE 6
|
|
872
|
-
button.previousValue = state ? deviceData.Device
|
|
879
|
+
button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
|
|
873
880
|
deviceData.Device.Power = true;
|
|
874
|
-
deviceData.Device
|
|
875
|
-
|
|
881
|
+
deviceData.Device[fanKey] = state ? 6 : button.previousValue;
|
|
882
|
+
effectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
|
|
876
883
|
break;
|
|
877
884
|
case 37: //PHYSICAL LOCK CONTROLS
|
|
878
885
|
deviceData.Device.ProhibitSetTemperature = state;
|
|
879
886
|
deviceData.Device.ProhibitOperationMode = state;
|
|
880
887
|
deviceData.Device.ProhibitPower = state;
|
|
881
|
-
|
|
888
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
882
889
|
break;
|
|
883
890
|
case 38: //PHYSICAL LOCK CONTROLS POWER
|
|
884
891
|
deviceData.Device.ProhibitPower = state;
|
|
885
|
-
|
|
892
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
886
893
|
break;
|
|
887
894
|
case 39: //PHYSICAL LOCK CONTROLS MODE
|
|
888
895
|
deviceData.Device.ProhibitOperationMode = state;
|
|
889
|
-
|
|
896
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
890
897
|
break;
|
|
891
898
|
case 40: //PHYSICAL LOCK CONTROLS TEMP
|
|
892
899
|
deviceData.Device.ProhibitSetTemperature = state;
|
|
893
|
-
|
|
900
|
+
effectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
894
901
|
break;
|
|
895
902
|
default:
|
|
896
903
|
if (this.logWarn) this.emit('warn', `Unknown button mode: ${mode}`);
|
|
897
904
|
break;
|
|
898
905
|
};
|
|
899
906
|
|
|
900
|
-
await this.melCloudAta.send(
|
|
907
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, effectiveFlags);
|
|
901
908
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
|
|
902
909
|
} catch (error) {
|
|
903
910
|
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
@@ -918,15 +925,15 @@ class DeviceAta extends EventEmitter {
|
|
|
918
925
|
async start() {
|
|
919
926
|
try {
|
|
920
927
|
//melcloud device
|
|
921
|
-
this.melCloudAta = new MelCloudAta(this.device, this.
|
|
928
|
+
this.melCloudAta = new MelCloudAta(this.account, this.device, this.devicesFile, this.defaultTempsFile)
|
|
922
929
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
923
930
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
924
931
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
925
932
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
926
933
|
if (modelIndoor) this.emit('devInfo', `Indoor: ${modelIndoor}`);
|
|
927
934
|
if (modelOutdoor) this.emit('devInfo', `Outdoor: ${modelOutdoor}`);
|
|
928
|
-
this.emit('devInfo', `Serial: ${serialNumber}`);
|
|
929
|
-
this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
935
|
+
if (serialNumber) this.emit('devInfo', `Serial: ${serialNumber}`);
|
|
936
|
+
if (firmwareAppVersion) this.emit('devInfo', `Firmware: ${firmwareAppVersion}`);
|
|
930
937
|
this.emit('devInfo', `Manufacturer: ${manufacturer}`);
|
|
931
938
|
this.emit('devInfo', '----------------------------------');
|
|
932
939
|
this.displayDeviceInfo = false;
|
|
@@ -934,11 +941,11 @@ class DeviceAta extends EventEmitter {
|
|
|
934
941
|
|
|
935
942
|
//accessory info
|
|
936
943
|
this.manufacturer = manufacturer;
|
|
937
|
-
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText}
|
|
938
|
-
this.serialNumber = serialNumber;
|
|
939
|
-
this.firmwareRevision = firmwareAppVersion;
|
|
944
|
+
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText}`;
|
|
945
|
+
this.serialNumber = serialNumber.toString();
|
|
946
|
+
this.firmwareRevision = firmwareAppVersion.toString();
|
|
940
947
|
|
|
941
|
-
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, firmwareAppVersion);
|
|
948
|
+
this.informationService?.setCharacteristic(Characteristic.FirmwareRevision, this.firmwareAppVersion);
|
|
942
949
|
})
|
|
943
950
|
.on('deviceState', async (deviceData) => {
|
|
944
951
|
this.deviceData = deviceData;
|
|
@@ -951,33 +958,38 @@ class DeviceAta extends EventEmitter {
|
|
|
951
958
|
const hideDryModeControl = deviceData.HideDryModeControl ?? false;
|
|
952
959
|
|
|
953
960
|
//device info
|
|
954
|
-
const
|
|
955
|
-
const
|
|
956
|
-
const
|
|
957
|
-
const
|
|
958
|
-
const
|
|
959
|
-
const
|
|
960
|
-
const
|
|
961
|
-
const
|
|
962
|
-
const
|
|
963
|
-
const
|
|
964
|
-
const
|
|
965
|
-
const
|
|
961
|
+
const accountTypeMelcloud = this.accountType === 'melcloud';
|
|
962
|
+
const supportsAutomaticFanSpeed = deviceData.Device.HasAutomaticFanSpeed ?? false;
|
|
963
|
+
const supportsAirDirectionFunction = accountTypeMelcloud ? deviceData.Device.AirDirectionFunction : deviceData.Device.HasAirDirectionFunction;;
|
|
964
|
+
const supportsSwingFunction = accountTypeMelcloud ? deviceData.Device.SwingFunction : deviceData.Device.HasSwing;
|
|
965
|
+
const supportsWideVane = accountTypeMelcloud ? deviceData.Device.ModelSupportsWideVane : deviceData.Device.SupportsWideVane;
|
|
966
|
+
const supportsOutdoorTemperature = deviceData.Device.HasOutdoorTemperature ?? false;
|
|
967
|
+
const supportsFanSpeed = accountTypeMelcloud ? deviceData.Device.ModelSupportsFanSpeed : deviceData.Device.NumberOfFanSpeeds > 0;
|
|
968
|
+
const supportsAuto1 = accountTypeMelcloud ? deviceData.Device.ModelSupportsAuto : deviceData.Device.HasAutoOperationMode;
|
|
969
|
+
const supportsAuto = this.autoDryFanMode >= 1 && supportsAuto1
|
|
970
|
+
const supportsHeat1 = accountTypeMelcloud ? deviceData.Device.ModelSupportsHeat : deviceData.Device.HasHeatOperationMode
|
|
971
|
+
const supportsHeat = this.heatDryFanMode >= 1 && supportsHeat1;
|
|
972
|
+
const supportsDry = accountTypeMelcloud ? deviceData.Device.ModelSupportsDry : deviceData.Device.HasDryOperationMode;
|
|
973
|
+
const supportsCool1 = accountTypeMelcloud ? deviceData.Device.ModelSupportsCool : deviceData.Device.HasCoolOperationMode;
|
|
974
|
+
const supportsCool = this.coolDryFanMode >= 1 && supportsCool1;
|
|
975
|
+
const numberOfFanSpeeds = supportsFanSpeed ? deviceData.Device.NumberOfFanSpeeds : 0;
|
|
966
976
|
const minTempHeat = 10;
|
|
967
977
|
const maxTempHeat = 31;
|
|
968
|
-
const
|
|
969
|
-
const
|
|
978
|
+
const minTempCoolDryAuto = 16;
|
|
979
|
+
const maxTempCoolDryAuto = 31;
|
|
970
980
|
|
|
971
981
|
//device state
|
|
982
|
+
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
983
|
+
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
972
984
|
const power = deviceData.Device.Power ?? false;
|
|
973
985
|
const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
|
|
974
986
|
const roomTemperature = deviceData.Device.RoomTemperature;
|
|
975
|
-
const setTemperature = deviceData.Device.SetTemperature
|
|
976
|
-
const defaultHeatingSetTemperature = deviceData.Device.DefaultHeatingSetTemperature
|
|
977
|
-
const defaultCoolingSetTemperature = deviceData.Device.DefaultCoolingSetTemperature
|
|
987
|
+
const setTemperature = deviceData.Device.SetTemperature;
|
|
988
|
+
const defaultHeatingSetTemperature = deviceData.Device.DefaultHeatingSetTemperature;
|
|
989
|
+
const defaultCoolingSetTemperature = deviceData.Device.DefaultCoolingSetTemperature;
|
|
978
990
|
const actualFanSpeed = deviceData.Device.ActualFanSpeed;
|
|
979
991
|
const automaticFanSpeed = deviceData.Device.AutomaticFanSpeed;
|
|
980
|
-
const
|
|
992
|
+
const setFanSpeed = deviceData.Device[fanKey];
|
|
981
993
|
const operationMode = deviceData.Device.OperationMode;
|
|
982
994
|
const vaneVerticalDirection = deviceData.Device.VaneVerticalDirection;
|
|
983
995
|
const vaneVerticalSwing = deviceData.Device.VaneVerticalSwing;
|
|
@@ -986,26 +998,27 @@ class DeviceAta extends EventEmitter {
|
|
|
986
998
|
const prohibitSetTemperature = deviceData.Device.ProhibitSetTemperature ?? false;
|
|
987
999
|
const prohibitOperationMode = deviceData.Device.ProhibitOperationMode ?? false;
|
|
988
1000
|
const prohibitPower = deviceData.Device.ProhibitPower ?? false;
|
|
989
|
-
const
|
|
1001
|
+
const temperatureStep = deviceData.Device[tempStepKey] ? 0.5 : 1;
|
|
990
1002
|
const outdoorTemperature = deviceData.Device.OutdoorTemperature;
|
|
991
1003
|
|
|
992
1004
|
//accessory
|
|
993
1005
|
const obj = {
|
|
994
1006
|
presets: presetsOnServer,
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1007
|
+
supportsAutomaticFanSpeed: supportsAutomaticFanSpeed,
|
|
1008
|
+
supportsAirDirectionFunction: supportsAirDirectionFunction,
|
|
1009
|
+
supportsSwingFunction: supportsSwingFunction,
|
|
1010
|
+
supportsWideVane: supportsWideVane,
|
|
1011
|
+
supportsOutdoorTemperature: supportsOutdoorTemperature,
|
|
999
1012
|
numberOfFanSpeeds: numberOfFanSpeeds,
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1013
|
+
supportsFanSpeed: supportsFanSpeed,
|
|
1014
|
+
supportsAuto: supportsAuto,
|
|
1015
|
+
supportsHeat: supportsHeat,
|
|
1016
|
+
supportsDry: supportsDry,
|
|
1017
|
+
supportsCool: supportsCool,
|
|
1005
1018
|
minTempHeat: minTempHeat,
|
|
1006
1019
|
maxTempHeat: maxTempHeat,
|
|
1007
|
-
|
|
1008
|
-
|
|
1020
|
+
minTempCoolDryAuto: minTempCoolDryAuto,
|
|
1021
|
+
maxTempCoolDryAuto: maxTempCoolDryAuto,
|
|
1009
1022
|
power: power ? 1 : 0,
|
|
1010
1023
|
inStandbyMode: inStandbyMode,
|
|
1011
1024
|
operationMode: operationMode,
|
|
@@ -1020,15 +1033,15 @@ class DeviceAta extends EventEmitter {
|
|
|
1020
1033
|
automaticFanSpeed: automaticFanSpeed,
|
|
1021
1034
|
vaneVerticalSwing: vaneVerticalSwing,
|
|
1022
1035
|
vaneHorizontalSwing: vaneHorizontalSwing,
|
|
1023
|
-
|
|
1036
|
+
currentSwingMode: supportsSwingFunction && vaneHorizontalDirection === 12 && vaneVerticalDirection === 7 ? 1 : 0,
|
|
1024
1037
|
lockPhysicalControl: prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0,
|
|
1025
|
-
|
|
1038
|
+
temperatureStep: temperatureStep,
|
|
1026
1039
|
useFahrenheit: this.useFahrenheit,
|
|
1027
1040
|
temperatureUnit: TemperatureDisplayUnits[this.useFahrenheit]
|
|
1028
1041
|
};
|
|
1029
1042
|
|
|
1030
1043
|
//operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
|
|
1031
|
-
switch (this.
|
|
1044
|
+
switch (this.displayType) {
|
|
1032
1045
|
case 1: //Heater Cooler
|
|
1033
1046
|
switch (operationMode) {
|
|
1034
1047
|
case 1: //HEAT
|
|
@@ -1069,32 +1082,28 @@ class DeviceAta extends EventEmitter {
|
|
|
1069
1082
|
};
|
|
1070
1083
|
|
|
1071
1084
|
obj.currentOperationMode = !power ? 0 : inStandbyMode ? 1 : obj.currentOperationMode;
|
|
1072
|
-
obj.operationModeSetPropsMinValue =
|
|
1085
|
+
obj.operationModeSetPropsMinValue = supportsAuto && supportsHeat ? 0 : !supportsAuto && supportsHeat ? 1 : supportsAuto && !supportsHeat ? 0 : 2;
|
|
1073
1086
|
obj.operationModeSetPropsMaxValue = 2
|
|
1074
|
-
obj.operationModeSetPropsValidValues =
|
|
1087
|
+
obj.operationModeSetPropsValidValues = supportsAuto && supportsHeat ? [0, 1, 2] : !supportsAuto && supportsHeat ? [1, 2] : supportsAuto && !supportsHeat ? [0, 2] : [2];
|
|
1075
1088
|
|
|
1076
1089
|
//fan speed mode
|
|
1077
|
-
if (
|
|
1090
|
+
if (supportsFanSpeed) {
|
|
1078
1091
|
switch (numberOfFanSpeeds) {
|
|
1079
1092
|
case 2: //Fan speed mode 2
|
|
1080
|
-
obj.
|
|
1081
|
-
obj.fanSpeedSetPropsMaxValue =
|
|
1093
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [3, 1, 2][setFanSpeed] : [0, 1, 2][setFanSpeed];
|
|
1094
|
+
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 3 : 2;
|
|
1082
1095
|
break;
|
|
1083
1096
|
case 3: //Fan speed mode 3
|
|
1084
|
-
obj.
|
|
1085
|
-
obj.fanSpeedSetPropsMaxValue =
|
|
1097
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [4, 1, 2, 3][setFanSpeed] : [0, 1, 2, 3][setFanSpeed];
|
|
1098
|
+
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 4 : 3;
|
|
1086
1099
|
break;
|
|
1087
1100
|
case 4: //Fan speed mode 4
|
|
1088
|
-
obj.
|
|
1089
|
-
obj.fanSpeedSetPropsMaxValue =
|
|
1101
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [5, 1, 2, 3, 4][setFanSpeed] : [0, 1, 2, 3, 4][setFanSpeed];
|
|
1102
|
+
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 5 : 4;
|
|
1090
1103
|
break;
|
|
1091
1104
|
case 5: //Fan speed mode 5
|
|
1092
|
-
obj.
|
|
1093
|
-
obj.fanSpeedSetPropsMaxValue =
|
|
1094
|
-
break;
|
|
1095
|
-
case 6: //Fan speed mode 6
|
|
1096
|
-
obj.fanSpeed = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6][fanSpeed] : [0, 1, 2, 3, 4, 5, 6][fanSpeed];
|
|
1097
|
-
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 7 : 6;
|
|
1105
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][setFanSpeed] : [0, 1, 2, 3, 4, 5][setFanSpeed];
|
|
1106
|
+
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 6 : 5;
|
|
1098
1107
|
break;
|
|
1099
1108
|
};
|
|
1100
1109
|
};
|
|
@@ -1107,10 +1116,10 @@ class DeviceAta extends EventEmitter {
|
|
|
1107
1116
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
|
1108
1117
|
.updateCharacteristic(Characteristic.LockPhysicalControls, obj.lockPhysicalControl)
|
|
1109
1118
|
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit)
|
|
1110
|
-
.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature);
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1119
|
+
.updateCharacteristic(Characteristic.CoolingThresholdTemperature, operationMode === 8 ? defaultCoolingSetTemperature : setTemperature);
|
|
1120
|
+
if (supportsHeat) this.melCloudService?.updateCharacteristic(Characteristic.HeatingThresholdTemperature, operationMode === 8 ? defaultHeatingSetTemperature : setTemperature);
|
|
1121
|
+
if (supportsFanSpeed) this.melCloudService?.updateCharacteristic(Characteristic.RotationSpeed, obj.currentFanSpeed);
|
|
1122
|
+
if (supportsSwingFunction) this.melCloudService?.updateCharacteristic(Characteristic.SwingMode, obj.currentSwingMode);
|
|
1114
1123
|
break;
|
|
1115
1124
|
case 2: //Thermostat
|
|
1116
1125
|
switch (operationMode) {
|
|
@@ -1154,8 +1163,8 @@ class DeviceAta extends EventEmitter {
|
|
|
1154
1163
|
obj.currentOperationMode = !power ? 0 : obj.currentOperationMode;
|
|
1155
1164
|
obj.targetOperationMode = !power ? 0 : obj.targetOperationMode;
|
|
1156
1165
|
obj.operationModeSetPropsMinValue = 0
|
|
1157
|
-
obj.operationModeSetPropsMaxValue =
|
|
1158
|
-
obj.operationModeSetPropsValidValues =
|
|
1166
|
+
obj.operationModeSetPropsMaxValue = supportsAuto && supportsHeat ? 3 : !supportsAuto && supportsHeat ? 2 : supportsAuto && !supportsHeat ? 3 : 2;
|
|
1167
|
+
obj.operationModeSetPropsValidValues = supportsAuto && supportsHeat ? [0, 1, 2, 3] : !supportsAuto && supportsHeat ? [0, 1, 2] : supportsAuto && !supportsHeat ? [0, 2, 3] : [0, 2];
|
|
1159
1168
|
|
|
1160
1169
|
//update characteristics
|
|
1161
1170
|
this.melCloudService
|
|
@@ -1179,9 +1188,9 @@ class DeviceAta extends EventEmitter {
|
|
|
1179
1188
|
preset.state = presetData ? (presetData.Power === power
|
|
1180
1189
|
&& presetData.SetTemperature === setTemperature
|
|
1181
1190
|
&& presetData.OperationMode === operationMode
|
|
1182
|
-
&& presetData.
|
|
1183
|
-
&& presetData.
|
|
1184
|
-
&& presetData
|
|
1191
|
+
&& presetData.VaneHorizontalDirection === vaneHorizontalDirection
|
|
1192
|
+
&& presetData.VaneVerticalDirection === vaneVerticalDirection
|
|
1193
|
+
&& presetData[fanKey] === setFanSpeed) : false;
|
|
1185
1194
|
|
|
1186
1195
|
const characteristicType = preset.characteristicType;
|
|
1187
1196
|
this.presetsServices?.[i]?.updateCharacteristic(characteristicType, preset.state);
|
|
@@ -1266,25 +1275,25 @@ class DeviceAta extends EventEmitter {
|
|
|
1266
1275
|
button.state = power ? (hideVaneControls === true) : false;
|
|
1267
1276
|
break;
|
|
1268
1277
|
case 30: //FAN SPEED MODE AUTO
|
|
1269
|
-
button.state = power ? (
|
|
1278
|
+
button.state = power ? (setFanSpeed === 0) : false;
|
|
1270
1279
|
break;
|
|
1271
1280
|
case 31: //FAN SPEED MODE 1
|
|
1272
|
-
button.state = power ? (
|
|
1281
|
+
button.state = power ? (setFanSpeed === 1) : false;
|
|
1273
1282
|
break;
|
|
1274
1283
|
case 32: //FAN SPEED MODE 2
|
|
1275
|
-
button.state = power ? (
|
|
1284
|
+
button.state = power ? (setFanSpeed === 2) : false;
|
|
1276
1285
|
break;
|
|
1277
1286
|
case 33: //FAN SPEED MODE 3
|
|
1278
|
-
button.state = power ? (
|
|
1287
|
+
button.state = power ? (setFanSpeed === 3) : false;
|
|
1279
1288
|
break;
|
|
1280
1289
|
case 34: //FAN SPEED MODE 4
|
|
1281
|
-
button.state = power ? (
|
|
1290
|
+
button.state = power ? (setFanSpeed === 4) : false;
|
|
1282
1291
|
break;
|
|
1283
1292
|
case 35: //FAN SPEED MODE 5
|
|
1284
|
-
button.state = power ? (
|
|
1293
|
+
button.state = power ? (setFanSpeed === 5) : false;
|
|
1285
1294
|
break;
|
|
1286
1295
|
case 36: //FAN SPEED MODE 6
|
|
1287
|
-
button.state = power ? (
|
|
1296
|
+
button.state = power ? (setFanSpeed === 6) : false;
|
|
1288
1297
|
break;
|
|
1289
1298
|
case 37: //PHYSICAL LOCK CONTROLS ALL
|
|
1290
1299
|
button.state = (obj.lockPhysicalControl === 1);
|
|
@@ -1312,18 +1321,18 @@ class DeviceAta extends EventEmitter {
|
|
|
1312
1321
|
//log current state
|
|
1313
1322
|
if (this.logInfo) {
|
|
1314
1323
|
this.emit('info', `Power: ${power ? 'ON' : 'OFF'}`);
|
|
1315
|
-
this.emit('info', `Target operation mode: ${AirConditioner.
|
|
1316
|
-
this.emit('info', `Current operation mode: ${this.
|
|
1324
|
+
this.emit('info', `Target operation mode: ${AirConditioner.OperationModeMapEnumToString[operationMode]}`);
|
|
1325
|
+
this.emit('info', `Current operation mode: ${this.displayType === 1 ? AirConditioner.CurrentOperationModeHeatherCoolerMapEnumToString[obj.currentOperationMode] : AirConditioner.CurrentOperationModeThermostatMapEnumToString[obj.currentOperationMode]}`);
|
|
1317
1326
|
this.emit('info', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
|
|
1318
1327
|
this.emit('info', `Current temperature: ${roomTemperature}${obj.temperatureUnit}`);
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1328
|
+
if (supportsOutdoorTemperature && outdoorTemperature !== null) this.emit('info', `Outdoor temperature: ${outdoorTemperature}${obj.temperatureUnit}`);
|
|
1329
|
+
if (supportsFanSpeed) this.emit('info', `Target fan speed: ${AirConditioner.FanSpeedMapEnumToString[setFanSpeed]}`);
|
|
1330
|
+
if (supportsFanSpeed) this.emit('info', `Current fan speed: ${AirConditioner.FanSpeedCurrentMapEnumToString[actualFanSpeed]}`);
|
|
1331
|
+
if (vaneHorizontalDirection !== null) this.emit('info', `Vane horizontal: ${AirConditioner.VaneHorizontalDirectionMapEnumToString[vaneHorizontalDirection]}`);
|
|
1332
|
+
if (vaneVerticalDirection !== null) this.emit('info', `Vane vertical: ${AirConditioner.VaneVerticalDirectionMapEnumToString[vaneVerticalDirection]}`);
|
|
1333
|
+
if (supportsSwingFunction) this.emit('info', `Air direction: ${AirConditioner.AirDirectionMapEnumToString[obj.currentSwingMode]}`);
|
|
1325
1334
|
this.emit('info', `Temperature display unit: ${obj.temperatureUnit}`);
|
|
1326
|
-
this.emit('info', `Lock physical controls: ${obj.lockPhysicalControl ? '
|
|
1335
|
+
this.emit('info', `Lock physical controls: ${obj.lockPhysicalControl ? 'Locked' : 'Unlocked'}`);
|
|
1327
1336
|
};
|
|
1328
1337
|
})
|
|
1329
1338
|
.on('success', (success) => this.emit('success', success))
|