homebridge-melcloud-control 4.3.9-beta.12 → 4.3.9-beta.13

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.3.9-beta.12",
4
+ "version": "4.3.9-beta.13",
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
@@ -1398,10 +1398,10 @@ class DeviceAta extends EventEmitter {
1398
1398
  const supportsCool1 = deviceData.Device[supportCoolKey];
1399
1399
  const supportsCool = this.coolDryFanMode >= 1 && supportsCool1;
1400
1400
  const numberOfFanSpeeds = supportsFanSpeed ? deviceData.Device.NumberOfFanSpeeds : 0;
1401
- const minTempHeat = 10;
1402
- const maxTempHeat = 31;
1403
- const minTempCoolDryAuto = 16;
1404
- const maxTempCoolDryAuto = 31;
1401
+ const minTempHeat = deviceData.Device.MinTempHeat ?? 10;
1402
+ const maxTempHeat = deviceData.Device.MaxTempHeat ?? 31;
1403
+ const minTempCoolDryAuto = deviceData.Device.MinTempAutomatic ?? 16;
1404
+ const maxTempCoolDryAuto = deviceData.Device.MaxTempAutomatic ?? 31;
1405
1405
 
1406
1406
  //device state
1407
1407
  const power = deviceData.Device.Power ?? false;
@@ -81,12 +81,12 @@ class MelCloudAta extends EventEmitter {
81
81
  updateState = true;
82
82
  break;
83
83
  default:
84
- if (this.logDebug) this.emit('debug', `Unit ${unitId}, received unknown message type: ${stringifyMessage}`);
84
+ if (this.logDebug) this.emit('debug', `Unit ${unitId}, received unknown message type: ${parsedMessage}`);
85
85
  return;
86
86
  }
87
87
  break;
88
88
  default:
89
- if (this.logDebug) this.emit('debug', `Incoming unknown unit id: ${stringifyMessage}`);
89
+ if (this.logDebug) this.emit('debug', `Incoming unknown unit id: ${parsedMessage}`);
90
90
  return;
91
91
  }
92
92
 
@@ -81,12 +81,12 @@ class MelCloudAtw extends EventEmitter {
81
81
  updateState = true;
82
82
  break;
83
83
  default:
84
- if (this.logDebug) this.emit('debug', `Unit ${unitId}, received unknown message type: ${stringifyMessage}`);
84
+ if (this.logDebug) this.emit('debug', `Unit ${unitId}, received unknown message type: ${parsedMessage}`);
85
85
  return;
86
86
  }
87
87
  break;
88
88
  default:
89
- if (this.logDebug) this.emit('debug', `Incoming unknown unit id: ${stringifyMessage}`);
89
+ if (this.logDebug) this.emit('debug', `Incoming unknown unit id: ${parsedMessage}`);
90
90
  return;
91
91
  }
92
92
 
@@ -98,7 +98,7 @@ class MelCloudAtw extends EventEmitter {
98
98
  });
99
99
  }
100
100
 
101
- async updateState(deviceData) {
101
+ async updateState(deviceData, type) {
102
102
  try {
103
103
  if (this.accountType === 'melcloudhome') {
104
104
  deviceData.Device.OperationMode = HeatPump.OperationModeMapStringToEnum[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
@@ -81,12 +81,12 @@ class MelCloudErv extends EventEmitter {
81
81
  updateState = true;
82
82
  break;
83
83
  default:
84
- if (this.logDebug) this.emit('debug', `Unit ${unitId}, received unknown message type: ${stringifyMessage}`);
84
+ if (this.logDebug) this.emit('debug', `Unit ${unitId}, received unknown message type: ${parsedMessage}`);
85
85
  return;
86
86
  }
87
87
  break;
88
88
  default:
89
- if (this.logDebug) this.emit('debug', `Incoming unknown unit id: ${stringifyMessage}`);
89
+ if (this.logDebug) this.emit('debug', `Incoming unknown unit id: ${parsedMessage}`);
90
90
  return;
91
91
  }
92
92
 
@@ -98,7 +98,7 @@ class MelCloudErv extends EventEmitter {
98
98
  });
99
99
  }
100
100
 
101
- async updateState(deviceData) {
101
+ async updateState(deviceData, type) {
102
102
  try {
103
103
  if (this.accountType === 'melcloudhome') {
104
104
  //read default temps
@@ -135,24 +135,13 @@ class MelCloudHome extends EventEmitter {
135
135
 
136
136
  const devices = buildingsList.flatMap(building => {
137
137
  // Funkcja kapitalizująca klucze obiektu
138
- const capitalizeKeys = obj =>
139
- Object.fromEntries(
140
- Object.entries(obj).map(([key, value]) => [
141
- key.charAt(0).toUpperCase() + key.slice(1),
142
- value
143
- ])
144
- );
138
+ const capitalizeKeys = obj => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key.charAt(0).toUpperCase() + key.slice(1), value]));
145
139
 
146
140
  // Rekurencyjna kapitalizacja kluczy w obiekcie lub tablicy
147
141
  const capitalizeKeysDeep = obj => {
148
142
  if (Array.isArray(obj)) return obj.map(capitalizeKeysDeep);
149
143
  if (obj && typeof obj === 'object') {
150
- return Object.fromEntries(
151
- Object.entries(obj).map(([key, value]) => [
152
- key.charAt(0).toUpperCase() + key.slice(1),
153
- capitalizeKeysDeep(value)
154
- ])
155
- );
144
+ return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key.charAt(0).toUpperCase() + key.slice(1), capitalizeKeysDeep(value)]));
156
145
  }
157
146
  return obj;
158
147
  };