homebridge-melcloud-control 3.1.10 → 3.1.16
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 +7 -2
- package/README.md +8 -8
- package/homebridge-ui/server.js +1 -3
- package/index.js +4 -3
- package/package.json +2 -2
- package/src/deviceata.js +353 -358
- package/src/deviceatw.js +349 -345
- package/src/deviceerv.js +205 -208
- package/src/melcloud.js +25 -25
- package/src/melcloudata.js +71 -80
- package/src/melcloudatw.js +67 -67
- package/src/melclouderv.js +45 -56
package/src/deviceata.js
CHANGED
|
@@ -7,7 +7,7 @@ const CONSTANTS = require('./constants.json');
|
|
|
7
7
|
let Accessory, Characteristic, Service, Categories, AccessoryUUID;
|
|
8
8
|
|
|
9
9
|
class DeviceAta extends EventEmitter {
|
|
10
|
-
constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText,
|
|
10
|
+
constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, devicesFile, refreshInterval, useFahrenheit) {
|
|
11
11
|
super();
|
|
12
12
|
|
|
13
13
|
Accessory = api.platformAccessory;
|
|
@@ -34,10 +34,11 @@ class DeviceAta extends EventEmitter {
|
|
|
34
34
|
this.deviceId = deviceId;
|
|
35
35
|
this.deviceName = deviceName;
|
|
36
36
|
this.deviceTypeText = deviceTypeText;
|
|
37
|
-
this.accountFile = accountFile;
|
|
38
37
|
this.devicesFile = devicesFile;
|
|
39
38
|
this.refreshInterval = refreshInterval;
|
|
39
|
+
this.useFahrenheit = useFahrenheit;
|
|
40
40
|
this.startPrepareAccessory = true;
|
|
41
|
+
this.displayDeviceInfo = true;
|
|
41
42
|
|
|
42
43
|
//external integrations
|
|
43
44
|
this.restFul = account.restFul ?? {};
|
|
@@ -72,10 +73,10 @@ class DeviceAta extends EventEmitter {
|
|
|
72
73
|
this.buttonsConfigured = [];
|
|
73
74
|
for (const button of this.buttons) {
|
|
74
75
|
const buttonName = button.name ?? false;
|
|
75
|
-
const buttonMode = button.mode ??
|
|
76
|
+
const buttonMode = button.mode ?? -1;
|
|
76
77
|
const buttonDisplayType = button.displayType ?? 0;
|
|
77
78
|
const buttonNamePrefix = button.namePrefix ?? false;
|
|
78
|
-
if (buttonName && buttonMode && buttonDisplayType > 0) {
|
|
79
|
+
if (buttonName && buttonMode >= 0 && buttonDisplayType > 0) {
|
|
79
80
|
const buttonServiceType = ['', Service.Outlet, Service.Switch, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][buttonDisplayType];
|
|
80
81
|
const buttonCharacteristicType = ['', Characteristic.On, Characteristic.On, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][buttonDisplayType];
|
|
81
82
|
button.namePrefix = buttonNamePrefix;
|
|
@@ -94,11 +95,6 @@ class DeviceAta extends EventEmitter {
|
|
|
94
95
|
this.accessory.currentOperationMode = 0;
|
|
95
96
|
this.accessory.targetOperationMode = 0;
|
|
96
97
|
this.accessory.fanSpeed = 0;
|
|
97
|
-
|
|
98
|
-
this.accessory.operationModeSetPropsMinValue = 0;
|
|
99
|
-
this.accessory.operationModeSetPropsMaxValue = 3;
|
|
100
|
-
this.accessory.operationModeSetPropsValidValues = [0];
|
|
101
|
-
this.accessory.fanSpeedSetPropsMaxValue = 2;
|
|
102
98
|
};
|
|
103
99
|
|
|
104
100
|
async start() {
|
|
@@ -106,13 +102,12 @@ class DeviceAta extends EventEmitter {
|
|
|
106
102
|
//melcloud device
|
|
107
103
|
this.melCloudAta = new MelCloudAta({
|
|
108
104
|
contextKey: this.contextKey,
|
|
109
|
-
accountFile: this.accountFile,
|
|
110
105
|
devicesFile: this.devicesFile,
|
|
111
106
|
deviceId: this.deviceId,
|
|
112
107
|
debugLog: this.enableDebugMode
|
|
113
108
|
});
|
|
114
109
|
|
|
115
|
-
this.melCloudAta.on('externalIntegrations', (deviceData
|
|
110
|
+
this.melCloudAta.on('externalIntegrations', (deviceData) => {
|
|
116
111
|
try {
|
|
117
112
|
//RESTFul server
|
|
118
113
|
const restFulEnabled = this.restFul.enable || false;
|
|
@@ -129,7 +124,7 @@ class DeviceAta extends EventEmitter {
|
|
|
129
124
|
})
|
|
130
125
|
.on('set', async (key, value) => {
|
|
131
126
|
try {
|
|
132
|
-
await this.setOverExternalIntegration('RESTFul',
|
|
127
|
+
await this.setOverExternalIntegration('RESTFul', deviceData, key, value);
|
|
133
128
|
} catch (error) {
|
|
134
129
|
this.emit('warn', `RESTFul set error: ${error}.`);
|
|
135
130
|
};
|
|
@@ -142,7 +137,7 @@ class DeviceAta extends EventEmitter {
|
|
|
142
137
|
});
|
|
143
138
|
}
|
|
144
139
|
const restFul0 = this.restFulConnected ? this.restFul1.update('info', deviceData) : false;
|
|
145
|
-
const restFul1 = this.restFulConnected ? this.restFul1.update('state',
|
|
140
|
+
const restFul1 = this.restFulConnected ? this.restFul1.update('state', deviceData.Device) : false;
|
|
146
141
|
}
|
|
147
142
|
|
|
148
143
|
//MQTT client
|
|
@@ -168,7 +163,7 @@ class DeviceAta extends EventEmitter {
|
|
|
168
163
|
})
|
|
169
164
|
.on('set', async (key, value) => {
|
|
170
165
|
try {
|
|
171
|
-
await this.setOverExternalIntegration('MQTT',
|
|
166
|
+
await this.setOverExternalIntegration('MQTT', deviceData, key, value);
|
|
172
167
|
} catch (error) {
|
|
173
168
|
this.emit('warn', `MQTT set error: ${error}.`);
|
|
174
169
|
};
|
|
@@ -181,7 +176,7 @@ class DeviceAta extends EventEmitter {
|
|
|
181
176
|
});
|
|
182
177
|
}
|
|
183
178
|
const mqtt0 = this.mqttConnected ? this.mqtt1.emit('publish', `Info`, deviceData) : false;
|
|
184
|
-
const mqtt1 = this.mqttConnected ? this.mqtt1.emit('publish', `State`,
|
|
179
|
+
const mqtt1 = this.mqttConnected ? this.mqtt1.emit('publish', `State`, deviceData.Device) : false;
|
|
185
180
|
}
|
|
186
181
|
|
|
187
182
|
} catch (error) {
|
|
@@ -189,6 +184,10 @@ class DeviceAta extends EventEmitter {
|
|
|
189
184
|
};
|
|
190
185
|
})
|
|
191
186
|
.on('deviceInfo', (manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
187
|
+
if (!this.displayDeviceInfo) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
192
191
|
if (!this.disableLogDeviceInfo) {
|
|
193
192
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
194
193
|
this.emit('devInfo', `Account: ${this.accountName}`);
|
|
@@ -205,8 +204,9 @@ class DeviceAta extends EventEmitter {
|
|
|
205
204
|
this.model = modelIndoor ? modelIndoor : modelOutdoor ? modelOutdoor : `${this.deviceTypeText} ${this.deviceId}`;
|
|
206
205
|
this.serialNumber = serialNumber;
|
|
207
206
|
this.firmwareRevision = firmwareAppVersion;
|
|
207
|
+
this.displayDeviceInfo = false;
|
|
208
208
|
})
|
|
209
|
-
.on('deviceState', async (deviceData
|
|
209
|
+
.on('deviceState', async (deviceData) => {
|
|
210
210
|
//device info
|
|
211
211
|
const displayMode = this.displayMode;
|
|
212
212
|
const hasAutomaticFanSpeed = deviceData.Device.HasAutomaticFanSpeed ?? false;
|
|
@@ -223,41 +223,41 @@ class DeviceAta extends EventEmitter {
|
|
|
223
223
|
const modelSupportsDry = deviceData.Device.ModelSupportsDry ?? false;
|
|
224
224
|
const temperatureIncrement = deviceData.Device.TemperatureIncrement ?? 1;
|
|
225
225
|
const outdoorTemperature = deviceData.Device.OutdoorTemperature;
|
|
226
|
-
const temperatureUnit = CONSTANTS.TemperatureDisplayUnits[useFahrenheit];
|
|
226
|
+
const temperatureUnit = CONSTANTS.TemperatureDisplayUnits[this.useFahrenheit];
|
|
227
227
|
|
|
228
228
|
//presets
|
|
229
229
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
230
230
|
|
|
231
231
|
//device state
|
|
232
|
-
const power =
|
|
233
|
-
const offline =
|
|
234
|
-
const inStandbyMode =
|
|
235
|
-
const roomTemperature =
|
|
236
|
-
const setTemperature =
|
|
237
|
-
const
|
|
238
|
-
const operationMode =
|
|
239
|
-
const vaneHorizontal =
|
|
240
|
-
const vaneVertical =
|
|
241
|
-
const hideVaneControls =
|
|
242
|
-
const hideDryModeControl =
|
|
243
|
-
const prohibitSetTemperature =
|
|
244
|
-
const prohibitOperationMode =
|
|
245
|
-
const prohibitPower =
|
|
232
|
+
const power = deviceData.Device.Power ?? false;
|
|
233
|
+
const offline = deviceData.Device.Offline ?? false;
|
|
234
|
+
const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
|
|
235
|
+
const roomTemperature = deviceData.Device.RoomTemperature;
|
|
236
|
+
const setTemperature = deviceData.Device.SetTemperature;
|
|
237
|
+
const fanSpeed = deviceData.Device.FanSpeed;
|
|
238
|
+
const operationMode = deviceData.Device.OperationMode;
|
|
239
|
+
const vaneHorizontal = deviceData.Device.VaneHorizontalDirection;
|
|
240
|
+
const vaneVertical = deviceData.Device.VaneVerticalDirection;
|
|
241
|
+
const hideVaneControls = deviceData.Device.HideVaneControls;
|
|
242
|
+
const hideDryModeControl = deviceData.Device.HideDryModeControl;
|
|
243
|
+
const prohibitSetTemperature = deviceData.Device.ProhibitSetTemperature ?? false;
|
|
244
|
+
const prohibitOperationMode = deviceData.Device.ProhibitOperationMode ?? false;
|
|
245
|
+
const prohibitPower = deviceData.Device.ProhibitPower ?? false;
|
|
246
246
|
|
|
247
247
|
//accessory
|
|
248
248
|
this.accessory.presetsOnServer = presetsOnServer;
|
|
249
249
|
this.accessory.power = power ? 1 : 0;
|
|
250
|
-
this.accessory.offline = offline;
|
|
250
|
+
this.accessory.offline = offline ?? false;
|
|
251
251
|
this.accessory.roomTemperature = roomTemperature;
|
|
252
252
|
this.accessory.outdoorTemperature = outdoorTemperature;
|
|
253
253
|
this.accessory.setTemperature = setTemperature;
|
|
254
|
-
this.accessory.
|
|
254
|
+
this.accessory.fanSpeed = fanSpeed;
|
|
255
255
|
this.accessory.vaneHorizontal = vaneHorizontal;
|
|
256
256
|
this.accessory.vaneVertical = vaneVertical;
|
|
257
257
|
this.accessory.swingMode = swingFunction && vaneHorizontal === 12 && vaneVertical === 7 ? 1 : 0;
|
|
258
258
|
this.accessory.lockPhysicalControl = prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0;
|
|
259
259
|
this.accessory.temperatureIncrement = temperatureIncrement;
|
|
260
|
-
this.accessory.useFahrenheit = useFahrenheit;
|
|
260
|
+
this.accessory.useFahrenheit = this.useFahrenheit;
|
|
261
261
|
this.accessory.temperatureUnit = temperatureUnit;
|
|
262
262
|
this.accessory.hasAutomaticFanSpeed = hasAutomaticFanSpeed;
|
|
263
263
|
this.accessory.airDirectionFunction = airDirectionFunction;
|
|
@@ -328,25 +328,26 @@ class DeviceAta extends EventEmitter {
|
|
|
328
328
|
|
|
329
329
|
//fan speed mode
|
|
330
330
|
if (modelSupportsFanSpeed) {
|
|
331
|
+
this.accessory.fanSpeedSetPropsMaxValue = 2;
|
|
331
332
|
switch (numberOfFanSpeeds) {
|
|
332
333
|
case 2: //Fan speed mode 2
|
|
333
|
-
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][
|
|
334
|
+
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][fanSpeed] : [0, 1, 2][fanSpeed];
|
|
334
335
|
this.accessory.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 3 : 2;
|
|
335
336
|
break;
|
|
336
337
|
case 3: //Fan speed mode 3
|
|
337
|
-
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][
|
|
338
|
+
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][fanSpeed] : [0, 1, 2, 3][fanSpeed];
|
|
338
339
|
this.accessory.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
|
|
339
340
|
break;
|
|
340
341
|
case 4: //Fan speed mode 4
|
|
341
|
-
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][
|
|
342
|
+
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][fanSpeed] : [0, 1, 2, 3, 4][fanSpeed];
|
|
342
343
|
this.accessory.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
|
|
343
344
|
break;
|
|
344
345
|
case 5: //Fan speed mode 5
|
|
345
|
-
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][
|
|
346
|
+
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][fanSpeed] : [0, 1, 2, 3, 4, 5][fanSpeed];
|
|
346
347
|
this.accessory.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 6 : 5;
|
|
347
348
|
break;
|
|
348
349
|
case 6: //Fan speed mode 6
|
|
349
|
-
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6][
|
|
350
|
+
this.accessory.fanSpeed = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6][fanSpeed] : [0, 1, 2, 3, 4, 5, 6][fanSpeed];
|
|
350
351
|
this.accessory.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 7 : 6;
|
|
351
352
|
break;
|
|
352
353
|
};
|
|
@@ -355,14 +356,14 @@ class DeviceAta extends EventEmitter {
|
|
|
355
356
|
//update characteristics
|
|
356
357
|
if (this.melCloudService) {
|
|
357
358
|
this.melCloudService
|
|
358
|
-
.updateCharacteristic(Characteristic.Active, power
|
|
359
|
+
.updateCharacteristic(Characteristic.Active, this.accessory.power)
|
|
359
360
|
.updateCharacteristic(Characteristic.CurrentHeaterCoolerState, this.accessory.currentOperationMode)
|
|
360
361
|
.updateCharacteristic(Characteristic.TargetHeaterCoolerState, this.accessory.targetOperationMode)
|
|
361
362
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
|
362
363
|
.updateCharacteristic(Characteristic.HeatingThresholdTemperature, setTemperature)
|
|
363
364
|
.updateCharacteristic(Characteristic.CoolingThresholdTemperature, setTemperature)
|
|
364
365
|
.updateCharacteristic(Characteristic.LockPhysicalControls, this.accessory.lockPhysicalControl)
|
|
365
|
-
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, useFahrenheit);
|
|
366
|
+
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit);
|
|
366
367
|
const updateRS = modelSupportsFanSpeed ? this.melCloudService.updateCharacteristic(Characteristic.RotationSpeed, this.accessory.fanSpeed) : false;
|
|
367
368
|
const updateSM = swingFunction ? this.melCloudService.updateCharacteristic(Characteristic.SwingMode, this.accessory.swingMode) : false;
|
|
368
369
|
};
|
|
@@ -431,9 +432,12 @@ class DeviceAta extends EventEmitter {
|
|
|
431
432
|
.updateCharacteristic(Characteristic.TargetHeatingCoolingState, this.accessory.targetOperationMode)
|
|
432
433
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
|
433
434
|
.updateCharacteristic(Characteristic.TargetTemperature, setTemperature)
|
|
434
|
-
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, useFahrenheit);
|
|
435
|
+
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit);
|
|
435
436
|
};
|
|
436
437
|
break;
|
|
438
|
+
default:
|
|
439
|
+
this.emit('warn', `Unknown display mode: ${displayMode}`);
|
|
440
|
+
return;
|
|
437
441
|
};
|
|
438
442
|
|
|
439
443
|
if (this.roomTemperatureSensorService) {
|
|
@@ -450,15 +454,14 @@ class DeviceAta extends EventEmitter {
|
|
|
450
454
|
if (this.presetsConfigured.length > 0) {
|
|
451
455
|
for (let i = 0; i < this.presetsConfigured.length; i++) {
|
|
452
456
|
const preset = this.presetsConfigured[i];
|
|
453
|
-
const
|
|
454
|
-
const presetData = presetsOnServer[index];
|
|
457
|
+
const presetData = presetsOnServer.find(p => p.ID === preset.Id);
|
|
455
458
|
|
|
456
459
|
preset.state = presetData ? (presetData.Power === power
|
|
457
460
|
&& presetData.SetTemperature === setTemperature
|
|
458
461
|
&& presetData.OperationMode === operationMode
|
|
459
462
|
&& presetData.VaneHorizontal === vaneHorizontal
|
|
460
463
|
&& presetData.VaneVertical === vaneVertical
|
|
461
|
-
&& presetData.FanSpeed ===
|
|
464
|
+
&& presetData.FanSpeed === fanSpeed) : false;
|
|
462
465
|
|
|
463
466
|
if (this.presetsServices) {
|
|
464
467
|
const characteristicType = preset.characteristicType;
|
|
@@ -547,25 +550,25 @@ class DeviceAta extends EventEmitter {
|
|
|
547
550
|
button.state = power ? (hideVaneControls === true) : false;
|
|
548
551
|
break;
|
|
549
552
|
case 30: //FAN SPEED MODE AUTO
|
|
550
|
-
button.state = power ? (
|
|
553
|
+
button.state = power ? (fanSpeed === 0) : false;
|
|
551
554
|
break;
|
|
552
555
|
case 31: //FAN SPEED MODE 1
|
|
553
|
-
button.state = power ? (
|
|
556
|
+
button.state = power ? (fanSpeed === 1) : false;
|
|
554
557
|
break;
|
|
555
558
|
case 32: //FAN SPEED MODE 2
|
|
556
|
-
button.state = power ? (
|
|
559
|
+
button.state = power ? (fanSpeed === 2) : false;
|
|
557
560
|
break;
|
|
558
561
|
case 33: //FAN SPEED MODE 3
|
|
559
|
-
button.state = power ? (
|
|
562
|
+
button.state = power ? (fanSpeed === 3) : false;
|
|
560
563
|
break;
|
|
561
564
|
case 34: //FAN SPEED MODE 4
|
|
562
|
-
button.state = power ? (
|
|
565
|
+
button.state = power ? (fanSpeed === 4) : false;
|
|
563
566
|
break;
|
|
564
567
|
case 35: //FAN SPEED MODE 5
|
|
565
|
-
button.state = power ? (
|
|
568
|
+
button.state = power ? (fanSpeed === 5) : false;
|
|
566
569
|
break;
|
|
567
570
|
case 36: //FAN SPEED MODE 6
|
|
568
|
-
button.state = power ? (
|
|
571
|
+
button.state = power ? (fanSpeed === 6) : false;
|
|
569
572
|
break;
|
|
570
573
|
case 37: //PHYSICAL LOCK CONTROLS ALL
|
|
571
574
|
button.state = (this.accessory.lockPhysicalControl === 1);
|
|
@@ -603,7 +606,7 @@ class DeviceAta extends EventEmitter {
|
|
|
603
606
|
const info0 = hasOutdoorTemperature && this.accessory.outdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${roomTemperature}${temperatureUnit}`) : false;
|
|
604
607
|
const info1 = displayMode === 0 ? this.emit('message', `Heating threshold temperature: ${setTemperature}${temperatureUnit}`) : false;
|
|
605
608
|
const info2 = displayMode === 0 ? this.emit('message', `Cooling threshold temperature: ${setTemperature}${temperatureUnit}`) : false;
|
|
606
|
-
const info3 = modelSupportsFanSpeed ? this.emit('message', `Fan speed mode: ${CONSTANTS.AirConditioner.FanSpeed[
|
|
609
|
+
const info3 = modelSupportsFanSpeed ? this.emit('message', `Fan speed mode: ${CONSTANTS.AirConditioner.FanSpeed[fanSpeed]}`) : false;
|
|
607
610
|
const info4 = swingFunction ? this.emit('message', `Vane swing mode: ${CONSTANTS.AirConditioner.AirDirection[this.accessory.swingMode ? 6 : 0]}`) : false;
|
|
608
611
|
this.emit('message', `Temperature display unit: ${temperatureUnit}`);
|
|
609
612
|
this.emit('message', `Lock physical controls: ${this.accessory.lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
|
|
@@ -615,7 +618,7 @@ class DeviceAta extends EventEmitter {
|
|
|
615
618
|
}
|
|
616
619
|
|
|
617
620
|
try {
|
|
618
|
-
const accessory = await this.prepareAccessory(this.accountInfo,
|
|
621
|
+
const accessory = await this.prepareAccessory(this.accountInfo, deviceData, this.deviceId, this.deviceTypeText, this.deviceName, this.accountName);
|
|
619
622
|
this.emit('publishAccessory', accessory);
|
|
620
623
|
this.startPrepareAccessory = false;
|
|
621
624
|
} catch (error) {
|
|
@@ -633,16 +636,13 @@ class DeviceAta extends EventEmitter {
|
|
|
633
636
|
})
|
|
634
637
|
.on('error', async (error) => {
|
|
635
638
|
this.emit('error', error);
|
|
636
|
-
this.melCloudAta.impulseGenerator.stop();
|
|
637
|
-
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
638
|
-
this.melCloudAta.impulseGenerator.start([{ name: 'checkState', sampling: this.refreshInterval }]);
|
|
639
639
|
});
|
|
640
640
|
|
|
641
641
|
//check state
|
|
642
642
|
await this.melCloudAta.checkState();
|
|
643
643
|
|
|
644
644
|
//start impule generator
|
|
645
|
-
this.melCloudAta.impulseGenerator.start([{ name: 'checkState', sampling: this.refreshInterval }]);
|
|
645
|
+
await this.melCloudAta.impulseGenerator.start([{ name: 'checkState', sampling: this.refreshInterval }]);
|
|
646
646
|
|
|
647
647
|
return true;
|
|
648
648
|
} catch (error) {
|
|
@@ -650,74 +650,74 @@ class DeviceAta extends EventEmitter {
|
|
|
650
650
|
};
|
|
651
651
|
};
|
|
652
652
|
|
|
653
|
-
async setOverExternalIntegration(integration,
|
|
653
|
+
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
654
654
|
try {
|
|
655
655
|
let set = false
|
|
656
656
|
switch (key) {
|
|
657
657
|
case 'Power':
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
set = await this.melCloudAta.send(
|
|
658
|
+
deviceData.Device[key] = value;
|
|
659
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
660
|
+
set = await this.melCloudAta.send(deviceData);
|
|
661
661
|
break;
|
|
662
662
|
case 'OperationMode':
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
set = await this.melCloudAta.send(
|
|
663
|
+
deviceData.Device[key] = value;
|
|
664
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
665
|
+
set = await this.melCloudAta.send(deviceData);
|
|
666
666
|
break;
|
|
667
667
|
case 'SetTemperature':
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
set = await this.melCloudAta.send(
|
|
668
|
+
deviceData.Device[key] = value;
|
|
669
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
670
|
+
set = await this.melCloudAta.send(deviceData);
|
|
671
671
|
break;
|
|
672
672
|
case 'DefaultCoolingSetTemperature':
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
set = await this.melCloudAta.send(
|
|
673
|
+
deviceData.Device[key] = value;
|
|
674
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
675
|
+
set = await this.melCloudAta.send(deviceData);
|
|
676
676
|
break;
|
|
677
677
|
case 'DefaultHeatingSetTemperature':
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
set = await this.melCloudAta.send(
|
|
678
|
+
deviceData.Device[key] = value;
|
|
679
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
680
|
+
set = await this.melCloudAta.send(deviceData);
|
|
681
681
|
break;
|
|
682
682
|
case 'SetFanSpeed':
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
set = await this.melCloudAta.send(
|
|
683
|
+
deviceData.Device[key] = value;
|
|
684
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
685
|
+
set = await this.melCloudAta.send(deviceData);
|
|
686
686
|
break;
|
|
687
|
-
case '
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
set = await this.melCloudAta.send(
|
|
687
|
+
case 'VaneHorizontalDirection':
|
|
688
|
+
deviceData.Device[key] = value;
|
|
689
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
690
|
+
set = await this.melCloudAta.send(deviceData);
|
|
691
691
|
break;
|
|
692
|
-
case '
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
set = await this.melCloudAta.send(
|
|
692
|
+
case 'VaneVerticalDirection':
|
|
693
|
+
deviceData.Device[key] = value;
|
|
694
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
695
|
+
set = await this.melCloudAta.send(deviceData);
|
|
696
696
|
break;
|
|
697
697
|
case 'HideVaneControls':
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
set = await this.melCloudAta.send(
|
|
698
|
+
deviceData.Device[key] = value;
|
|
699
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
700
|
+
set = await this.melCloudAta.send(deviceData);
|
|
701
701
|
break;
|
|
702
702
|
case 'HideDryModeControl':
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
await this.melCloudAta.send(
|
|
703
|
+
deviceData.Device[key] = value;
|
|
704
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
705
|
+
await this.melCloudAta.send(deviceData);
|
|
706
706
|
break;
|
|
707
707
|
case 'ProhibitSetTemperature':
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
set = await this.melCloudAta.send(
|
|
708
|
+
deviceData.Device[key] = value;
|
|
709
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
710
|
+
set = await this.melCloudAta.send(deviceData);
|
|
711
711
|
break;
|
|
712
712
|
case 'ProhibitOperationMode':
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
await this.melCloudAta.send(
|
|
713
|
+
deviceData.Device[key] = value;
|
|
714
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
715
|
+
await this.melCloudAta.send(deviceData);
|
|
716
716
|
break;
|
|
717
717
|
case 'ProhibitPower':
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
set = await this.melCloudAta.send(
|
|
718
|
+
deviceData.Device[key] = value;
|
|
719
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
720
|
+
set = await this.melCloudAta.send(deviceData);
|
|
721
721
|
break;
|
|
722
722
|
default:
|
|
723
723
|
this.emit('warn', `${integration}, received key: ${key}, value: ${value}`);
|
|
@@ -730,7 +730,7 @@ class DeviceAta extends EventEmitter {
|
|
|
730
730
|
}
|
|
731
731
|
|
|
732
732
|
//prepare accessory
|
|
733
|
-
async prepareAccessory(accountInfo,
|
|
733
|
+
async prepareAccessory(accountInfo, deviceData, deviceId, deviceTypeText, deviceName, accountName) {
|
|
734
734
|
try {
|
|
735
735
|
//accessory
|
|
736
736
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare accessory`) : false;
|
|
@@ -748,23 +748,19 @@ class DeviceAta extends EventEmitter {
|
|
|
748
748
|
.setCharacteristic(Characteristic.FirmwareRevision, this.firmwareRevision);
|
|
749
749
|
|
|
750
750
|
//melcloud services
|
|
751
|
-
const presetsOnServer = this.accessory.presetsOnServer;
|
|
752
751
|
const displayMode = this.displayMode;
|
|
753
752
|
const temperatureSensor = this.temperatureSensor;
|
|
754
753
|
const temperatureSensorOutdoor = this.temperatureSensorOutdoor;
|
|
755
|
-
const presetsConfigured = this.presetsConfigured;
|
|
756
|
-
const presetsConfiguredCount = this.presetsConfiguredCount;
|
|
757
|
-
const buttonsConfigured = this.buttonsConfigured;
|
|
758
|
-
const buttonsConfiguredCount = this.buttonsConfiguredCount;
|
|
759
754
|
const hasAutomaticFanSpeed = this.accessory.hasAutomaticFanSpeed;
|
|
760
755
|
const modelSupportsFanSpeed = this.accessory.modelSupportsFanSpeed;
|
|
761
756
|
const modelSupportsDry = this.accessory.modelSupportsDry;
|
|
762
757
|
const numberOfFanSpeeds = this.accessory.numberOfFanSpeeds;
|
|
763
758
|
const swingFunction = this.accessory.swingFunction;
|
|
764
759
|
const hasOutdoorTemperature = this.accessory.hasOutdoorTemperature;
|
|
765
|
-
const
|
|
766
|
-
const
|
|
767
|
-
const
|
|
760
|
+
const presetsOnServer = this.accessory.presetsOnServer;
|
|
761
|
+
const autoDryFanMode = [deviceData.Device.OperationMode, 8, modelSupportsDry ? 2 : 8, 7][this.autoDryFanMode]; //NONE, AUTO - 8, DRY - 2, FAN - 7
|
|
762
|
+
const heatDryFanMode = [deviceData.Device.OperationMode, 1, modelSupportsDry ? 2 : 1, 7][this.heatDryFanMode]; //NONE, HEAT - 1, DRY - 2, FAN - 7
|
|
763
|
+
const coolDryFanMode = [deviceData.Device.OperationMode, 3, modelSupportsDry ? 2 : 3, 7][this.coolDryFanMode]; //NONE, COOL - 3, DRY - 2, FAN - 7
|
|
768
764
|
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
769
765
|
|
|
770
766
|
switch (displayMode) {
|
|
@@ -778,9 +774,9 @@ class DeviceAta extends EventEmitter {
|
|
|
778
774
|
})
|
|
779
775
|
.onSet(async (state) => {
|
|
780
776
|
try {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
await this.melCloudAta.send(
|
|
777
|
+
deviceData.Device.Power = [false, true][state];
|
|
778
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
779
|
+
await this.melCloudAta.send(deviceData);
|
|
784
780
|
const info = this.disableLogInfo ? false : this.emit('message', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
785
781
|
} catch (error) {
|
|
786
782
|
this.emit('warn', `Set power error: ${error}`);
|
|
@@ -805,21 +801,21 @@ class DeviceAta extends EventEmitter {
|
|
|
805
801
|
try {
|
|
806
802
|
switch (value) {
|
|
807
803
|
case 0: //AUTO - AUTO
|
|
808
|
-
|
|
809
|
-
|
|
804
|
+
deviceData.Device.OperationMode = autoDryFanMode;
|
|
805
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
810
806
|
break;
|
|
811
807
|
case 1: //HEAT - HEAT
|
|
812
|
-
|
|
813
|
-
|
|
808
|
+
deviceData.Device.OperationMode = heatDryFanMode;
|
|
809
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
814
810
|
break;
|
|
815
811
|
case 2: //COOL - COOL
|
|
816
|
-
|
|
817
|
-
|
|
812
|
+
deviceData.Device.OperationMode = coolDryFanMode;
|
|
813
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
818
814
|
break;
|
|
819
815
|
};
|
|
820
816
|
|
|
821
|
-
await this.melCloudAta.send(
|
|
822
|
-
const operationModeText = CONSTANTS.AirConditioner.DriveMode[
|
|
817
|
+
await this.melCloudAta.send(deviceData);
|
|
818
|
+
const operationModeText = CONSTANTS.AirConditioner.DriveMode[deviceData.Device.OperationMode];
|
|
823
819
|
const info = this.disableLogInfo ? false : this.emit('message', `Set operation mode: ${operationModeText}`);
|
|
824
820
|
} catch (error) {
|
|
825
821
|
this.emit('warn', `Set operation mode error: ${error}`);
|
|
@@ -841,29 +837,29 @@ class DeviceAta extends EventEmitter {
|
|
|
841
837
|
let fanSpeedModeText = 0; //AUTO, 1, 2, 3, 4, 5, 6, OFF
|
|
842
838
|
switch (numberOfFanSpeeds) {
|
|
843
839
|
case 2: //Fan speed mode 2
|
|
844
|
-
|
|
840
|
+
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
|
|
845
841
|
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 0][value] : [7, 1, 2][value];
|
|
846
842
|
break;
|
|
847
843
|
case 3: //Fan speed mode 3
|
|
848
|
-
|
|
844
|
+
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
|
|
849
845
|
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 0][value] : [7, 1, 2, 3][value];
|
|
850
846
|
break;
|
|
851
847
|
case 4: //Fan speed mode 4
|
|
852
|
-
|
|
848
|
+
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
|
|
853
849
|
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 0][value] : [7, 1, 2, 3, 4][value];
|
|
854
850
|
break;
|
|
855
851
|
case 5: //Fan speed mode 5
|
|
856
|
-
|
|
852
|
+
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
|
|
857
853
|
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 0][value] : [7, 1, 2, 3, 4, 5][value];
|
|
858
854
|
break;
|
|
859
855
|
case 6: //Fan speed mode 6
|
|
860
|
-
|
|
856
|
+
deviceData.Device.FanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 6, 0][value] : [1, 1, 2, 3, 4, 5, 6][value];
|
|
861
857
|
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6, 0][value] : [7, 1, 2, 3, 4, 5, 6][value];
|
|
862
858
|
break;
|
|
863
859
|
};
|
|
864
860
|
|
|
865
|
-
|
|
866
|
-
await this.melCloudAta.send(
|
|
861
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
862
|
+
await this.melCloudAta.send(deviceData);
|
|
867
863
|
const info = this.disableLogInfo ? false : this.emit('message', `Set fan speed mode: ${CONSTANTS.AirConditioner.FanSpeed[fanSpeedModeText]}`);
|
|
868
864
|
} catch (error) {
|
|
869
865
|
this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
@@ -879,10 +875,10 @@ class DeviceAta extends EventEmitter {
|
|
|
879
875
|
})
|
|
880
876
|
.onSet(async (value) => {
|
|
881
877
|
try {
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
await this.melCloudAta.send(
|
|
878
|
+
deviceData.Device.VaneHorizontal = value ? 12 : 0;
|
|
879
|
+
deviceData.Device.VaneVertical = value ? 7 : 0;
|
|
880
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
881
|
+
await this.melCloudAta.send(deviceData);
|
|
886
882
|
const info = this.disableLogInfo ? false : this.emit('message', `Set vane swing mode: ${CONSTANTS.AirConditioner.AirDirection[value ? 6 : 0]}`);
|
|
887
883
|
} catch (error) {
|
|
888
884
|
this.emit('warn', `Set vane swing mode error: ${error}`);
|
|
@@ -911,9 +907,9 @@ class DeviceAta extends EventEmitter {
|
|
|
911
907
|
})
|
|
912
908
|
.onSet(async (value) => {
|
|
913
909
|
try {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
await this.melCloudAta.send(
|
|
910
|
+
deviceData.Device.SetTemperature = value;
|
|
911
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
912
|
+
await this.melCloudAta.send(deviceData);
|
|
917
913
|
const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
918
914
|
} catch (error) {
|
|
919
915
|
this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
@@ -931,9 +927,9 @@ class DeviceAta extends EventEmitter {
|
|
|
931
927
|
})
|
|
932
928
|
.onSet(async (value) => {
|
|
933
929
|
try {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
await this.melCloudAta.send(
|
|
930
|
+
deviceData.Device.SetTemperature = value;
|
|
931
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
932
|
+
await this.melCloudAta.send(deviceData);
|
|
937
933
|
const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
938
934
|
} catch (error) {
|
|
939
935
|
this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
@@ -947,11 +943,11 @@ class DeviceAta extends EventEmitter {
|
|
|
947
943
|
.onSet(async (value) => {
|
|
948
944
|
try {
|
|
949
945
|
value = value ? true : false;
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
await this.melCloudAta.send(
|
|
946
|
+
deviceData.Device.ProhibitSetTemperature = value;
|
|
947
|
+
deviceData.Device.ProhibitOperationMode = value;
|
|
948
|
+
deviceData.Device.ProhibitPower = value;
|
|
949
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
950
|
+
await this.melCloudAta.send(deviceData);
|
|
955
951
|
const info = this.disableLogInfo ? false : this.emit('message', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
956
952
|
} catch (error) {
|
|
957
953
|
this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
@@ -995,28 +991,28 @@ class DeviceAta extends EventEmitter {
|
|
|
995
991
|
try {
|
|
996
992
|
switch (value) {
|
|
997
993
|
case 0: //OFF - POWER OFF
|
|
998
|
-
|
|
999
|
-
|
|
994
|
+
deviceData.Device.Power = false;
|
|
995
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
1000
996
|
break;
|
|
1001
997
|
case 1: //HEAT - HEAT
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
998
|
+
deviceData.Device.Power = true;
|
|
999
|
+
deviceData.Device.OperationMode = heatDryFanMode;
|
|
1000
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1005
1001
|
break;
|
|
1006
1002
|
case 2: //COOL - COOL
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1003
|
+
deviceData.Device.Power = true;
|
|
1004
|
+
deviceData.Device.OperationMode = coolDryFanMode;
|
|
1005
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1010
1006
|
break;
|
|
1011
1007
|
case 3: //AUTO - AUTO
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1008
|
+
deviceData.Device.Power = true;
|
|
1009
|
+
deviceData.Device.OperationMode = autoDryFanMode;
|
|
1010
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1015
1011
|
break;
|
|
1016
1012
|
};
|
|
1017
1013
|
|
|
1018
|
-
await this.melCloudAta.send(
|
|
1019
|
-
const operationModeText = CONSTANTS.AirConditioner.DriveMode[
|
|
1014
|
+
await this.melCloudAta.send(deviceData);
|
|
1015
|
+
const operationModeText = CONSTANTS.AirConditioner.DriveMode[deviceData.Device.OperationMode];
|
|
1020
1016
|
const info = this.disableLogInfo ? false : this.emit('message', `Set operation mode: ${operationModeText}`);
|
|
1021
1017
|
} catch (error) {
|
|
1022
1018
|
this.emit('warn', `Set operation mode error: ${error}`);
|
|
@@ -1044,9 +1040,9 @@ class DeviceAta extends EventEmitter {
|
|
|
1044
1040
|
})
|
|
1045
1041
|
.onSet(async (value) => {
|
|
1046
1042
|
try {
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
await this.melCloudAta.send(
|
|
1043
|
+
deviceData.Device.SetTemperature = value;
|
|
1044
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
|
|
1045
|
+
await this.melCloudAta.send(deviceData);
|
|
1050
1046
|
const info = this.disableLogInfo ? false : this.emit('message', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
1051
1047
|
} catch (error) {
|
|
1052
1048
|
this.emit('warn', `Set temperature error: ${error}`);
|
|
@@ -1107,15 +1103,14 @@ class DeviceAta extends EventEmitter {
|
|
|
1107
1103
|
};
|
|
1108
1104
|
|
|
1109
1105
|
//presets services
|
|
1110
|
-
if (presetsConfiguredCount > 0) {
|
|
1106
|
+
if (this.presetsConfiguredCount > 0) {
|
|
1111
1107
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare presets services`) : false;
|
|
1112
1108
|
this.presetsServices = [];
|
|
1113
1109
|
const previousPresets = [];
|
|
1114
1110
|
|
|
1115
|
-
for (let i = 0; i < presetsConfiguredCount; i++) {
|
|
1116
|
-
const preset = presetsConfigured[i];
|
|
1117
|
-
const
|
|
1118
|
-
const presetData = presetsOnServer[index];
|
|
1111
|
+
for (let i = 0; i < this.presetsConfiguredCount; i++) {
|
|
1112
|
+
const preset = this.presetsConfigured[i];
|
|
1113
|
+
const presetData = presetsOnServer.find(p => p.ID === preset.Id);
|
|
1119
1114
|
|
|
1120
1115
|
//get preset name
|
|
1121
1116
|
const presetName = preset.name;
|
|
@@ -1142,40 +1137,40 @@ class DeviceAta extends EventEmitter {
|
|
|
1142
1137
|
try {
|
|
1143
1138
|
switch (state) {
|
|
1144
1139
|
case true:
|
|
1145
|
-
previousPresets[i] =
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1140
|
+
previousPresets[i] = deviceData.Device;
|
|
1141
|
+
deviceData.Device.SetTemperature = presetData.SetTemperature;
|
|
1142
|
+
deviceData.Device.Power = presetData.Power;
|
|
1143
|
+
deviceData.Device.OperationMode = presetData.OperationMode;
|
|
1144
|
+
deviceData.Device.VaneHorizontal = presetData.VaneHorizontal;
|
|
1145
|
+
deviceData.Device.VaneVertical = presetData.VaneVertical;
|
|
1146
|
+
deviceData.Device.SetFanSpeed = presetData.FanSpeed;
|
|
1147
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
1153
1148
|
break;
|
|
1154
1149
|
case false:
|
|
1155
|
-
|
|
1150
|
+
deviceData.Device = previousPresets[i];
|
|
1156
1151
|
break;
|
|
1157
1152
|
};
|
|
1158
1153
|
|
|
1159
|
-
await this.melCloudAta.send(
|
|
1154
|
+
await this.melCloudAta.send(deviceData);
|
|
1160
1155
|
const info = this.disableLogInfo ? false : this.emit('message', `Set: ${presetName}`);
|
|
1161
1156
|
} catch (error) {
|
|
1162
1157
|
this.emit('warn', `Set preset error: ${error}`);
|
|
1163
1158
|
};
|
|
1164
1159
|
});
|
|
1165
1160
|
};
|
|
1166
|
-
previousPresets.push(
|
|
1161
|
+
previousPresets.push(deviceData.Device);
|
|
1167
1162
|
this.presetsServices.push(presetService);
|
|
1168
1163
|
accessory.addService(presetService);
|
|
1169
1164
|
};
|
|
1170
1165
|
};
|
|
1171
1166
|
|
|
1172
1167
|
//buttons services
|
|
1173
|
-
if (buttonsConfiguredCount > 0) {
|
|
1168
|
+
if (this.buttonsConfiguredCount > 0) {
|
|
1174
1169
|
const debug = this.enableDebugMode ? this.emit('debug', `Prepare buttons/sensors services`) : false;
|
|
1175
1170
|
this.buttonsServices = [];
|
|
1176
1171
|
|
|
1177
|
-
for (let i = 0; i < buttonsConfiguredCount; i++) {
|
|
1178
|
-
const button = buttonsConfigured[i];
|
|
1172
|
+
for (let i = 0; i < this.buttonsConfiguredCount; i++) {
|
|
1173
|
+
const button = this.buttonsConfigured[i];
|
|
1179
1174
|
|
|
1180
1175
|
//get button mode
|
|
1181
1176
|
const mode = button.mode;
|
|
@@ -1200,190 +1195,190 @@ class DeviceAta extends EventEmitter {
|
|
|
1200
1195
|
const state = button.state;
|
|
1201
1196
|
return state;
|
|
1202
1197
|
})
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1198
|
+
.onSet(async (state) => {
|
|
1199
|
+
if (displayType > 0 && displayType < 3) {
|
|
1200
|
+
try {
|
|
1201
|
+
switch (mode) {
|
|
1202
|
+
case 0: //POWER ON,OFF
|
|
1203
|
+
deviceData.Device.Power = state;
|
|
1204
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power;
|
|
1205
|
+
break;
|
|
1206
|
+
case 1: //OPERATING MODE HEAT
|
|
1207
|
+
deviceData.Device.Power = true;
|
|
1208
|
+
deviceData.Device.OperationMode = 1;
|
|
1209
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1210
|
+
break;
|
|
1211
|
+
case 2: //OPERATING MODE DRY
|
|
1212
|
+
deviceData.Device.Power = true;
|
|
1213
|
+
deviceData.Device.OperationMode = 2;
|
|
1214
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1215
|
+
break
|
|
1216
|
+
case 3: //OPERATING MODE COOL
|
|
1217
|
+
deviceData.Device.Power = true;
|
|
1218
|
+
deviceData.Device.OperationMode = 3;
|
|
1219
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1220
|
+
break;
|
|
1221
|
+
case 4: //OPERATING MODE FAN
|
|
1222
|
+
deviceData.Device.Power = true;
|
|
1223
|
+
deviceData.Device.OperationMode = 7;
|
|
1224
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1225
|
+
break;
|
|
1226
|
+
case 5: //OPERATING MODE AUTO
|
|
1227
|
+
deviceData.Device.Power = true;
|
|
1228
|
+
deviceData.Device.OperationMode = 8;
|
|
1229
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1230
|
+
break;
|
|
1231
|
+
case 6: //OPERATING MODE PURIFY
|
|
1232
|
+
deviceData.Device.Power = true;
|
|
1233
|
+
deviceData.Device.OperationMode = 9;
|
|
1234
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
1235
|
+
break;
|
|
1236
|
+
case 7: //OPERATING MODE DRY CONTROL HIDE
|
|
1237
|
+
deviceData.Device.HideDryModeControl = state;
|
|
1238
|
+
break;
|
|
1239
|
+
case 10: //VANE H SWING MODE AUTO
|
|
1240
|
+
deviceData.Device.Power = true;
|
|
1241
|
+
deviceData.Device.VaneHorizontal = 0;
|
|
1242
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1243
|
+
break;
|
|
1244
|
+
case 11: //VANE H SWING MODE 1
|
|
1245
|
+
deviceData.Device.Power = true;
|
|
1246
|
+
deviceData.Device.VaneHorizontal = 1;
|
|
1247
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1248
|
+
break;
|
|
1249
|
+
case 12: //VANE H SWING MODE 2
|
|
1250
|
+
deviceData.Device.Power = true;
|
|
1251
|
+
deviceData.Device.VaneHorizontal = 2;
|
|
1252
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1253
|
+
break;
|
|
1254
|
+
case 13: //VANE H SWING MODE 3
|
|
1255
|
+
deviceData.Device.Power = true;
|
|
1256
|
+
deviceData.Device.VaneHorizontal = 3;
|
|
1257
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1258
|
+
break;
|
|
1259
|
+
case 14: //VANE H SWING MODE 4
|
|
1260
|
+
deviceData.Device.Power = true;
|
|
1261
|
+
deviceData.Device.VaneHorizontal = 4;
|
|
1262
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1263
|
+
break;
|
|
1264
|
+
case 15: //VANE H SWING MODE 5
|
|
1265
|
+
deviceData.Device.Power = true;
|
|
1266
|
+
deviceData.Device.VaneHorizontal = 5;
|
|
1267
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1268
|
+
break;
|
|
1269
|
+
case 16: //VANE H SWING MODE SPLIT
|
|
1270
|
+
deviceData.Device.Power = true;
|
|
1271
|
+
deviceData.Device.VaneHorizontal = 8;
|
|
1272
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1273
|
+
break;
|
|
1274
|
+
case 17: //VANE H SWING MODE SWING
|
|
1275
|
+
deviceData.Device.Power = true;
|
|
1276
|
+
deviceData.Device.VaneHorizontal = 12;
|
|
1277
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal;
|
|
1278
|
+
break;
|
|
1279
|
+
case 20: //VANE V SWING MODE AUTO
|
|
1280
|
+
deviceData.Device.Power = true;
|
|
1281
|
+
deviceData.Device.VaneVertical = 0;
|
|
1282
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1283
|
+
break;
|
|
1284
|
+
case 21: //VANE V SWING MODE 1
|
|
1285
|
+
deviceData.Device.Power = true;
|
|
1286
|
+
deviceData.Device.VaneVertical = 1;
|
|
1287
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1288
|
+
break;
|
|
1289
|
+
case 22: //VANE V SWING MODE 2
|
|
1290
|
+
deviceData.Device.Power = true;
|
|
1291
|
+
deviceData.Device.VaneVertical = 2;
|
|
1292
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1293
|
+
break;
|
|
1294
|
+
case 23: //VANE V SWING MODE 3
|
|
1295
|
+
deviceData.Device.Power = true;
|
|
1296
|
+
deviceData.Device.VaneVertical = 3;
|
|
1297
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1298
|
+
break;
|
|
1299
|
+
case 24: //VANE V SWING MODE 4
|
|
1300
|
+
deviceData.Device.Power = true;
|
|
1301
|
+
deviceData.Device.VaneVertical = 4;
|
|
1302
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1303
|
+
break;
|
|
1304
|
+
case 25: //VANE V SWING MODE 5
|
|
1305
|
+
deviceData.Device.Power = true;
|
|
1306
|
+
deviceData.Device.VaneVertical = 5;
|
|
1307
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1308
|
+
break;
|
|
1309
|
+
case 26: //VANE V SWING MODE SWING
|
|
1310
|
+
deviceData.Device.Power = true;
|
|
1311
|
+
deviceData.Device.VaneVertical = 7;
|
|
1312
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
|
|
1313
|
+
break;
|
|
1314
|
+
case 27: //VANE H/V CONTROLS HIDE
|
|
1315
|
+
deviceData.Device.HideVaneControls = state;
|
|
1316
|
+
break;
|
|
1317
|
+
case 30: //FAN SPEED MODE AUTO
|
|
1318
|
+
deviceData.Device.Power = true;
|
|
1319
|
+
deviceData.Device.SetFanSpeed = 0;
|
|
1320
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1321
|
+
break;
|
|
1322
|
+
case 31: //FAN SPEED MODE 1
|
|
1323
|
+
deviceData.Device.Power = true;
|
|
1324
|
+
deviceData.Device.SetFanSpeed = 1;
|
|
1325
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1326
|
+
break;
|
|
1327
|
+
case 32: //FAN SPEED MODE 2
|
|
1328
|
+
deviceData.Device.Power = true;
|
|
1329
|
+
deviceData.Device.SetFanSpeed = 2;
|
|
1330
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1331
|
+
break;
|
|
1332
|
+
case 33: //FAN SPEED MODE 3
|
|
1333
|
+
deviceData.Device.Power = true;
|
|
1334
|
+
deviceData.Device.SetFanSpeed = 3;
|
|
1335
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1336
|
+
break;
|
|
1337
|
+
case 34: //FAN MODE 4
|
|
1338
|
+
deviceData.Device.Power = true;
|
|
1339
|
+
deviceData.Device.SetFanSpeed = 4;
|
|
1340
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1341
|
+
break;
|
|
1342
|
+
case 35: //FAN SPEED MODE 5
|
|
1343
|
+
deviceData.Device.Power = true;
|
|
1344
|
+
deviceData.Device.SetFanSpeed = 5;
|
|
1345
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1346
|
+
break;
|
|
1347
|
+
case 36: //FAN SPEED MODE 6
|
|
1348
|
+
deviceData.Device.Power = true;
|
|
1349
|
+
deviceData.Device.SetFanSpeed = 6;
|
|
1350
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
1351
|
+
break;
|
|
1352
|
+
case 37: //PHYSICAL LOCK CONTROLS
|
|
1353
|
+
deviceData.Device.ProhibitSetTemperature = state;
|
|
1354
|
+
deviceData.Device.ProhibitOperationMode = state;
|
|
1355
|
+
deviceData.Device.ProhibitPower = state;
|
|
1356
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1357
|
+
break;
|
|
1358
|
+
case 38: //PHYSICAL LOCK CONTROLS POWER
|
|
1359
|
+
deviceData.Device.ProhibitPower = state;
|
|
1360
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1361
|
+
break;
|
|
1362
|
+
case 39: //PHYSICAL LOCK CONTROLS MODE
|
|
1363
|
+
deviceData.Device.ProhibitOperationMode = state;
|
|
1364
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1365
|
+
break;
|
|
1366
|
+
case 40: //PHYSICAL LOCK CONTROLS TEMP
|
|
1367
|
+
deviceData.Device.ProhibitSetTemperature = state;
|
|
1368
|
+
deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Prohibit;
|
|
1369
|
+
break;
|
|
1370
|
+
default:
|
|
1371
|
+
this.emit('message', `Unknown button mode: ${mode}`);
|
|
1372
|
+
break;
|
|
1373
|
+
};
|
|
1379
1374
|
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1375
|
+
await this.melCloudAta.send(deviceData);
|
|
1376
|
+
const info = this.disableLogInfo ? false : this.emit('message', `Set: ${buttonName}`);
|
|
1377
|
+
} catch (error) {
|
|
1378
|
+
this.emit('warn', `Set button error: ${error}`);
|
|
1379
|
+
};
|
|
1384
1380
|
};
|
|
1385
1381
|
});
|
|
1386
|
-
};
|
|
1387
1382
|
this.buttonsServices.push(buttonService);
|
|
1388
1383
|
accessory.addService(buttonService);
|
|
1389
1384
|
};
|