homebridge-melcloud-control 4.2.5-beta.9 → 4.2.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/CHANGELOG.md +12 -0
- package/README.md +19 -18
- package/config.schema.json +11 -11
- package/index.js +6 -15
- package/package.json +2 -2
- package/src/constants.js +1 -0
- package/src/deviceata.js +33 -30
- package/src/deviceatw.js +31 -28
- package/src/deviceerv.js +31 -28
- package/src/melcloud.js +3 -14
- package/src/melcloudata.js +70 -52
- package/src/melcloudatw.js +65 -45
- package/src/melclouderv.js +77 -57
- package/src/melcloudhome.js +16 -34
package/CHANGELOG.md
CHANGED
|
@@ -22,6 +22,18 @@ 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] - (17.11.2025)
|
|
26
|
+
|
|
27
|
+
## Changes
|
|
28
|
+
|
|
29
|
+
- fix device control stop working after some time
|
|
30
|
+
- fix device state not refresh
|
|
31
|
+
- updated presets, schedules and scenes characteristics
|
|
32
|
+
- stability and performance improvements
|
|
33
|
+
- config schema updated
|
|
34
|
+
- readme updated
|
|
35
|
+
- cleanup
|
|
36
|
+
|
|
25
37
|
## [4.2.3] - (15.11.2025)
|
|
26
38
|
|
|
27
39
|
## 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
|
|
35
|
-
* Support direct `Schedules
|
|
36
|
-
* Support direct `
|
|
37
|
-
* Support direct `
|
|
38
|
-
* Support direct `
|
|
39
|
-
* Support direct `
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
185
|
+
* Shedules control.
|
|
185
186
|
* Shedule active.
|
|
186
187
|
* Scene control.
|
|
187
188
|
* Error.
|
|
@@ -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` | `
|
|
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` | `
|
|
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` | `
|
|
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` | `
|
|
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` | `
|
|
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` | `
|
|
493
|
+
| | `Set` | `Schedules` | `true`, `false` | boolean | Schedules. |
|
package/config.schema.json
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"user": {
|
|
25
25
|
"title": "User",
|
|
26
26
|
"type": "string",
|
|
27
|
-
"placeholder": "
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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": "
|
|
2343
|
+
"title": "Success",
|
|
2344
2344
|
"type": "boolean",
|
|
2345
2345
|
"default": true
|
|
2346
2346
|
},
|
|
2347
2347
|
"info": {
|
|
2348
|
-
"title": "
|
|
2348
|
+
"title": "Info",
|
|
2349
2349
|
"type": "boolean",
|
|
2350
2350
|
"default": false
|
|
2351
2351
|
},
|
|
2352
2352
|
"warn": {
|
|
2353
|
-
"title": "
|
|
2353
|
+
"title": "Warn",
|
|
2354
2354
|
"type": "boolean",
|
|
2355
2355
|
"default": true
|
|
2356
2356
|
},
|
|
2357
2357
|
"error": {
|
|
2358
|
-
"title": "
|
|
2358
|
+
"title": "Error",
|
|
2359
2359
|
"type": "boolean",
|
|
2360
2360
|
"default": true
|
|
2361
2361
|
},
|
|
2362
2362
|
"debug": {
|
|
2363
|
-
"title": "
|
|
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,
|
|
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,
|
|
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,
|
|
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('
|
|
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
|
|
4
|
+
"version": "4.2.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",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"LICENSE"
|
|
32
32
|
],
|
|
33
33
|
"engines": {
|
|
34
|
-
"homebridge": "^1.
|
|
34
|
+
"homebridge": "^1.8.0 || ^2.0.0 || ^2.0.0-beta.40 || ^2.0.0-alpha.60",
|
|
35
35
|
"node": "^20 || ^22 || ^24 || ^25"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
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,
|
|
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 '
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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 ? '
|
|
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 ? '
|
|
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 ? '
|
|
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}`);
|
|
@@ -858,16 +859,17 @@ class DeviceAta extends EventEmitter {
|
|
|
858
859
|
this.presets.forEach((preset, i) => {
|
|
859
860
|
const presetData = presetsOnServer.find(p => p.ID === preset.id);
|
|
860
861
|
|
|
861
|
-
//get
|
|
862
|
+
//get name
|
|
862
863
|
const name = preset.name;
|
|
863
864
|
|
|
864
|
-
//get
|
|
865
|
+
//get name prefix
|
|
865
866
|
const namePrefix = preset.namePrefix;
|
|
866
867
|
|
|
867
868
|
const serviceName1 = namePrefix ? `${accessoryName} ${name}` : name;
|
|
868
869
|
const serviceType = preset.serviceType;
|
|
869
870
|
const characteristicType = preset.characteristicType;
|
|
870
871
|
|
|
872
|
+
//control
|
|
871
873
|
if (preset.displayType > 3) {
|
|
872
874
|
if (this.logDebug) this.emit('debug', `Prepare preset control ${name} service`);
|
|
873
875
|
const presetControlService = new Service.Switch(serviceName1, `presetControlService${deviceId} ${i}`);
|
|
@@ -900,7 +902,7 @@ class DeviceAta extends EventEmitter {
|
|
|
900
902
|
break;
|
|
901
903
|
};
|
|
902
904
|
|
|
903
|
-
if (this.logInfo) this.emit('info', `Preset ${name}: ${state ? 'Set
|
|
905
|
+
if (this.logInfo) this.emit('info', `Preset: ${name}: ${state ? 'Set' : 'Unset'}`);
|
|
904
906
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Presets);
|
|
905
907
|
} catch (error) {
|
|
906
908
|
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
@@ -930,13 +932,14 @@ class DeviceAta extends EventEmitter {
|
|
|
930
932
|
if (this.logDebug) this.emit('debug', `Prepare schedules services`);
|
|
931
933
|
this.scheduleSensorServices = [];
|
|
932
934
|
this.schedules.forEach((schedule, i) => {
|
|
933
|
-
|
|
935
|
+
const scheduleData = schedulesOnServer.find(s => s.Id === schedule.id);
|
|
936
|
+
|
|
937
|
+
//get name
|
|
934
938
|
const name = schedule.name;
|
|
935
939
|
|
|
936
|
-
//get
|
|
940
|
+
//get name prefix
|
|
937
941
|
const namePrefix = schedule.namePrefix;
|
|
938
942
|
|
|
939
|
-
//control sensor
|
|
940
943
|
const serviceName1 = namePrefix ? `${accessoryName} ${name}` : name;
|
|
941
944
|
const serviceName2 = namePrefix ? `${accessoryName} Schedules` : 'Schedules';
|
|
942
945
|
const serviceType = schedule.serviceType;
|
|
@@ -957,8 +960,8 @@ class DeviceAta extends EventEmitter {
|
|
|
957
960
|
.onSet(async (state) => {
|
|
958
961
|
try {
|
|
959
962
|
deviceData.ScheduleEnabled = state;
|
|
960
|
-
if (this.logInfo) this.emit('info', `Schedules: ${state ? '
|
|
961
|
-
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'schedule');
|
|
963
|
+
if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enabled' : 'Disabled'}`);
|
|
964
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'schedule', scheduleData);
|
|
962
965
|
} catch (error) {
|
|
963
966
|
if (this.logWarn) this.emit('warn', `Set schedules error: ${error}`);
|
|
964
967
|
};
|
|
@@ -1026,7 +1029,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1026
1029
|
.onSet(async (state) => {
|
|
1027
1030
|
try {
|
|
1028
1031
|
sceneData.Enabled = state;
|
|
1029
|
-
if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? '
|
|
1032
|
+
if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Set' : 'Unset'}`);
|
|
1030
1033
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'scene', sceneData);
|
|
1031
1034
|
} catch (error) {
|
|
1032
1035
|
if (this.logWarn) this.emit('warn', `Set scene error: ${error}`);
|
|
@@ -1057,13 +1060,13 @@ class DeviceAta extends EventEmitter {
|
|
|
1057
1060
|
this.buttonControlServices = [];
|
|
1058
1061
|
this.buttonControlSensorServices = [];
|
|
1059
1062
|
this.buttons.forEach((button, i) => {
|
|
1060
|
-
//get
|
|
1063
|
+
//get mode
|
|
1061
1064
|
const mode = button.mode;
|
|
1062
1065
|
|
|
1063
|
-
//get
|
|
1066
|
+
//get name
|
|
1064
1067
|
const name = button.name;
|
|
1065
1068
|
|
|
1066
|
-
//get
|
|
1069
|
+
//get name prefix
|
|
1067
1070
|
const namePrefix = button.namePrefix;
|
|
1068
1071
|
|
|
1069
1072
|
const serviceName = namePrefix ? `${accessoryName} ${name}` : name;
|
|
@@ -1287,7 +1290,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1287
1290
|
break;
|
|
1288
1291
|
};
|
|
1289
1292
|
|
|
1290
|
-
if (this.logInfo) this.emit('info',
|
|
1293
|
+
if (this.logInfo) this.emit('info', `Button ${name}: ${state ? `Enabled` : `Disabled`}`);
|
|
1291
1294
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, flag);
|
|
1292
1295
|
} catch (error) {
|
|
1293
1296
|
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
@@ -1322,7 +1325,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1322
1325
|
async start() {
|
|
1323
1326
|
try {
|
|
1324
1327
|
//melcloud device
|
|
1325
|
-
this.melCloudAta = new MelCloudAta(this.account, this.device, this.devicesFile, this.defaultTempsFile)
|
|
1328
|
+
this.melCloudAta = new MelCloudAta(this.account, this.device, this.devicesFile, this.defaultTempsFile, this.accountFile)
|
|
1326
1329
|
.on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
|
|
1327
1330
|
if (this.logDeviceInfo && this.displayDeviceInfo) {
|
|
1328
1331
|
this.emit('devInfo', `---- ${this.deviceTypeText}: ${this.deviceName} ----`);
|
|
@@ -1462,8 +1465,8 @@ class DeviceAta extends EventEmitter {
|
|
|
1462
1465
|
currentSwingMode: supportsSwingFunction && vaneHorizontalDirection === 12 && vaneVerticalDirection === 7 ? 1 : 0,
|
|
1463
1466
|
lockPhysicalControl: prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0,
|
|
1464
1467
|
temperatureStep: temperatureStep,
|
|
1465
|
-
useFahrenheit: this.useFahrenheit,
|
|
1466
|
-
temperatureUnit: TemperatureDisplayUnits[this.useFahrenheit],
|
|
1468
|
+
useFahrenheit: this.accountInfo.useFahrenheit ? 1 : 0,
|
|
1469
|
+
temperatureUnit: TemperatureDisplayUnits[this.accountInfo.useFahrenheit ? 1 : 0],
|
|
1467
1470
|
isConnected: isConnected,
|
|
1468
1471
|
isInError: isInError,
|
|
1469
1472
|
frostProtectionEnabled: frostProtectionEnabled,
|
|
@@ -1677,7 +1680,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1677
1680
|
this.schedules.forEach((schedule, i) => {
|
|
1678
1681
|
const scheduleData = schedulesOnServer.find(s => s.Id === schedule.id);
|
|
1679
1682
|
const characteristicType = schedule.characteristicType;
|
|
1680
|
-
schedule.state = scheduleEnabled ? scheduleData.Enabled ?? false : false;
|
|
1683
|
+
schedule.state = scheduleEnabled ? (scheduleData.Enabled ?? false) : false;
|
|
1681
1684
|
|
|
1682
1685
|
//control
|
|
1683
1686
|
if (i === 0) {
|
|
@@ -1696,7 +1699,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1696
1699
|
if (this.scenes.length > 0) {
|
|
1697
1700
|
this.scenes.forEach((scene, i) => {
|
|
1698
1701
|
const sceneData = scenesOnServer.find(s => s.Id === scene.id);
|
|
1699
|
-
scene.state = sceneData.Enabled;
|
|
1702
|
+
scene.state = sceneData.Enabled ?? false;
|
|
1700
1703
|
|
|
1701
1704
|
//control
|
|
1702
1705
|
if (scene.displayType > 3) {
|