homebridge-melcloud-control 4.3.11-beta.6 → 4.3.11-beta.8

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.11-beta.6",
4
+ "version": "4.3.11-beta.8",
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/constants.js CHANGED
@@ -60,7 +60,7 @@ export const AirConditioner = {
60
60
  SystemMapEnumToString: { 0: "Air Conditioner Off", 1: "Air Conditioner On", 2: "Air Conditioner Offline" },
61
61
  OperationModeMapStringToEnum: { "0": 0, "Heat": 1, "Dry": 2, "Cool": 3, "4": 4, "5": 5, "6": 6, "Fan": 7, "Automatic": 8, "Heat Isee": 9, "Dry Isee": 10, "Cool Isee": 11 },
62
62
  OperationModeMapEnumToString: { 0: "0", 1: "Heat", 2: "Dry", 3: "Cool", 4: "4", 5: "5", 6: "6", 7: "Fan", 8: "Automatic", 9: "Heat Isee", 10: "Dry Isee", 11: "Cool Isee" },
63
- OperationModeMapEnumToEnumWs: { 0: 0, 1: 1, 2: 2, 3: 3, 4: 7, 5: 8, 6: 9, 7: 10, 8: 11 },
63
+ OperationModeMapEnumToEnumWs: { 0: 0, 1: 1, 2: 2, 3: 3, 4: 7, 5: 8 },
64
64
  FanSpeedMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5, "0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5 },
65
65
  FanSpeedMapEnumToString: { 0: "Auto", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five" },
66
66
  SetFanSpeedMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5, "0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5 },
package/src/deviceata.js CHANGED
@@ -1325,7 +1325,7 @@ class DeviceAta extends EventEmitter {
1325
1325
  async start() {
1326
1326
  try {
1327
1327
  //melcloud device
1328
- this.melCloudAta = new MelCloudAta(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud, this.accountInfo)
1328
+ this.melCloudAta = new MelCloudAta(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud)
1329
1329
  .on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
1330
1330
  if (this.logDeviceInfo && this.displayDeviceInfo) {
1331
1331
  this.emit('devInfo', `---- ${this.deviceTypeString}: ${this.deviceName} ----`);
package/src/deviceatw.js CHANGED
@@ -1567,7 +1567,7 @@ class DeviceAtw extends EventEmitter {
1567
1567
  async start() {
1568
1568
  try {
1569
1569
  //melcloud device
1570
- this.melCloudAtw = new MelCloudAtw(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud, this.accountInfo)
1570
+ this.melCloudAtw = new MelCloudAtw(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud)
1571
1571
  .on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, supportsHotWaterTank, supportsZone2) => {
1572
1572
  if (this.logDeviceInfo && this.displayDeviceInfo) {
1573
1573
  this.emit('devInfo', `---- ${this.deviceTypeString}: ${this.deviceName} ----`);
package/src/deviceerv.js CHANGED
@@ -1121,7 +1121,7 @@ class DeviceErv extends EventEmitter {
1121
1121
  async start() {
1122
1122
  try {
1123
1123
  //melcloud device
1124
- this.melCloudErv = new MelCloudErv(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud, this.accountInfo)
1124
+ this.melCloudErv = new MelCloudErv(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud)
1125
1125
  .on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
1126
1126
  if (this.logDeviceInfo && this.displayDeviceInfo) {
1127
1127
  this.emit('devInfo', `---- ${this.deviceTypeString}: ${this.deviceName} ----`);
package/src/melcloud.js CHANGED
@@ -121,7 +121,7 @@ class MelCloud extends EventEmitter {
121
121
  if (this.logDebug) this.emit('debug', `Connecting to MELCloud`);
122
122
 
123
123
  try {
124
- const accountInfo = { State: false, Info: '', Account: null, UseFahrenheit: false, Headers: {} }
124
+ const accountInfo = { State: false, Info: '', Account: null, UseFahrenheit: false }
125
125
 
126
126
  const payload = {
127
127
  Email: this.user,
@@ -163,6 +163,7 @@ class MelCloud extends EventEmitter {
163
163
  'Content-Type': 'application/json'
164
164
  };
165
165
  this.emit('headers', headers);
166
+
166
167
  this.headers = headers;
167
168
  this.axiosInstance = axios.create({
168
169
  baseURL: ApiUrls.BaseURL,
@@ -174,7 +175,6 @@ class MelCloud extends EventEmitter {
174
175
  accountInfo.Info = 'Connect Success';
175
176
  accountInfo.UseFahrenheit = loginData.UseFahrenheit;
176
177
  accountInfo.Account = account;
177
- accountInfo.Headers = headers;
178
178
  await this.functions.saveData(this.accountFile, accountInfo);
179
179
 
180
180
  return accountInfo
@@ -4,7 +4,7 @@ import Functions from './functions.js';
4
4
  import { ApiUrls, ApiUrlsHome, AirConditioner } from './constants.js';
5
5
 
6
6
  class MelCloudAta extends EventEmitter {
7
- constructor(account, device, defaultTempsFile, accountFile, melcloud, accountInfo) {
7
+ constructor(account, device, defaultTempsFile, accountFile, melcloud) {
8
8
  super();
9
9
  this.accountType = account.type;
10
10
  this.logSuccess = account.log?.success;
@@ -24,7 +24,7 @@ class MelCloudAta extends EventEmitter {
24
24
 
25
25
  //set default values
26
26
  this.deviceData = {};
27
- this.headers = accountInfo.Headers;
27
+ this.headers = melcloud.headers;
28
28
 
29
29
  //handle melcloud events
30
30
  let deviceData = null;
@@ -32,7 +32,6 @@ class MelCloudAta extends EventEmitter {
32
32
  this.headers = headers;
33
33
  }).on('devicesList', async (devicesData) => {
34
34
  try {
35
- this.emit('debug', `Headers: ${JSON.stringify(melcloud.headers, null, 2)}`);
36
35
  deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
37
36
  if (!deviceData) return;
38
37
  deviceData.Scenes = devicesData.Scenes ?? [];
@@ -325,7 +324,7 @@ class MelCloudAta extends EventEmitter {
325
324
  //sens payload
326
325
  headers['Content-Type'] = 'application/json; charset=utf-8';
327
326
  headers.Origin = ApiUrlsHome.Origin;
328
- if (!this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
327
+ if (this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
329
328
 
330
329
  await axios(path, {
331
330
  method: method,
@@ -4,7 +4,7 @@ import Functions from './functions.js';
4
4
  import { ApiUrls, ApiUrlsHome, HeatPump } from './constants.js';
5
5
 
6
6
  class MelCloudAtw extends EventEmitter {
7
- constructor(account, device, defaultTempsFile, accountFile, melcloud, accountInfo) {
7
+ constructor(account, device, defaultTempsFile, accountFile, melcloud) {
8
8
  super();
9
9
  this.accountType = account.type;
10
10
  this.logSuccess = account.log?.success;
@@ -24,7 +24,7 @@ class MelCloudAtw extends EventEmitter {
24
24
 
25
25
  //set default values
26
26
  this.deviceData = {};
27
- this.headers = accountInfo.Headers;
27
+ this.headers = melcloud.headers;
28
28
 
29
29
  //handle melcloud events
30
30
  let deviceData = null;
@@ -4,7 +4,7 @@ import Functions from './functions.js';
4
4
  import { ApiUrls, ApiUrlsHome, Ventilation } from './constants.js';
5
5
 
6
6
  class MelCloudErv extends EventEmitter {
7
- constructor(account, device, defaultTempsFile, accountFile, melcloud, accountInfo) {
7
+ constructor(account, device, defaultTempsFile, accountFile, melcloud) {
8
8
  super();
9
9
  this.accountType = account.type;
10
10
  this.logSuccess = account.log?.success;
@@ -24,7 +24,7 @@ class MelCloudErv extends EventEmitter {
24
24
 
25
25
  //set default values
26
26
  this.deviceData = {};
27
- this.headers = accountInfo.Headers;
27
+ this.headers = melcloud.headers;
28
28
 
29
29
  //handle melcloud events
30
30
  let deviceData = null;
@@ -202,8 +202,11 @@ class MelCloudHome extends EventEmitter {
202
202
  // Get scenes
203
203
  let scenes = [];
204
204
  try {
205
- scenes = await this.checkScenesList();
206
- if (this.logDebug) this.emit('debug', `Found ${scenes.length} scenes`);
205
+ const scenesList = await this.checkScenesList();
206
+ if (this.logDebug) this.emit('debug', `Found ${scenesList.length} scenes`);
207
+ if (scenesList.length > 0) {
208
+ scenes = scenesList;
209
+ }
207
210
  } catch (error) {
208
211
  if (this.logError) this.emit('error', `Get scenes error: ${error}`);
209
212
  }
@@ -270,7 +273,7 @@ class MelCloudHome extends EventEmitter {
270
273
 
271
274
  let browser;
272
275
  try {
273
- const accountInfo = { State: false, Info: '', Account: {}, UseFahrenheit: false, Headers: {} };
276
+ const accountInfo = { State: false, Info: '', Account: {}, UseFahrenheit: false };
274
277
  let chromiumPath = await this.functions.ensureChromiumInstalled();
275
278
 
276
279
  // === Fallback to Puppeteer's built-in Chromium ===
@@ -431,7 +434,6 @@ class MelCloudHome extends EventEmitter {
431
434
 
432
435
  accountInfo.State = true;
433
436
  accountInfo.Info = 'Connect Success';
434
- accountInfo.Headers = headers;
435
437
  await this.functions.saveData(this.accountFile, accountInfo);
436
438
 
437
439
  return accountInfo;