homebridge-melcloud-control 4.10.20-beta.2 → 4.10.20-beta.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.10.20-beta.2",
4
+ "version": "4.10.20-beta.4",
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/deviceerv.js CHANGED
@@ -274,17 +274,15 @@ class DeviceErv extends EventEmitter {
274
274
  minStep: 1
275
275
  })
276
276
  .onGet(async () => {
277
- const value = this.accessory.fanSpeed;
277
+ const value = this.accessory.currentFanSpeed;
278
278
  return value;
279
279
  })
280
280
  .onSet(async (value) => {
281
281
  try {
282
- const payload = {};
283
282
  const max = numberOfFanSpeeds;
284
283
  const minValue = supportsAutomaticFanSpeed ? 0 : 1;
285
284
  const clampedValue = Math.min(Math.max(value, minValue), max);
286
-
287
- payload.setFanSpeed = clampedValue;
285
+ const payload = { setFanSpeed: clampedValue };
288
286
  if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeedMapEnumToString[clampedValue]}`);
289
287
  await this.melCloudErv.send(this.accountType, this.displayType, deviceData, payload, Ventilation.EffectiveFlags.SetFanSpeed);
290
288
  } catch (error) {
@@ -1215,7 +1213,7 @@ class DeviceErv extends EventEmitter {
1215
1213
  { type: Characteristic.TemperatureDisplayUnits, value: obj.useFahrenheit },
1216
1214
  );
1217
1215
 
1218
- if (supportsFanSpeed) characteristics.push({ type: Characteristic.RotationSpeed, value: obj.fanSpeed });
1216
+ if (supportsFanSpeed) characteristics.push({ type: Characteristic.RotationSpeed, value: obj.currentFanSpeed });
1219
1217
  if (supportsCoolOperationMode) characteristics.push({ type: Characteristic.CoolingThresholdTemperature, value: Math.max(ventilationMode === 2 ? defaultCoolingSetTemperature : setTemperature, minTempCoolDryAuto) });
1220
1218
  if (supportsHeatOperationMode) characteristics.push({ type: Characteristic.HeatingThresholdTemperature, value: Math.max(ventilationMode === 2 ? defaultHeatingSetTemperature : setTemperature, minTempHeat) });
1221
1219
  break;
@@ -210,6 +210,13 @@ class MelCloudAta extends EventEmitter {
210
210
  default: {
211
211
  //compare against the API wrapper's own live-polled state, not the caller's closure-captured (possibly stale) deviceData
212
212
  const changes = this.functions.filterChanges(payload, this.deviceData.Device);
213
+
214
+ //Apple Home always resends its own remembered (non-zero) fan speed together with Active when powering on from off
215
+ //Auto (0) can't be represented on that dial, so ignore this phantom value while the unit is off and currently in Auto
216
+ if (changes.setFanSpeed !== undefined && changes.setFanSpeed !== 0 && this.deviceData.Device.Power === false && this.deviceData.Device.SetFanSpeed === 0) {
217
+ delete changes.setFanSpeed;
218
+ }
219
+
213
220
  if (Object.keys(changes).length === 0) {
214
221
  if (this.logDebug) this.emit('debug', `Ignore send, no changes: ${JSON.stringify(payload)}`);
215
222
  return true;
@@ -311,6 +318,13 @@ class MelCloudAta extends EventEmitter {
311
318
  default: {
312
319
  //compare against the API wrapper's own live-polled state, not the caller's closure-captured (possibly stale) deviceData
313
320
  const changes = this.functions.filterChanges(payload, this.deviceData.Device);
321
+
322
+ //Apple Home always resends its own remembered (non-zero) fan speed together with Active when powering on from off
323
+ //Auto (0) can't be represented on that dial, so ignore this phantom value while the unit is off and currently in Auto
324
+ if (changes.setFanSpeed !== undefined && changes.setFanSpeed !== 0 && this.deviceData.Device.Power === false && this.deviceData.Device.SetFanSpeed === 0) {
325
+ delete changes.setFanSpeed;
326
+ }
327
+
314
328
  if (Object.keys(changes).length === 0) {
315
329
  if (this.logDebug) this.emit('debug', `Ignore send, no changes: ${JSON.stringify(payload)}`);
316
330
  return true;
@@ -185,6 +185,13 @@ class MelCloudErv extends EventEmitter {
185
185
  default: {
186
186
  //compare against the API wrapper's own live-polled state, not the caller's closure-captured (possibly stale) deviceData
187
187
  const changes = this.functions.filterChanges(payload, this.deviceData.Device);
188
+
189
+ //Apple Home always resends its own remembered (non-zero) fan speed together with Active when powering on from off
190
+ //Auto (0) can't be represented on that dial, so ignore this phantom value while the unit is off and currently in Auto
191
+ if (changes.setFanSpeed !== undefined && changes.setFanSpeed !== 0 && this.deviceData.Device.Power === false && this.deviceData.Device.SetFanSpeed === 0) {
192
+ delete changes.setFanSpeed;
193
+ }
194
+
188
195
  if (Object.keys(changes).length === 0) {
189
196
  if (this.logDebug) this.emit('debug', `Ignore send, no changes: ${JSON.stringify(payload)}`);
190
197
  return true;
@@ -276,6 +283,13 @@ class MelCloudErv extends EventEmitter {
276
283
  default: {
277
284
  //compare against the API wrapper's own live-polled state, not the caller's closure-captured (possibly stale) deviceData
278
285
  const changes = this.functions.filterChanges(payload, this.deviceData.Device);
286
+
287
+ //Apple Home always resends its own remembered (non-zero) fan speed together with Active when powering on from off
288
+ //Auto (0) can't be represented on that dial, so ignore this phantom value while the unit is off and currently in Auto
289
+ if (changes.setFanSpeed !== undefined && changes.setFanSpeed !== 0 && this.deviceData.Device.Power === false && this.deviceData.Device.SetFanSpeed === 0) {
290
+ delete changes.setFanSpeed;
291
+ }
292
+
279
293
  if (Object.keys(changes).length === 0) {
280
294
  if (this.logDebug) this.emit('debug', `Ignore send, no changes: ${JSON.stringify(payload)}`);
281
295
  return true;