homebridge-melcloud-control 4.2.5-beta.3 → 4.2.5-beta.5

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/README.md CHANGED
@@ -272,7 +272,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
272
272
  | `ataDevices[].buttonsSensors[]` | Array of buttons sensors. |
273
273
  | `ataDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
274
274
  | `ataDevices[].buttonsSensors[].mode` | Here select button mode, VH - Vane Horizontal, VV - Vane Horizontal. |
275
- | `ataDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
275
+ | `ataDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch +Contact Sensor`. |
276
276
  | `ataDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
277
277
  | `atwDevices[]` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
278
278
  | `atwDevices[].id` | Read only data, do not change it. |
@@ -309,7 +309,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
309
309
  | `atwDevices[].buttonsSensors[]` | Array of buttons sensors. |
310
310
  | `atwDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
311
311
  | `atwDevices[].buttonsSensors[].mode` | Here select button mode. |
312
- | `atwDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
312
+ | `atwDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch +Contact Sensor`. |
313
313
  | `atwDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
314
314
  | `ervDevices[]` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
315
315
  | `ervDevices[].id` | Read only data, do not change it. |
@@ -339,7 +339,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
339
339
  | `ervDevices[].buttonsSensors[]` | Array of buttons sensors. |
340
340
  | `ervDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
341
341
  | `ervDevices[].buttonsSensors[].mode` | Here select button mode. |
342
- | `ervDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`, `3 - Motion Sensor`, `4 - Occupancy Sensor`, `5 - Contact Sensor`. |
342
+ | `ervDevices[].buttonsSensors[].displayType` | Here select display type in HomeKit, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`, `4 - Switch + Motion Sensor`, `5 - Switch +Occupancy Sensor`, `6 - Switch +Contact Sensor`. |
343
343
  | `ervDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
344
344
  | `refreshInterval` | Here set the background account data refresh time in (sec) , only for old MELCLoud, default `120s`. |
345
345
  | `log{}` | Log object. |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.2.5-beta.3",
4
+ "version": "4.2.5-beta.5",
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/deviceatw.js CHANGED
@@ -1378,9 +1378,6 @@ class DeviceAtw extends EventEmitter {
1378
1378
  //get button mode
1379
1379
  const mode = button.mode;
1380
1380
 
1381
- //get button display type
1382
- const displayType = button.displayType;
1383
-
1384
1381
  //get button name
1385
1382
  const name = button.name;
1386
1383
 
@@ -1394,10 +1391,10 @@ class DeviceAtw extends EventEmitter {
1394
1391
  //control
1395
1392
  if (button.displayType > 3) {
1396
1393
  if (this.logDebug) this.emit('debug', `Prepare button control ${name} service`);
1397
- const buttonControlService = new serviceType(serviceName, `buttonControlService${deviceId} ${i}`);
1394
+ const buttonControlService = new serviceType(serviceName1, `buttonControlService${deviceId} ${i}`);
1398
1395
  buttonControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1399
1396
  buttonControlService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
1400
- buttonControlService.getCharacteristic(characteristicType)
1397
+ buttonControlService.getCharacteristic(Characteristic.On)
1401
1398
  .onGet(async () => {
1402
1399
  const state = button.state;
1403
1400
  return state;
@@ -1552,9 +1549,9 @@ class DeviceAtw extends EventEmitter {
1552
1549
 
1553
1550
  //sensor
1554
1551
  if (this.logDebug) this.emit('debug', `Prepare button control sensor ${name} service`);
1555
- const buttonControlSensorService = new serviceType(serviceName, `buttonControlSensorService${deviceId} ${i}`);
1552
+ const buttonControlSensorService = new serviceType(serviceName1, `buttonControlSensorService${deviceId} ${i}`);
1556
1553
  buttonControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1557
- buttonControlSensorService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
1554
+ buttonControlSensorService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
1558
1555
  buttonControlSensorService.getCharacteristic(characteristicType)
1559
1556
  .onGet(async () => {
1560
1557
  const state = button.state;
package/src/deviceerv.js CHANGED
@@ -983,12 +983,12 @@ class DeviceErv extends EventEmitter {
983
983
  const mode = button.mode;
984
984
 
985
985
  //get button name
986
- const buttonName = button.name;
986
+ const name = button.name;
987
987
 
988
988
  //get button name prefix
989
989
  const namePrefix = button.namePrefix;
990
990
 
991
- const serviceName1 = namePrefix ? `${accessoryName} ${buttonName}` : buttonName;
991
+ const serviceName1 = namePrefix ? `${accessoryName} ${name}` : name;
992
992
  const serviceType = button.serviceType;
993
993
  const characteristicType = button.characteristicType;
994
994
 
@@ -1082,7 +1082,7 @@ class DeviceErv extends EventEmitter {
1082
1082
  break;
1083
1083
  };
1084
1084
 
1085
- if (this.logInfo) this.emit('info', `${state ? `Set: ${buttonName}` : `Unset: ${buttonName}, Set: ${button.previousValue}`}`);
1085
+ if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
1086
1086
  await this.melCloudErv.send(this.accountType, this.displayType, deviceData, flag);
1087
1087
  } catch (error) {
1088
1088
  if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
@@ -1094,9 +1094,9 @@ class DeviceErv extends EventEmitter {
1094
1094
 
1095
1095
  //sensor
1096
1096
  if (this.logDebug) this.emit('debug', `Prepare button control sensor ${name} service`);
1097
- const buttonControlSensorService = new serviceType(serviceName, `buttonControlSensorService${deviceId} ${i}`);
1097
+ const buttonControlSensorService = new serviceType(serviceName1, `buttonControlSensorService${deviceId} ${i}`);
1098
1098
  buttonControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1099
- buttonControlSensorService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
1099
+ buttonControlSensorService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
1100
1100
  buttonControlSensorService.getCharacteristic(characteristicType)
1101
1101
  .onGet(async () => {
1102
1102
  const state = button.state;
@@ -54,11 +54,10 @@ class MelCloudAta extends EventEmitter {
54
54
  //read device info from file
55
55
  const devicesData = await this.functions.readData(this.devicesFile, true);
56
56
  this.headers = devicesData.Headers;
57
- const scenes = devicesData.Scenes ?? [];
58
57
  const deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
59
58
 
60
59
  if (this.accountType === 'melcloudhome') {
61
- deviceData.Scenes = scenes;
60
+ deviceData.Scenes = devicesData.Scenes ?? [];
62
61
  deviceData.Device.OperationMode = AirConditioner.OperationModeMapStringToEnum[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
63
62
  deviceData.Device.ActualFanSpeed = AirConditioner.FanSpeedMapStringToEnum[deviceData.Device.ActualFanSpeed] ?? deviceData.Device.ActualFanSpeed;
64
63
  deviceData.Device.SetFanSpeed = AirConditioner.FanSpeedMapStringToEnum[deviceData.Device.SetFanSpeed] ?? deviceData.Device.SetFanSpeed;
@@ -244,7 +243,7 @@ class MelCloudAta extends EventEmitter {
244
243
  };
245
244
  method = 'PUT';
246
245
  path = ApiUrlsHome.PutAta.replace('deviceid', deviceData.DeviceID);
247
- this.headers.Referer = ApiUrlsHome.Referers.PutDeviceSettings
246
+ this.headers.Referer = ApiUrlsHome.Referers.PutDeviceSettings;
248
247
  break
249
248
  }
250
249
 
@@ -54,11 +54,10 @@ class MelCloudAtw extends EventEmitter {
54
54
  //read device info from file
55
55
  const devicesData = await this.functions.readData(this.devicesFile, true);
56
56
  this.headers = devicesData.Headers;
57
- const scenes = devicesData.Scenes ?? [];
58
57
  const deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
59
58
 
60
59
  if (this.accountType === 'melcloudhome') {
61
- deviceData.Scenes = scenes;
60
+ deviceData.Scenes = devicesData.Scenes ?? [];
62
61
  }
63
62
 
64
63
  const safeConfig = {
@@ -221,7 +220,7 @@ class MelCloudAtw extends EventEmitter {
221
220
  };
222
221
  method = 'PUT';
223
222
  path = ApiUrlsHome.PutAtw.replace('deviceid', deviceData.DeviceID);
224
- this.headers.Referer = ApiUrlsHome.Referers.PutDeviceSettings
223
+ this.headers.Referer = ApiUrlsHome.Referers.PutDeviceSettings;
225
224
  break
226
225
  }
227
226
 
@@ -54,11 +54,10 @@ class MelCloudErv extends EventEmitter {
54
54
  //read device info from file
55
55
  const devicesData = await this.functions.readData(this.devicesFile, true);
56
56
  this.headers = devicesData.Headers;
57
- const scenes = devicesData.Scenes ?? [];
58
57
  const deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
59
58
 
60
59
  if (this.accountType === 'melcloudhome') {
61
- deviceData.Scenes = scenes;
60
+ deviceData.Scenes = devicesData.Scenes ?? [];
62
61
 
63
62
  //read default temps
64
63
  const temps = await this.functions.readData(this.defaultTempsFile, true);
@@ -228,7 +227,7 @@ class MelCloudErv extends EventEmitter {
228
227
  };
229
228
  method = 'PUT';
230
229
  path = ApiUrlsHome.PutErv.replace('deviceid', deviceData.DeviceID);
231
- this.headers.Referer = ApiUrlsHome.Referers.PutDeviceSettings
230
+ this.headers.Referer = ApiUrlsHome.Referers.PutDeviceSettings;
232
231
  break
233
232
  }
234
233