homebridge-melcloud-control 4.2.3-beta.14 → 4.2.3-beta.16

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.2.3-beta.14",
4
+ "version": "4.2.3-beta.16",
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
@@ -163,3 +163,32 @@ export const AccessLevel = {
163
163
  Quest: 3,
164
164
  Owner: 4
165
165
  };
166
+
167
+ export const LanguageLocaleMap = {
168
+ "0": "en-US,en",
169
+ "1": "bg-BG,bg",
170
+ "2": "cs-CZ,cz",
171
+ "3": "da-DK,da",
172
+ "4": "de-DE,de",
173
+ "5": "et-EE,et",
174
+ "6": "es-ES,es",
175
+ "7": "fr-FR,fr",
176
+ "8": "hy-AM,hy",
177
+ "9": "lv-LV,lv",
178
+ "10": "lt-LT,lt",
179
+ "11": "hu-HU,hu",
180
+ "12": "nl-NL,nl",
181
+ "13": "no-NO,no",
182
+ "14": "pl-PL,pl",
183
+ "15": "pt-PT,pt",
184
+ "16": "ru-RU,ru",
185
+ "17": "fi-FI,fi",
186
+ "18": "sv-SE,sv",
187
+ "19": "it-IT,it",
188
+ "20": "uk-UA,uk",
189
+ "21": "tr-TR,tr",
190
+ "22": "el-GR,el",
191
+ "23": "hr-HR,hr",
192
+ "24": "ro-RO,ro",
193
+ "25": "sl-SI,sl"
194
+ };
@@ -6,7 +6,7 @@ import EventEmitter from 'events';
6
6
  import puppeteer from 'puppeteer';
7
7
  import ImpulseGenerator from './impulsegenerator.js';
8
8
  import Functions from './functions.js';
9
- import { ApiUrlsHome } from './constants.js';
9
+ import { ApiUrlsHome, LanguageLocaleMap } from './constants.js';
10
10
  const execPromise = promisify(exec);
11
11
 
12
12
  class MelCloud extends EventEmitter {
@@ -66,16 +66,16 @@ class MelCloud extends EventEmitter {
66
66
  const devicesList = { State: false, Info: null, Devices: [] }
67
67
  const headers = {
68
68
  'Accept': '*/*',
69
- 'Accept-Language': 'en-US,en;q=0.9',
69
+ 'Accept-Encoding': 'gzip, deflate, br',
70
+ 'Accept-Language': `${LanguageLocaleMap[this.language]};q=0.9`,
70
71
  'Cookie': this.contextKey,
71
- 'User-Agent': 'homebridge-melcloud-control/4.0.0',
72
72
  'DNT': '1',
73
- 'Origin': 'https://melcloudhome.com',
73
+ 'Priority': 'u=3, i',
74
74
  'Referer': 'https://melcloudhome.com/dashboard',
75
75
  'Sec-Fetch-Dest': 'empty',
76
76
  'Sec-Fetch-Mode': 'cors',
77
77
  'Sec-Fetch-Site': 'same-origin',
78
- 'X-CSRF': '1'
78
+ 'x-csrf': '1'
79
79
  };
80
80
 
81
81
  if (this.logDebug) this.emit('debug', `Scanning for devices`);