homebridge-melcloud-control 3.1.4-beta.10 → 3.1.4-beta.3

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/index.js CHANGED
@@ -55,7 +55,7 @@ class MelCloudPlatform {
55
55
 
56
56
  //define directory and file paths
57
57
  const prefDir = path.join(api.user.storagePath(), 'melcloud');
58
- const accountFile = `${prefDir}/${accountName}_Account`;
58
+ const accountInfoFile = `${prefDir}/${accountName}_Account`;
59
59
  const buildingsFile = `${prefDir}/${accountName}_Buildings`;
60
60
  const devicesFile = `${prefDir}/${accountName}_Devices`;
61
61
 
@@ -74,7 +74,7 @@ class MelCloudPlatform {
74
74
 
75
75
  try {
76
76
  //melcloud account
77
- const melCloud = new MelCloud(user, passwd, language, accountFile, buildingsFile, devicesFile, enableDebugMode, false);
77
+ const melCloud = new MelCloud(user, passwd, language, accountInfoFile, buildingsFile, devicesFile, enableDebugMode, false);
78
78
  melCloud.on('success', (message) => {
79
79
  log.success(`Account ${accountName}, ${message}`);
80
80
  })
@@ -106,15 +106,15 @@ class MelCloudPlatform {
106
106
  //Air Conditioner 0
107
107
  for (const device of account.ataDevices) {
108
108
  //chack device from config exist on melcloud
109
- const deviceId = device.id;
110
- const deviceExistInMelCloud = devices.some(dev => dev.DeviceID === deviceId);
109
+ const deviceExistInMelCloud = devices.some(dev => dev.DeviceID === device.id);
111
110
  if (!deviceExistInMelCloud || device.displayMode === 0) {
112
111
  continue;
113
112
  };
114
113
 
114
+ const deviceId = device.id.toString();
115
115
  const deviceName = device.name;
116
116
  const deviceTypeText = device.typeString;
117
- const airConditioner = new DeviceAta(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountFile, devicesFile, deviceRefreshInterval)
117
+ const airConditioner = new DeviceAta(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountInfoFile, devicesFile, deviceRefreshInterval)
118
118
  airConditioner.on('publishAccessory', (accessory) => {
119
119
 
120
120
  //publish device
@@ -144,15 +144,15 @@ class MelCloudPlatform {
144
144
  //Heat Pump 1
145
145
  for (const device of account.atwDevices) {
146
146
  //chack device from config exist on melcloud
147
- const deviceId = device.id;
148
147
  const deviceExistInMelCloud = devices.some(dev => dev.DeviceID === device.id);
149
148
  if (!deviceExistInMelCloud || device.displayMode === 0) {
150
149
  continue;
151
150
  };
152
151
 
152
+ const deviceId = device.id.toString();
153
153
  const deviceName = device.name;
154
154
  const deviceTypeText = device.typeString;
155
- const heatPump = new DeviceAtw(api, account, melCloud, device, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountFile, devicesFile, deviceRefreshInterval)
155
+ const heatPump = new DeviceAtw(api, account, melCloud, device, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountInfoFile, devicesFile, deviceRefreshInterval)
156
156
  heatPump.on('publishAccessory', (accessory) => {
157
157
 
158
158
  //publish device
@@ -182,15 +182,15 @@ class MelCloudPlatform {
182
182
  //Energy Recovery Ventilation 3
183
183
  for (const device of account.ervDevices) {
184
184
  //chack device from config exist on melcloud
185
- const deviceId = device.id;
186
185
  const deviceExistInMelCloud = devices.some(dev => dev.DeviceID === device.id);
187
186
  if (!deviceExistInMelCloud || device.displayMode === 0) {
188
187
  continue;
189
188
  };
190
189
 
190
+ const deviceId = device.id.toString();
191
191
  const deviceName = device.name;
192
192
  const deviceTypeText = device.typeString;
193
- const energyRecoveryVentilation = new DeviceErv(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountFile, devicesFile, deviceRefreshInterval)
193
+ const energyRecoveryVentilation = new DeviceErv(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountInfoFile, devicesFile, deviceRefreshInterval)
194
194
  energyRecoveryVentilation.on('publishAccessory', (accessory) => {
195
195
 
196
196
  //publish device
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.1.4-beta.10",
4
+ "version": "3.1.4-beta.3",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "engines": {
31
31
  "homebridge": "^1.6.0 || ^2.0.0-beta.0",
32
- "node": "^18.20.4 || ^20.15.1 || ^22.7.0"
32
+ "node": "^18.20.4 || ^20.15.1, || ^22.7.0"
33
33
  },
34
34
  "dependencies": {
35
35
  "@homebridge/plugin-ui-utils": "^1.0.3",
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, accountFile, devicesFile, refreshInterval) {
10
+ constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountInfoFile, devicesFile, refreshInterval) {
11
11
  super();
12
12
 
13
13
  Accessory = api.platformAccessory;
@@ -94,7 +94,7 @@ class DeviceAta extends EventEmitter {
94
94
  //melcloud device
95
95
  this.melCloudAta = new MelCloudAta({
96
96
  contextKey: contextKey,
97
- accountFile: accountFile,
97
+ accountInfoFile: accountInfoFile,
98
98
  devicesFile: devicesFile,
99
99
  deviceId: deviceId,
100
100
  debugLog: account.enableDebugMode,
package/src/deviceatw.js CHANGED
@@ -7,7 +7,7 @@ const CONSTANTS = require('./constants.json');
7
7
  let Accessory, Characteristic, Service, Categories, AccessoryUUID;
8
8
 
9
9
  class DeviceAtw extends EventEmitter {
10
- constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountFile, devicesFile, refreshInterval) {
10
+ constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountInfoFile, devicesFile, refreshInterval) {
11
11
  super();
12
12
 
13
13
  Accessory = api.platformAccessory;
@@ -90,7 +90,7 @@ class DeviceAtw extends EventEmitter {
90
90
  //melcloud device
91
91
  this.melCloudAtw = new MelCloudAtw({
92
92
  contextKey: contextKey,
93
- accountFile: accountFile,
93
+ accountInfoFile: accountInfoFile,
94
94
  devicesFile: devicesFile,
95
95
  deviceId: deviceId,
96
96
  debugLog: account.enableDebugMode,
package/src/deviceerv.js CHANGED
@@ -7,7 +7,7 @@ const CONSTANTS = require('./constants.json');
7
7
  let Accessory, Characteristic, Service, Categories, AccessoryUUID;
8
8
 
9
9
  class DeviceErv extends EventEmitter {
10
- constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountFile, devicesFile, refreshInterval) {
10
+ constructor(api, account, device, melCloud, accountInfo, contextKey, accountName, deviceId, deviceName, deviceTypeText, accountInfoFile, devicesFile, refreshInterval) {
11
11
  super();
12
12
 
13
13
  Accessory = api.platformAccessory;
@@ -93,7 +93,7 @@ class DeviceErv extends EventEmitter {
93
93
  //melcloud device
94
94
  this.melCloudErv = new MelCloudErv({
95
95
  contextKey: contextKey,
96
- accountFile: accountFile,
96
+ accountInfoFile: accountInfoFile,
97
97
  devicesFile: devicesFile,
98
98
  deviceId: deviceId,
99
99
  debugLog: account.enableDebugMode,
package/src/melcloud.js CHANGED
@@ -8,15 +8,14 @@ const ImpulseGenerator = require('./impulsegenerator.js');
8
8
  const CONSTANTS = require('./constants.json');
9
9
 
10
10
  class MelCloud extends EventEmitter {
11
- constructor(user, passwd, language, accountFile, buildingsFile, devicesFile, enableDebugMode, requestConfig) {
11
+ constructor(user, passwd, language, accountInfoFile, buildingsFile, devicesFile, enableDebugMode, requestConfig) {
12
12
  super();
13
- this.accountFile = accountFile;
13
+ this.accountInfoFile = accountInfoFile;
14
14
  this.buildingsFile = buildingsFile;
15
15
  this.devicesFile = devicesFile;
16
16
  this.enableDebugMode = enableDebugMode;
17
17
  this.requestConfig = requestConfig;
18
18
  this.contextKey = '';
19
- this.useFahrenheit = 0;
20
19
  this.devicesId = [];
21
20
 
22
21
  this.options = {
@@ -63,7 +62,6 @@ class MelCloud extends EventEmitter {
63
62
  const account = accountData.data;
64
63
  const accountInfo = account.LoginData;
65
64
  const contextKey = accountInfo.ContextKey;
66
- this.useFahrenheit = accountInfo.UseFahrenheit
67
65
  this.contextKey = contextKey;
68
66
 
69
67
  //remove sensitive data
@@ -84,7 +82,7 @@ class MelCloud extends EventEmitter {
84
82
  };
85
83
 
86
84
  //save melcloud info to the file
87
- await this.saveData(this.accountFile, accountInfo);
85
+ await this.saveData(this.accountInfoFile, accountInfo);
88
86
 
89
87
  //emit connect success
90
88
  this.emit('success', `Connect to MELCloud Success.`)
@@ -146,7 +144,6 @@ class MelCloud extends EventEmitter {
146
144
  ];
147
145
 
148
146
  //add all devices to the devices array
149
- devices.useFahrenheit = this.useFahrenheit;
150
147
  devices.push(...allDevices);
151
148
  }
152
149
 
@@ -155,10 +152,11 @@ class MelCloud extends EventEmitter {
155
152
  this.emit('warn', `No devices found.`);
156
153
  return;
157
154
  }
155
+ const debug3 = this.enableDebugMode ? this.emit('debug', `Found: ${devicesCount} devices.`) : false;
158
156
 
159
- //save buildings to the file
160
- await this.saveData(this.devicesFile, devices);
161
- const debug3 = this.enableDebugMode ? this.emit('debug', `${devicesCount} devices saved.`) : false;
157
+ //save buildings to the file
158
+ await this.saveData(this.devicesFile, devices);
159
+ const debug4 = this.enableDebugMode ? this.emit('debug', `Devices list saved.`) : false;
162
160
 
163
161
  return devices;
164
162
  } catch (error) {
@@ -11,7 +11,7 @@ class MelCloudAta extends EventEmitter {
11
11
  constructor(config) {
12
12
  super();
13
13
  const contextKey = config.contextKey;
14
- const accountFile = config.accountFile;
14
+ const accountInfoFile = config.accountInfoFile;
15
15
  const devicesFile = config.devicesFile;
16
16
  const deviceId = config.deviceId;
17
17
  const debugLog = config.debugLog;
@@ -40,7 +40,7 @@ class MelCloudAta extends EventEmitter {
40
40
  impulseGenerator.on('checkDevice', async () => {
41
41
  try {
42
42
  //read account info from file
43
- const accountInfo = await this.readData(accountFile);
43
+ const accountInfo = await this.readData(accountInfoFile);
44
44
 
45
45
  //remove sensitive data
46
46
  const debugData = {
@@ -58,7 +58,7 @@ class MelCloudAta extends EventEmitter {
58
58
 
59
59
  //read device info from file
60
60
  const devicesData = await this.readData(devicesFile);
61
- const debug1 = debugLog ? this.emit('debug', `Device Info: ${JSON.stringify(devicesData, null, 2)}`) : false;
61
+ const debug1 = debugLog ? this.emit('debug', `Device Info: ${JSON.stringify(deviceData, null, 2)}`) : false;
62
62
  const deviceData = devicesData.find((device) => device.DeviceID === deviceId);
63
63
 
64
64
  if (!deviceData) {
@@ -324,7 +324,7 @@ class MelCloudAta extends EventEmitter {
324
324
 
325
325
  //device state
326
326
  const deviceState = {
327
- DeviceId: deviceId,
327
+ DeviceId: deviceId.toString(),
328
328
  EffectiveFlags: effectiveFlags,
329
329
  RoomTemperature: roomTemperature,
330
330
  SetTemperature: setTemperature,
@@ -11,7 +11,7 @@ class MelCloudAtw extends EventEmitter {
11
11
  constructor(config) {
12
12
  super();
13
13
  const contextKey = config.contextKey;
14
- const accountFile = config.accountFile;
14
+ const accountInfoFile = config.accountInfoFile;
15
15
  const devicesFile = config.devicesFile;
16
16
  const deviceId = config.deviceId;
17
17
  const debugLog = config.debugLog;
@@ -40,7 +40,7 @@ class MelCloudAtw extends EventEmitter {
40
40
  impulseGenerator.on('checkDevice', async () => {
41
41
  try {
42
42
  //read account info from file
43
- const accountInfo = await this.readData(accountFile);
43
+ const accountInfo = await this.readData(accountInfoFile);
44
44
 
45
45
  //remove sensitive data
46
46
  const debugData = {
@@ -386,7 +386,7 @@ class MelCloudAtw extends EventEmitter {
386
386
 
387
387
  //device state
388
388
  const deviceState = {
389
- DeviceId: deviceId,
389
+ DeviceId: deviceId.toString(),
390
390
  EffectiveFlags: effectiveFlags,
391
391
  SetTemperatureZone1: setTemperatureZone1,
392
392
  SetTemperatureZone2: setTemperatureZone2,
@@ -11,7 +11,7 @@ class MelCloudErv extends EventEmitter {
11
11
  constructor(config) {
12
12
  super();
13
13
  const contextKey = config.contextKey;
14
- const accountFile = config.accountFile;
14
+ const accountInfoFile = config.accountInfoFile;
15
15
  const devicesFile = config.devicesFile;
16
16
  const deviceId = config.deviceId;
17
17
  const debugLog = config.debugLog;
@@ -40,7 +40,7 @@ class MelCloudErv extends EventEmitter {
40
40
  impulseGenerator.on('checkDevice', async () => {
41
41
  try {
42
42
  //read account info from file
43
- const accountInfo = await this.readData(accountFile);
43
+ const accountInfo = await this.readData(accountInfoFile);
44
44
 
45
45
  //remove sensitive data
46
46
  const debugData = {
@@ -313,7 +313,7 @@ class MelCloudErv extends EventEmitter {
313
313
 
314
314
  //device state
315
315
  const deviceState = {
316
- DeviceId: deviceId,
316
+ DeviceId: deviceId.toString(),
317
317
  EffectiveFlags: effectiveFlags,
318
318
  RoomTemperature: roomTemperature,
319
319
  SupplyTemperature: supplyTemperature,