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

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/CHANGELOG.md CHANGED
@@ -22,6 +22,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
22
22
 
23
23
  - Do not use Homebridge UI > v5.5.0 because of break config.json
24
24
 
25
+ # [4.2.5] - (16.11.2025)
26
+
27
+ ## Changes
28
+
29
+ - fix device control stop working after some time
30
+ - updated presets, schedules, scenes characteristics
31
+ - stability and performance improvements
32
+ - config schema updated
33
+ - readme updated
34
+ - cleanup
35
+
25
36
  ## [4.2.3] - (15.11.2025)
26
37
 
27
38
  ## Changes
package/README.md CHANGED
@@ -31,12 +31,13 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
31
31
  * Support multiple accounts, buildings, floors, areas.
32
32
  * Support temperature display units `Celsius/Fahrenheit`.
33
33
  * Support assing inividual operating mode for `Heat/Cool/Auto`.
34
- * Support direct `Presets` control, only MELCloud.
35
- * Support direct `Schedules` control, only MELCloud Home.
36
- * Support direct `Frost protection` control, only MELCloud Home.
37
- * Support direct `Overheat Protection` control, only MELCloud Home.
38
- * Support direct `Holiday Mode` control.
39
- * Support direct `Functions` control using extra `Buttons`, switch it to `OFF` restore previous device state.
34
+ * Support direct `Presets`, only MELCloud.
35
+ * Support direct `Schedules`, only MELCloud Home.
36
+ * Support direct `Scenes`, only MELCloud Home.
37
+ * Support direct `Frost protection`, only MELCloud Home.
38
+ * Support direct `Overheat Protection`, only MELCloud Home.
39
+ * Support direct `Holiday Mode`.
40
+ * Support direct `Functions`, using extra `Buttons`, switch it to `OFF` restore previous device state.
40
41
  * Support automations, shortcuts and Siri.
41
42
  * Support external integrations, [RESTFul](https://github.com/grzegorz914/homebridge-melcloud-control?tab=readme-ov-file#restful-integration), [MQTT](https://github.com/grzegorz914/homebridge-melcloud-control?tab=readme-ov-file#mqtt-integration).
42
43
  * Control devices over local network You need use ESP module and [Tasmota Control](https://github.com/grzegorz914/homebridge-tasmota-control) plugin.
@@ -70,7 +71,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
70
71
  * Frost protection `ON/OFF`.
71
72
  * Overheat protection `ON/OFF`.
72
73
  * Holiday mode `ON/OFF`.
73
- * Schedule `ON/OFF`.
74
+ * Schedules `ON/OFF`.
74
75
  * Scene `ON/OFF`.
75
76
  * Sensors:
76
77
  * For automation and notifications.
@@ -88,7 +89,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
88
89
  * Frost protection.
89
90
  * Overheat protection.
90
91
  * Holiday mode.
91
- * Shedule control.
92
+ * Shedules control.
92
93
  * Shedule active.
93
94
  * Scene control.
94
95
  * Error.
@@ -129,7 +130,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
129
130
  * Physical lock controls `LOCK/UNLOCK`.
130
131
  * Presets `SET/UNSET`.
131
132
  * Holiday mode `ON/OFF`.
132
- * Schedule `ON/OFF`.
133
+ * Schedules `ON/OFF`.
133
134
  * Scene `ON/OFF`.
134
135
  * Sensors:
135
136
  * For automation and notifications.
@@ -144,7 +145,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
144
145
  * Flow Temperature Zone 1, 2, Hot Water.
145
146
  * Return Temperature Zone 1, 2, Hot Water.
146
147
  * Holiday mode.
147
- * Shedule control.
148
+ * Shedules control.
148
149
  * Shedule active.
149
150
  * Scene control.
150
151
  * Error.
@@ -165,7 +166,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
165
166
  * Fan speed mode `AUTO/1/2/3/4`.
166
167
  * Presets `SET/UNSET`.
167
168
  * Holiday mode `ON/OFF`.
168
- * Schedule `ON/OFF`.
169
+ * Schedules `ON/OFF`.
169
170
  * Scene `ON/OFF`.
170
171
  * Sensors:
171
172
  * For automation and notifications.
@@ -181,7 +182,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
181
182
  * CO2 detected and level.
182
183
  * PM2.5 air quality and level.
183
184
  * Holiday mode.
184
- * Shedule control.
185
+ * Shedules control.
185
186
  * Shedule active.
186
187
  * Scene control.
187
188
  * Error.
@@ -272,7 +273,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
272
273
  | `ataDevices[].buttonsSensors[]` | Array of buttons sensors. |
273
274
  | `ataDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
274
275
  | `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`. |
276
+ | `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
277
  | `ataDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
277
278
  | `atwDevices[]` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
278
279
  | `atwDevices[].id` | Read only data, do not change it. |
@@ -309,7 +310,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
309
310
  | `atwDevices[].buttonsSensors[]` | Array of buttons sensors. |
310
311
  | `atwDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
311
312
  | `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`. |
313
+ | `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
314
  | `atwDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
314
315
  | `ervDevices[]` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
315
316
  | `ervDevices[].id` | Read only data, do not change it. |
@@ -339,7 +340,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
339
340
  | `ervDevices[].buttonsSensors[]` | Array of buttons sensors. |
340
341
  | `ervDevices[].buttonsSensors[].name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
341
342
  | `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`. |
343
+ | `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
344
  | `ervDevices[].buttonsSensors[].namePrefix` | Here enable/disable the accessory name as a prefix for button/sensor name. |
344
345
  | `refreshInterval` | Here set the background account data refresh time in (sec) , only for old MELCLoud, default `120s`. |
345
346
  | `log{}` | Log object. |
@@ -394,7 +395,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
394
395
  | | `http//ip:port` | `FrostProtection` | `true`, `false` | boolean | Frost protectin. |
395
396
  | | `http//ip:port` | `OverheatProtection` | `true`, `false` | boolean | Overheat protection. |
396
397
  | | `http//ip:port` | `HolidayMode` | `true`, `false` | boolean | Holiday mode. |
397
- | | `http//ip:port` | `ScheduleEnabled` | `true`, `false` | boolean | Schedules. |
398
+ | | `http//ip:port` | `Schedules` | `true`, `false` | boolean | Schedules. |
398
399
  | Heat Pump | | | | | |
399
400
  | POST | `http//ip:port` | `Power` | `true`, `false` | boolean | Power state. |
400
401
  | | `http//ip:port` | `ForcedHotWaterMode` | `true`, `false` | boolean | Force hot water. |
@@ -413,7 +414,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
413
414
  | | `http//ip:port` | `SetCoolFlowTemperatureZone2` | `0.0` | float | Cool flow temperature zone 2. |
414
415
  | | `http//ip:port` | `SetTankWaterTemperature` | `0.0` | float | Hot water temperature. |
415
416
  | | `http//ip:port` | `HolidayMode` | `true`, `false` | boolean | Holiday mode. |
416
- | | `http//ip:port` | `ScheduleEnabled` | `true`, `false` | boolean | Schedules. |
417
+ | | `http//ip:port` | `Schedules` | `true`, `false` | boolean | Schedules. |
417
418
  | Energy Recovery Ventilation | | | | | |
418
419
  | POST | `http//ip:port` | `Power` | `true`, `false` | boolean | Power state. |
419
420
  | | `http//ip:port` | `NightPurgeMode` | `true`, `false` | boolean | Night purge mode. |
@@ -427,7 +428,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
427
428
  | | `http//ip:port` | `DefaultCoolingSetTemperature` | `0.0` | float | Default cooling temperature. |
428
429
  | | `http//ip:port` | `DefaultHeatingSetTemperature` | `0.0` | float | Default heating temperature. |
429
430
  | | `http//ip:port` | `HolidayMode` | `true`, `false` | boolean | Holiday mode. |
430
- | | `http//ip:port` | `ScheduleEnabled` | `true`, `false` | boolean | Schedules. |
431
+ | | `http//ip:port` | `Schedules` | `true`, `false` | boolean | Schedules. |
431
432
 
432
433
  ### MQTT Integration
433
434
 
@@ -456,7 +457,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
456
457
  | | `Set` | `FrostProtection` | `true`, `false` | boolean | Frost protectin. |
457
458
  | | `Set` | `OverheatProtection` | `true`, `false` | boolean | Overheat protection. |
458
459
  | | `Set` | `HolidayMode` | `true`, `false` | boolean | Holiday mode. |
459
- | | `Set` | `ScheduleEnabled` | `true`, `false` | boolean | Schedules. |
460
+ | | `Set` | `Schedules` | `true`, `false` | boolean | Schedules. |
460
461
  | Heat Pump | | | | | |
461
462
  | Subscribe | `Set` | `Power` | `true`, `false` | boolean | Power state. |
462
463
  | | `Set` | `ForcedHotWaterMode` | `true`, `false` | boolean | Force hot water. |
@@ -475,7 +476,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
475
476
  | | `Set` | `SetCoolFlowTemperatureZone2` | `0.0` | float | Cool flow temperature zone 2. |
476
477
  | | `Set` | `SetTankWaterTemperature` | `0.0` | float | Hot water temperature. |
477
478
  | | `Set` | `HolidayMode` | `true`, `false` | boolean | Holiday mode. |
478
- | | `Set` | `ScheduleEnabled` | `true`, `false` | boolean | Schedules. |
479
+ | | `Set` | `Schedules` | `true`, `false` | boolean | Schedules. |
479
480
  | Energy Recovery Ventilation | | | | | |
480
481
  | Subscribe | `Set` | `Power` | `true`, `false` | boolean | Power state. |
481
482
  | | `Set` | `NightPurgeMode` | `true`, `false` | boolean | Night purge mode. |
@@ -489,4 +490,4 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
489
490
  | | `Set` | `DefaultCoolingSetTemperature` | `23.0` | float | Default cooling temperature. |
490
491
  | | `Set` | `DefaultHeatingSetTemperature` | `21.0` | float | Default heating temperature. |
491
492
  | | `Set` | `HolidayMode` | `true`, `false` | boolean | Holiday mode. |
492
- | | `Set` | `ScheduleEnabled` | `true`, `false` | boolean | Schedules. |
493
+ | | `Set` | `Schedules` | `true`, `false` | boolean | Schedules. |
@@ -24,7 +24,7 @@
24
24
  "user": {
25
25
  "title": "User",
26
26
  "type": "string",
27
- "placeholder": "User",
27
+ "placeholder": "Email",
28
28
  "description": "MELCloud account username."
29
29
  },
30
30
  "passwd": {
@@ -41,7 +41,7 @@
41
41
  "maxLength": 2,
42
42
  "pattern": "^[0-9]+$",
43
43
  "default": "0",
44
- "description": "Here select the language used in MELCloud account.",
44
+ "description": "Here select the account language.",
45
45
  "anyOf": [
46
46
  {
47
47
  "title": "English",
@@ -205,7 +205,7 @@
205
205
  "title": "Account Type",
206
206
  "type": "string",
207
207
  "default": "disabled",
208
- "description": "Here select the MELCloud account type.",
208
+ "description": "Here select the account type.",
209
209
  "anyOf": [
210
210
  {
211
211
  "title": "None/Disabled",
@@ -698,7 +698,7 @@
698
698
  "title": "Prefix",
699
699
  "type": "boolean",
700
700
  "default": false,
701
- "description": "Enable/disable the accessory name as a prefix for schedule name.",
701
+ "description": "Enable/disable the accessory name as a prefix for scene name.",
702
702
  "condition": {
703
703
  "functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].scenes[arrayIndices[2]].displayType > 0;"
704
704
  }
@@ -1521,7 +1521,7 @@
1521
1521
  "title": "Prefix",
1522
1522
  "type": "boolean",
1523
1523
  "default": false,
1524
- "description": "Enable/disable the accessory name as a prefix for schedule name.",
1524
+ "description": "Enable/disable the accessory name as a prefix for scene name.",
1525
1525
  "condition": {
1526
1526
  "functionBody": "return model.accounts[arrayIndices[0]].atwDevices[arrayIndices[1]].scenes[arrayIndices[2]].displayType > 0;"
1527
1527
  }
@@ -2123,7 +2123,7 @@
2123
2123
  "title": "Prefix",
2124
2124
  "type": "boolean",
2125
2125
  "default": false,
2126
- "description": "Enable/disable the accessory name as a prefix for schedule name.",
2126
+ "description": "Enable/disable the accessory name as a prefix for scene name.",
2127
2127
  "condition": {
2128
2128
  "functionBody": "return model.accounts[arrayIndices[0]].ervDevices[arrayIndices[1]].scenes[arrayIndices[2]].displayType > 0;"
2129
2129
  }
@@ -2340,27 +2340,27 @@
2340
2340
  "description": "This enable logging device info on plugin start."
2341
2341
  },
2342
2342
  "success": {
2343
- "title": "Log Success",
2343
+ "title": "Success",
2344
2344
  "type": "boolean",
2345
2345
  "default": true
2346
2346
  },
2347
2347
  "info": {
2348
- "title": "Log Info",
2348
+ "title": "Info",
2349
2349
  "type": "boolean",
2350
2350
  "default": false
2351
2351
  },
2352
2352
  "warn": {
2353
- "title": "Log Warn",
2353
+ "title": "Warn",
2354
2354
  "type": "boolean",
2355
2355
  "default": true
2356
2356
  },
2357
2357
  "error": {
2358
- "title": "Log Error",
2358
+ "title": "Error",
2359
2359
  "type": "boolean",
2360
2360
  "default": true
2361
2361
  },
2362
2362
  "debug": {
2363
- "title": "Log Debug",
2363
+ "title": "Debug",
2364
2364
  "type": "boolean",
2365
2365
  "default": false
2366
2366
  }
package/index.js CHANGED
@@ -106,7 +106,6 @@ class MelCloudPlatform {
106
106
  return;
107
107
  }
108
108
  if (logLevel.success) log.success(accountInfo.Info);
109
- const useFahrenheit = accountInfo.UseFahrenheit;
110
109
 
111
110
  //check devices list
112
111
  let devicesList;
@@ -166,30 +165,22 @@ class MelCloudPlatform {
166
165
  let configuredDevice;
167
166
  switch (deviceType) {
168
167
  case 0: //ATA
169
- configuredDevice = new DeviceAta(api, account, device, devicesFile, defaultTempsFile, useFahrenheit);
168
+ configuredDevice = new DeviceAta(api, account, device, devicesFile, defaultTempsFile, accountInfo, accountFile);
170
169
  break;
171
170
  case 1: //ATW
172
- configuredDevice = new DeviceAtw(api, account, device, devicesFile, defaultTempsFile, useFahrenheit);
171
+ configuredDevice = new DeviceAtw(api, account, device, devicesFile, defaultTempsFile, accountInfo, accountFile);
173
172
  break;
174
173
  case 2:
175
174
  break;
176
175
  case 3: //ERV
177
- configuredDevice = new DeviceErv(api, account, device, devicesFile, defaultTempsFile, useFahrenheit);
176
+ configuredDevice = new DeviceErv(api, account, device, devicesFile, defaultTempsFile, accountInfo, accountFile);
178
177
  break;
179
178
  default:
180
179
  if (logLevel.warn) log.warn(`${accountName}, ${deviceTypeText}, ${deviceName}, unknown device: ${deviceType}.`);
181
180
  return;
182
181
  }
183
182
 
184
- configuredDevice.on('melCloud', async (key, value) => {
185
- try {
186
- const accountDate = account.type === 'melcloud' ? accountInfo.LoginData[key] = value : accountInfo[key];
187
- await melCloud.send(accountDate);
188
- } catch (error) {
189
- if (logLevel.error) log.error(`${accountName}, ${deviceTypeText}, ${deviceName}, ${error.message ?? error}.`);
190
- }
191
- })
192
- .on('devInfo', (info) => logLevel.devInfo && log.info(info))
183
+ configuredDevice.on('devInfo', (info) => logLevel.devInfo && log.info(info))
193
184
  .on('success', (msg) => logLevel.success && log.success(`${accountName}, ${deviceTypeText}, ${deviceName}, ${msg}`))
194
185
  .on('info', (msg) => logLevel.info && log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, ${msg}`))
195
186
  .on('debug', (msg) => logLevel.debug && log.info(`${accountName}, ${deviceTypeText}, ${deviceName}, debug: ${msg}`))
@@ -202,9 +193,9 @@ class MelCloudPlatform {
202
193
  if (logLevel.success) log.success(`${accountName}, ${deviceTypeText}, ${deviceName}, Published as external accessory.`);
203
194
 
204
195
  //start impulse generators\
205
- const timmers = accountType === 'melcloudhome' ? [{ name: 'connect', sampling: 1800000 }, { name: 'checkDevicesList', sampling: deviceRefreshInterval }] : [{ name: 'checkDevicesList', sampling: refreshInterval }];
206
- await melCloud.impulseGenerator.state(true, timmers, false);
207
196
  await configuredDevice.startStopImpulseGenerator(true, [{ name: 'checkState', sampling: deviceRefreshInterval }]);
197
+ const timmers = accountType === 'melcloudhome' ? [{ name: 'connect', sampling: 3000000 }, { name: 'checkDevicesList', sampling: 3000 }] : [{ name: 'checkDevicesList', sampling: refreshInterval }];
198
+ await melCloud.impulseGenerator.state(true, timmers, false);
208
199
 
209
200
  //stop impulse generator
210
201
  await impulseGenerator.state(false);
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.31",
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
@@ -19,6 +19,7 @@ export const ApiUrls = {
19
19
 
20
20
  export const ApiUrlsHome = {
21
21
  BaseURL: "https://melcloudhome.com",
22
+ GetConfiguration: "https://melcloudhome.com/api/configuration",
22
23
  GetUserContext: "/api/user/context",
23
24
  GetUserScenes: "/api/user/scenes",
24
25
  PutAta: "/api/ataunit/deviceid",
package/src/deviceata.js CHANGED
@@ -6,7 +6,7 @@ import { TemperatureDisplayUnits, AirConditioner } from './constants.js';
6
6
  let Accessory, Characteristic, Service, Categories, AccessoryUUID;
7
7
 
8
8
  class DeviceAta extends EventEmitter {
9
- constructor(api, account, device, devicesFile, defaultTempsFile, useFahrenheit) {
9
+ constructor(api, account, device, devicesFile, defaultTempsFile, accountInfo, accountFile) {
10
10
  super();
11
11
 
12
12
  Accessory = api.platformAccessory;
@@ -49,6 +49,8 @@ class DeviceAta extends EventEmitter {
49
49
  //files
50
50
  this.devicesFile = devicesFile;
51
51
  this.defaultTempsFile = defaultTempsFile;
52
+ this.accountInfo = accountInfo;
53
+ this.accountFile = accountFile;
52
54
  this.displayDeviceInfo = true;
53
55
 
54
56
  //external integrations
@@ -99,7 +101,6 @@ class DeviceAta extends EventEmitter {
99
101
 
100
102
  //accessory
101
103
  this.accessory = {};
102
- this.useFahrenheit = useFahrenheit ? 1 : 0;
103
104
  };
104
105
 
105
106
  async externalIntegrations() {
@@ -260,7 +261,7 @@ class DeviceAta extends EventEmitter {
260
261
  deviceData.Device[key].Enabled = value;
261
262
  flag = 'overheatprotection';
262
263
  break;
263
- case 'ScheduleEnabled':
264
+ case 'Schedules':
264
265
  if (this.accountType === 'melcloud') return;
265
266
 
266
267
  deviceData.Device[key].Enabled = value;
@@ -524,10 +525,10 @@ class DeviceAta extends EventEmitter {
524
525
  if (this.account.type === 'melcloudhome') return;
525
526
 
526
527
  try {
527
- value = [false, true][value];
528
- this.accessory.useFahrenheit = value;
528
+ this.accessory.useFahrenheit = value ? true : false;
529
529
  if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
530
- this.emit('melCloud', 'UseFahrenheit', value);
530
+ this.accountInfo.UseFahrenheit = value ? true : false;
531
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'account', this.accountInfo);
531
532
  } catch (error) {
532
533
  if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
533
534
  };
@@ -619,10 +620,10 @@ class DeviceAta extends EventEmitter {
619
620
  if (this.account.type === 'melcloudhome') return;
620
621
 
621
622
  try {
622
- value = value ? true : false;
623
- this.accessory.useFahrenheit = value;
623
+ this.accessory.useFahrenheit = value ? true : false;
624
624
  if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
625
- this.emit('melCloud', 'UseFahrenheit', value);
625
+ this.accountInfo.UseFahrenheit = value ? true : false;
626
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'account', this.accountInfo);
626
627
  } catch (error) {
627
628
  if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
628
629
  };
@@ -725,7 +726,7 @@ class DeviceAta extends EventEmitter {
725
726
  .onSet(async (state) => {
726
727
  try {
727
728
  deviceData.FrostProtection.Enabled = state;
728
- if (this.logInfo) this.emit('info', `Frost protection: ${state ? 'Enable' : 'Disable'}`);
729
+ if (this.logInfo) this.emit('info', `Frost protection: ${state ? 'Enabled' : 'Disabled'}`);
729
730
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'frostprotection');
730
731
  } catch (error) {
731
732
  if (this.logWarn) this.emit('warn', `Set frost protection error: ${error}`);
@@ -772,7 +773,7 @@ class DeviceAta extends EventEmitter {
772
773
  .onSet(async (state) => {
773
774
  try {
774
775
  deviceData.OverheatProtection.Enabled = state;
775
- if (this.logInfo) this.emit('info', `Overheat protection: ${state ? 'Enable' : 'Disable'}`);
776
+ if (this.logInfo) this.emit('info', `Overheat protection: ${state ? 'Enabled' : 'Disabled'}`);
776
777
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'overheatprotection');
777
778
  } catch (error) {
778
779
  if (this.logWarn) this.emit('warn', `Set overheat protection error: ${error}`);
@@ -818,7 +819,7 @@ class DeviceAta extends EventEmitter {
818
819
  .onSet(async (state) => {
819
820
  try {
820
821
  deviceData.HolidayMode.Enabled = state;
821
- if (this.logInfo) this.emit('info', `Holiday mode: ${state ? 'Enable' : 'Disable'}`);
822
+ if (this.logInfo) this.emit('info', `Holiday mode: ${state ? 'Enabled' : 'Disabled'}`);
822
823
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'holidaymode');
823
824
  } catch (error) {
824
825
  if (this.logWarn) this.emit('warn', `Set holiday mode error: ${error}`);
@@ -900,7 +901,7 @@ class DeviceAta extends EventEmitter {
900
901
  break;
901
902
  };
902
903
 
903
- if (this.logInfo) this.emit('info', `Preset ${name}: ${state ? 'Set:' : 'Unset:'}`);
904
+ if (this.logInfo) this.emit('info', `Preset: ${name}: ${state ? 'Set' : 'Unset'}`);
904
905
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Presets);
905
906
  } catch (error) {
906
907
  if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
@@ -957,7 +958,7 @@ class DeviceAta extends EventEmitter {
957
958
  .onSet(async (state) => {
958
959
  try {
959
960
  deviceData.ScheduleEnabled = state;
960
- if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enable' : 'Disable'}`);
961
+ if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enabled' : 'Disabled'}`);
961
962
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'schedule');
962
963
  } catch (error) {
963
964
  if (this.logWarn) this.emit('warn', `Set schedules error: ${error}`);
@@ -1026,7 +1027,7 @@ class DeviceAta extends EventEmitter {
1026
1027
  .onSet(async (state) => {
1027
1028
  try {
1028
1029
  sceneData.Enabled = state;
1029
- if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Enable' : 'Disable'}`);
1030
+ if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Set' : 'Unset'}`);
1030
1031
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'scene', sceneData);
1031
1032
  } catch (error) {
1032
1033
  if (this.logWarn) this.emit('warn', `Set scene error: ${error}`);
@@ -1287,7 +1288,7 @@ class DeviceAta extends EventEmitter {
1287
1288
  break;
1288
1289
  };
1289
1290
 
1290
- if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
1291
+ if (this.logInfo) this.emit('info', `Button ${name}: ${state ? `Enabled` : `Disabled`}`);
1291
1292
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, flag);
1292
1293
  } catch (error) {
1293
1294
  if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
@@ -1322,7 +1323,7 @@ class DeviceAta extends EventEmitter {
1322
1323
  async start() {
1323
1324
  try {
1324
1325
  //melcloud device
1325
- this.melCloudAta = new MelCloudAta(this.account, this.device, this.devicesFile, this.defaultTempsFile)
1326
+ this.melCloudAta = new MelCloudAta(this.account, this.device, this.devicesFile, this.defaultTempsFile, this.accountFile)
1326
1327
  .on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
1327
1328
  if (this.logDeviceInfo && this.displayDeviceInfo) {
1328
1329
  this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
@@ -1462,8 +1463,8 @@ class DeviceAta extends EventEmitter {
1462
1463
  currentSwingMode: supportsSwingFunction && vaneHorizontalDirection === 12 && vaneVerticalDirection === 7 ? 1 : 0,
1463
1464
  lockPhysicalControl: prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0,
1464
1465
  temperatureStep: temperatureStep,
1465
- useFahrenheit: this.useFahrenheit,
1466
- temperatureUnit: TemperatureDisplayUnits[this.useFahrenheit],
1466
+ useFahrenheit: this.accountInfo.useFahrenheit ? 1 : 0,
1467
+ temperatureUnit: TemperatureDisplayUnits[this.accountInfo.useFahrenheit ? 1 : 0],
1467
1468
  isConnected: isConnected,
1468
1469
  isInError: isInError,
1469
1470
  frostProtectionEnabled: frostProtectionEnabled,
package/src/deviceatw.js CHANGED
@@ -6,7 +6,7 @@ import { TemperatureDisplayUnits, HeatPump } from './constants.js';
6
6
  let Accessory, Characteristic, Service, Categories, AccessoryUUID;
7
7
 
8
8
  class DeviceAtw extends EventEmitter {
9
- constructor(api, account, device, devicesFile, defaultTempsFile, useFahrenheit) {
9
+ constructor(api, account, device, devicesFile, defaultTempsFile, accountInfo, accountFile) {
10
10
  super();
11
11
 
12
12
  Accessory = api.platformAccessory;
@@ -50,6 +50,8 @@ class DeviceAtw extends EventEmitter {
50
50
  this.deviceTypeText = device.typeString;
51
51
  this.devicesFile = devicesFile;
52
52
  this.defaultTempsFile = defaultTempsFile;
53
+ this.accountInfo = accountInfo;
54
+ this.accountFile = accountFile;
53
55
  this.displayDeviceInfo = true;
54
56
 
55
57
  //external integrations
@@ -100,7 +102,6 @@ class DeviceAtw extends EventEmitter {
100
102
 
101
103
  //accessory
102
104
  this.accessory = {};
103
- this.useFahrenheit = useFahrenheit ? 1 : 0;
104
105
  };
105
106
 
106
107
  async externalIntegrations() {
@@ -649,10 +650,10 @@ class DeviceAtw extends EventEmitter {
649
650
  if (this.account.type === 'melcloudhome') return;
650
651
 
651
652
  try {
652
- value = [false, true][value];
653
- this.accessory.useFahrenheit = value;
653
+ this.accessory.useFahrenheit = value ? true : false;
654
654
  if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
655
- this.emit('melCloud', 'UseFahrenheit', value);
655
+ this.accountInfo.UseFahrenheit = value ? true : false;
656
+ await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'account', this.accountInfo);
656
657
  } catch (error) {
657
658
  if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
658
659
  };
@@ -835,10 +836,10 @@ class DeviceAtw extends EventEmitter {
835
836
  if (this.account.type === 'melcloudhome') return;
836
837
 
837
838
  try {
838
- value = value ? true : false;
839
- this.accessory.useFahrenheit = value;
839
+ this.accessory.useFahrenheit = value ? true : false;
840
840
  if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
841
- this.emit('melCloud', 'UseFahrenheit', value);
841
+ this.accountInfo.UseFahrenheit = value ? true : false;
842
+ await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'account', this.accountInfo);
842
843
  } catch (error) {
843
844
  if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
844
845
  };
@@ -1137,7 +1138,7 @@ class DeviceAtw extends EventEmitter {
1137
1138
  .onSet(async (state) => {
1138
1139
  try {
1139
1140
  deviceData.HolidayMode.Enabled = state;
1140
- if (this.logInfo) this.emit('info', `Holiday mode: ${state ? 'Enable' : 'Disable'}`);
1141
+ if (this.logInfo) this.emit('info', `Holiday mode: ${state ? 'Enabled' : 'Disabled'}`);
1141
1142
  await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'holidaymode');
1142
1143
  } catch (error) {
1143
1144
  if (this.logWarn) this.emit('warn', `Set holiday mode error: ${error}`);
@@ -1219,7 +1220,7 @@ class DeviceAtw extends EventEmitter {
1219
1220
  break;
1220
1221
  };
1221
1222
 
1222
- if (this.logInfo) this.emit('info', `Preset ${name}: ${state ? 'Set:' : 'Unset:'}`);
1223
+ if (this.logInfo) this.emit('info', `Preset ${name}: ${state ? 'Set' : 'Unset'}`);
1223
1224
  await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Presets);
1224
1225
  } catch (error) {
1225
1226
  if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
@@ -1276,7 +1277,7 @@ class DeviceAtw extends EventEmitter {
1276
1277
  .onSet(async (state) => {
1277
1278
  try {
1278
1279
  deviceData.ScheduleEnabled = state;
1279
- if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enable' : 'Disable'}`);
1280
+ if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enabled' : 'Disabled'}`);
1280
1281
  await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'schedule');
1281
1282
  } catch (error) {
1282
1283
  if (this.logWarn) this.emit('warn', `Set schedules error: ${error}`);
@@ -1345,7 +1346,7 @@ class DeviceAtw extends EventEmitter {
1345
1346
  .onSet(async (state) => {
1346
1347
  try {
1347
1348
  sceneData.Enabled = state;
1348
- if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Enable' : 'Disable'}`);
1349
+ if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Set' : 'Unset'}`);
1349
1350
  await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'scene', sceneData);
1350
1351
  } catch (error) {
1351
1352
  if (this.logWarn) this.emit('warn', `Set scene error: ${error}`);
@@ -1378,9 +1379,6 @@ class DeviceAtw extends EventEmitter {
1378
1379
  //get button mode
1379
1380
  const mode = button.mode;
1380
1381
 
1381
- //get button display type
1382
- const displayType = button.displayType;
1383
-
1384
1382
  //get button name
1385
1383
  const name = button.name;
1386
1384
 
@@ -1394,10 +1392,10 @@ class DeviceAtw extends EventEmitter {
1394
1392
  //control
1395
1393
  if (button.displayType > 3) {
1396
1394
  if (this.logDebug) this.emit('debug', `Prepare button control ${name} service`);
1397
- const buttonControlService = new serviceType(serviceName, `buttonControlService${deviceId} ${i}`);
1395
+ const buttonControlService = new serviceType(serviceName1, `buttonControlService${deviceId} ${i}`);
1398
1396
  buttonControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1399
1397
  buttonControlService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
1400
- buttonControlService.getCharacteristic(characteristicType)
1398
+ buttonControlService.getCharacteristic(Characteristic.On)
1401
1399
  .onGet(async () => {
1402
1400
  const state = button.state;
1403
1401
  return state;
@@ -1539,7 +1537,7 @@ class DeviceAtw extends EventEmitter {
1539
1537
  break;
1540
1538
  };
1541
1539
 
1542
- if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
1540
+ if (this.logInfo) this.emit('info', `Button ${name}: ${state ? `Enabled` : `Disabled`}`);
1543
1541
  await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
1544
1542
  } catch (error) {
1545
1543
  if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
@@ -1552,9 +1550,9 @@ class DeviceAtw extends EventEmitter {
1552
1550
 
1553
1551
  //sensor
1554
1552
  if (this.logDebug) this.emit('debug', `Prepare button control sensor ${name} service`);
1555
- const buttonControlSensorService = new serviceType(serviceName, `buttonControlSensorService${deviceId} ${i}`);
1553
+ const buttonControlSensorService = new serviceType(serviceName1, `buttonControlSensorService${deviceId} ${i}`);
1556
1554
  buttonControlSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1557
- buttonControlSensorService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
1555
+ buttonControlSensorService.setCharacteristic(Characteristic.ConfiguredName, serviceName1);
1558
1556
  buttonControlSensorService.getCharacteristic(characteristicType)
1559
1557
  .onGet(async () => {
1560
1558
  const state = button.state;
@@ -1575,7 +1573,7 @@ class DeviceAtw extends EventEmitter {
1575
1573
  async start() {
1576
1574
  try {
1577
1575
  //melcloud device
1578
- this.melCloudAtw = new MelCloudAtw(this.account, this.device, this.devicesFile, this.defaultTempsFile)
1576
+ this.melCloudAtw = new MelCloudAtw(this.account, this.device, this.devicesFile, this.defaultTempsFile, this.accountFile)
1579
1577
  .on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion, supportsHotWaterTank, supportsZone2) => {
1580
1578
  if (this.logDeviceInfo && this.displayDeviceInfo) {
1581
1579
  this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
@@ -1723,8 +1721,8 @@ class DeviceAtw extends EventEmitter {
1723
1721
  caseHotWaterSensor: caseHotWaterSensor,
1724
1722
  caseZone2Sensor: caseZone2Sensor,
1725
1723
  sensorsCount: zonesSensorsCount,
1726
- useFahrenheit: this.useFahrenheit,
1727
- temperatureUnit: TemperatureDisplayUnits[this.useFahrenheit],
1724
+ useFahrenheit: this.accountInfo.useFahrenheit ? 1 : 0,
1725
+ temperatureUnit: TemperatureDisplayUnits[this.accountInfo.useFahrenheit ? 1 : 0],
1728
1726
  isConnected: isConnected,
1729
1727
  isInError: isInError,
1730
1728
  scheduleEnabled: scheduleEnabled,