homebridge-melcloud-control 4.0.0-beta.156 → 4.0.0-beta.157
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/deviceata.js +25 -25
- package/src/melcloudata.js +9 -13
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.157",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/deviceata.js
CHANGED
|
@@ -155,67 +155,67 @@ class DeviceAta extends EventEmitter {
|
|
|
155
155
|
case 'Power':
|
|
156
156
|
deviceData.Device[key] = value;
|
|
157
157
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
158
|
-
set = await this.melCloudAta.send(this.accountType,
|
|
158
|
+
set = await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
159
159
|
break;
|
|
160
160
|
case 'OperationMode':
|
|
161
161
|
deviceData.Device[key] = value;
|
|
162
162
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.OperationMode
|
|
163
|
-
set = await this.melCloudAta.send(this.accountType,
|
|
163
|
+
set = await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
164
164
|
break;
|
|
165
165
|
case 'SetTemperature':
|
|
166
166
|
deviceData.Device[key] = value;
|
|
167
167
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
168
|
-
set = await this.melCloudAta.send(this.accountType,
|
|
168
|
+
set = await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
169
169
|
break;
|
|
170
170
|
case 'DefaultCoolingSetTemperature':
|
|
171
171
|
deviceData.Device[key] = value;
|
|
172
172
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
173
|
-
set = await this.melCloudAta.send(this.accountType,
|
|
173
|
+
set = await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
174
174
|
break;
|
|
175
175
|
case 'DefaultHeatingSetTemperature':
|
|
176
176
|
deviceData.Device[key] = value;
|
|
177
177
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
178
|
-
set = await this.melCloudAta.send(this.accountType,
|
|
178
|
+
set = await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
179
179
|
break;
|
|
180
180
|
case 'FanSpeed':
|
|
181
181
|
deviceData.Device[key] = value;
|
|
182
182
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
183
|
-
set = await this.melCloudAta.send(this.accountType,
|
|
183
|
+
set = await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
184
184
|
break;
|
|
185
185
|
case 'VaneHorizontalDirection':
|
|
186
186
|
deviceData.Device[key] = value;
|
|
187
187
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneHorizontalDirection;
|
|
188
|
-
set = await this.melCloudAta.send(this.accountType,
|
|
188
|
+
set = await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
189
189
|
break;
|
|
190
190
|
case 'VaneVerticalDirection':
|
|
191
191
|
deviceData.Device[key] = value;
|
|
192
192
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalDirection;
|
|
193
|
-
set = await this.melCloudAta.send(this.accountType,
|
|
193
|
+
set = await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
194
194
|
break;
|
|
195
195
|
case 'HideVaneControls':
|
|
196
196
|
deviceData[key] = value;
|
|
197
197
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
198
|
-
set = await this.melCloudAta.send(this.accountType,
|
|
198
|
+
set = await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
199
199
|
break;
|
|
200
200
|
case 'HideDryModeControl':
|
|
201
201
|
deviceData[key] = value;
|
|
202
202
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
203
|
-
await this.melCloudAta.send(this.accountType,
|
|
203
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
204
204
|
break;
|
|
205
205
|
case 'ProhibitSetTemperature':
|
|
206
206
|
deviceData.Device[key] = value;
|
|
207
207
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
208
|
-
set = await this.melCloudAta.send(this.accountType,
|
|
208
|
+
set = await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
209
209
|
break;
|
|
210
210
|
case 'ProhibitOperationMode':
|
|
211
211
|
deviceData.Device[key] = value;
|
|
212
212
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
213
|
-
await this.melCloudAta.send(this.accountType,
|
|
213
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
214
214
|
break;
|
|
215
215
|
case 'ProhibitPower':
|
|
216
216
|
deviceData.Device[key] = value;
|
|
217
217
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
218
|
-
set = await this.melCloudAta.send(this.accountType,
|
|
218
|
+
set = await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
219
219
|
break;
|
|
220
220
|
default:
|
|
221
221
|
this.emit('warn', `${integration}, received key: ${key}, value: ${value}`);
|
|
@@ -294,7 +294,7 @@ class DeviceAta extends EventEmitter {
|
|
|
294
294
|
try {
|
|
295
295
|
deviceData.Device.Power = state
|
|
296
296
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
297
|
-
await this.melCloudAta.send(this.accountType,
|
|
297
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
298
298
|
if (this.logInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
299
299
|
} catch (error) {
|
|
300
300
|
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
@@ -332,7 +332,7 @@ class DeviceAta extends EventEmitter {
|
|
|
332
332
|
};
|
|
333
333
|
|
|
334
334
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.OperationMode;
|
|
335
|
-
await this.melCloudAta.send(this.accountType,
|
|
335
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
336
336
|
if (this.logInfo) this.emit('info', `Set operation mode: ${AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode]}`);
|
|
337
337
|
} catch (error) {
|
|
338
338
|
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
@@ -372,7 +372,7 @@ class DeviceAta extends EventEmitter {
|
|
|
372
372
|
break;
|
|
373
373
|
};
|
|
374
374
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
375
|
-
await this.melCloudAta.send(this.accountType,
|
|
375
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
376
376
|
if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeedMapEnumToString[deviceData.Device[fanKey]]}`);
|
|
377
377
|
} catch (error) {
|
|
378
378
|
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
@@ -391,7 +391,7 @@ class DeviceAta extends EventEmitter {
|
|
|
391
391
|
deviceData.Device.VaneHorizontalDirection = value ? 12 : 0;
|
|
392
392
|
deviceData.Device.VaneVerticalDirection = value ? 7 : 0;
|
|
393
393
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalVaneHorizontal;
|
|
394
|
-
await this.melCloudAta.send(this.accountType,
|
|
394
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
395
395
|
if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirectionMapEnumToString[value]}`);
|
|
396
396
|
} catch (error) {
|
|
397
397
|
if (this.logWarn) this.emit('warn', `Set vane swing mode error: ${error}`);
|
|
@@ -413,7 +413,7 @@ class DeviceAta extends EventEmitter {
|
|
|
413
413
|
deviceData.Device.SetTemperature = value;
|
|
414
414
|
deviceData.Device.DefaultCoolingSetTemperature = value;
|
|
415
415
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
416
|
-
await this.melCloudAta.send(this.accountType,
|
|
416
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
417
417
|
if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
418
418
|
} catch (error) {
|
|
419
419
|
if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
@@ -435,7 +435,7 @@ class DeviceAta extends EventEmitter {
|
|
|
435
435
|
deviceData.Device.SetTemperature = value;
|
|
436
436
|
deviceData.Device.DefaultHeatingSetTemperature = value;
|
|
437
437
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
438
|
-
await this.melCloudAta.send(this.accountType,
|
|
438
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
439
439
|
if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
440
440
|
} catch (error) {
|
|
441
441
|
if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
@@ -454,7 +454,7 @@ class DeviceAta extends EventEmitter {
|
|
|
454
454
|
deviceData.Device.ProhibitOperationMode = value;
|
|
455
455
|
deviceData.Device.ProhibitPower = value;
|
|
456
456
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
457
|
-
await this.melCloudAta.send(this.accountType,
|
|
457
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
458
458
|
if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
459
459
|
} catch (error) {
|
|
460
460
|
if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
@@ -520,7 +520,7 @@ class DeviceAta extends EventEmitter {
|
|
|
520
520
|
break;
|
|
521
521
|
};
|
|
522
522
|
|
|
523
|
-
await this.melCloudAta.send(this.accountType,
|
|
523
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
524
524
|
const operationModeText = AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode];
|
|
525
525
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
526
526
|
} catch (error) {
|
|
@@ -546,7 +546,7 @@ class DeviceAta extends EventEmitter {
|
|
|
546
546
|
try {
|
|
547
547
|
deviceData.Device.SetTemperature = value;
|
|
548
548
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
549
|
-
await this.melCloudAta.send(this.accountType,
|
|
549
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
550
550
|
if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
551
551
|
} catch (error) {
|
|
552
552
|
if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
|
|
@@ -657,7 +657,7 @@ class DeviceAta extends EventEmitter {
|
|
|
657
657
|
break;
|
|
658
658
|
};
|
|
659
659
|
|
|
660
|
-
await this.melCloudAta.send(this.accountType,
|
|
660
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
661
661
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
662
662
|
} catch (error) {
|
|
663
663
|
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
@@ -898,7 +898,7 @@ class DeviceAta extends EventEmitter {
|
|
|
898
898
|
break;
|
|
899
899
|
};
|
|
900
900
|
|
|
901
|
-
await this.melCloudAta.send(this.accountType,
|
|
901
|
+
await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
|
|
902
902
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
|
|
903
903
|
} catch (error) {
|
|
904
904
|
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
@@ -1331,7 +1331,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1331
1331
|
if (vaneVerticalDirection !== null) this.emit('info', `Vane vertical: ${AirConditioner.VaneVerticalDirectionMapEnumToString[vaneVerticalDirection]}`);
|
|
1332
1332
|
if (supportsSwingFunction) this.emit('info', `Air direction: ${AirConditioner.AirDirectionMapEnumToString[obj.currentSwingMode]}`);
|
|
1333
1333
|
this.emit('info', `Temperature display unit: ${obj.temperatureUnit}`);
|
|
1334
|
-
this.emit('info', `Lock physical controls: ${obj.lockPhysicalControl ? '
|
|
1334
|
+
this.emit('info', `Lock physical controls: ${obj.lockPhysicalControl ? 'Locked' : 'Unlocked'}`);
|
|
1335
1335
|
};
|
|
1336
1336
|
})
|
|
1337
1337
|
.on('success', (success) => this.emit('success', success))
|
package/src/melcloudata.js
CHANGED
|
@@ -191,7 +191,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
191
191
|
};
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
-
async send(accountType,
|
|
194
|
+
async send(accountType, displayMode, deviceData) {
|
|
195
195
|
try {
|
|
196
196
|
switch (accountType) {
|
|
197
197
|
// ----------------------------------------------------------
|
|
@@ -225,8 +225,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
225
225
|
case 7: // FAN
|
|
226
226
|
break;
|
|
227
227
|
case 8: // AUTO
|
|
228
|
-
deviceData.Device.SetTemperature =
|
|
229
|
-
(deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
228
|
+
deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
230
229
|
break;
|
|
231
230
|
default:
|
|
232
231
|
break;
|
|
@@ -291,10 +290,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
291
290
|
// Set target temp
|
|
292
291
|
switch (displayMode) {
|
|
293
292
|
case 1: // Heater/Cooler
|
|
294
|
-
if (deviceData.Device.OperationMode === 8)
|
|
295
|
-
deviceData.Device.SetTemperature =
|
|
296
|
-
(deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
297
|
-
}
|
|
293
|
+
if (deviceData.Device.OperationMode === 8) deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
298
294
|
break;
|
|
299
295
|
case 2: // Thermostat
|
|
300
296
|
break;
|
|
@@ -303,12 +299,12 @@ class MelCloudAta extends EventEmitter {
|
|
|
303
299
|
}
|
|
304
300
|
|
|
305
301
|
// Convert values to strings
|
|
306
|
-
deviceData.Device.Power = String(deviceData.Device.Power
|
|
307
|
-
deviceData.Device.SetTemperature = String(deviceData.Device.SetTemperature
|
|
308
|
-
deviceData.Device.SetFanSpeed = String(deviceData.Device.SetFanSpeed
|
|
309
|
-
deviceData.Device.OperationMode = AirConditioner.OperationModeMapEnumToString?.[deviceData.Device.OperationMode]
|
|
310
|
-
deviceData.Device.VaneHorizontalDirection = AirConditioner.VaneHorizontalDirectionMapEnumToString?.[deviceData.Device.VaneHorizontalDirection]
|
|
311
|
-
deviceData.Device.VaneVerticalDirection = AirConditioner.VaneVerticalDirectionMapEnumToString?.[deviceData.Device.VaneVerticalDirection]
|
|
302
|
+
deviceData.Device.Power = String(deviceData.Device.Power);
|
|
303
|
+
deviceData.Device.SetTemperature = String(deviceData.Device.SetTemperature);
|
|
304
|
+
deviceData.Device.SetFanSpeed = String(deviceData.Device.SetFanSpeed);
|
|
305
|
+
deviceData.Device.OperationMode = AirConditioner.OperationModeMapEnumToString?.[deviceData.Device.OperationMode];
|
|
306
|
+
deviceData.Device.VaneHorizontalDirection = AirConditioner.VaneHorizontalDirectionMapEnumToString?.[deviceData.Device.VaneHorizontalDirection];
|
|
307
|
+
deviceData.Device.VaneVerticalDirection = AirConditioner.VaneVerticalDirectionMapEnumToString?.[deviceData.Device.VaneVerticalDirection];
|
|
312
308
|
|
|
313
309
|
this.emit('warn', JSON.stringify(deviceData.Device, null, 2));
|
|
314
310
|
|