homebridge-melcloud-control 4.4.1-beta.0 → 4.4.1-beta.10
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/README.md +29 -29
- package/config.schema.json +64 -64
- package/index.js +33 -41
- package/package.json +2 -2
- package/src/constants.js +62 -50
- package/src/deviceata.js +2 -6
- package/src/deviceatw.js +2 -6
- package/src/deviceerv.js +25 -30
- package/src/functions.js +120 -94
- package/src/melcloud.js +4 -4
- package/src/melcloudata.js +15 -11
- package/src/melcloudatw.js +14 -10
- package/src/melclouderv.js +20 -8
- package/src/melcloudhome.js +39 -22
package/index.js
CHANGED
|
@@ -31,20 +31,12 @@ class MelCloudPlatform {
|
|
|
31
31
|
api.on('didFinishLaunching', async () => {
|
|
32
32
|
//loop through accounts
|
|
33
33
|
for (const account of config.accounts) {
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
const accountName = account.name;
|
|
38
|
-
const user = account.user;
|
|
39
|
-
const passwd = account.passwd;
|
|
40
|
-
const language = account.language;
|
|
41
|
-
|
|
42
|
-
//check mandatory properties
|
|
43
|
-
if (!accountName || accountsName.includes(accountName) || !user || !passwd || !language) {
|
|
44
|
-
log.warn(`Account name: ${accountName ? accountsName.includes(accountName) ? 'Duplicated' : 'OK' : accountName}, user: ${user ? 'OK' : user}, password: ${passwd ? 'OK' : passwd}, language: ${language ? 'OK' : language} in config missing.`);
|
|
34
|
+
const { name, user, passwd, language, type } = account;
|
|
35
|
+
if (!name || accountsName.includes(name) || !user || !passwd || !language || !type) {
|
|
36
|
+
log.warn(`Account ${!name ? 'name missing' : (accountsName.includes(name) ? 'name duplicated' : name)} ${!user ? ', user missing' : ''}${!passwd ? ', password missing' : ''}${!language ? ', language missing' : ''}${!type ? ', type disabled' : ''} in config, will not be published in the Home app`);
|
|
45
37
|
continue;
|
|
46
38
|
}
|
|
47
|
-
accountsName.push(
|
|
39
|
+
accountsName.push(name);
|
|
48
40
|
const accountRefreshInterval = (account.refreshInterval ?? 120) * 1000
|
|
49
41
|
|
|
50
42
|
//log config
|
|
@@ -58,7 +50,7 @@ class MelCloudPlatform {
|
|
|
58
50
|
};
|
|
59
51
|
|
|
60
52
|
if (logLevel.debug) {
|
|
61
|
-
log.info(`${
|
|
53
|
+
log.info(`${name}, debug: did finish launching.`);
|
|
62
54
|
const safeConfig = {
|
|
63
55
|
...account,
|
|
64
56
|
passwd: 'removed',
|
|
@@ -69,12 +61,12 @@ class MelCloudPlatform {
|
|
|
69
61
|
}
|
|
70
62
|
},
|
|
71
63
|
};
|
|
72
|
-
log.info(`${
|
|
64
|
+
log.info(`${name}, Config: ${JSON.stringify(safeConfig, null, 2)}`);
|
|
73
65
|
}
|
|
74
66
|
|
|
75
67
|
//define directory and file paths
|
|
76
|
-
const accountFile = `${prefDir}/${
|
|
77
|
-
const buildingsFile = `${prefDir}/${
|
|
68
|
+
const accountFile = `${prefDir}/${name}_Account`;
|
|
69
|
+
const buildingsFile = `${prefDir}/${name}_Buildings`;
|
|
78
70
|
|
|
79
71
|
try {
|
|
80
72
|
//create impulse generator
|
|
@@ -97,24 +89,24 @@ class MelCloudPlatform {
|
|
|
97
89
|
if (logLevel.warn) log.warn(`Unknown account type: ${account.type}.`);
|
|
98
90
|
return;
|
|
99
91
|
}
|
|
100
|
-
melcloud.on('success', (msg) => log.success(`${
|
|
101
|
-
.on('info', (msg) => log.info(`${
|
|
102
|
-
.on('debug', (msg) => log.info(`${
|
|
103
|
-
.on('warn', (msg) => log.warn(`${
|
|
104
|
-
.on('error', (msg) => log.error(`${
|
|
92
|
+
melcloud.on('success', (msg) => log.success(`${name}, ${msg}`))
|
|
93
|
+
.on('info', (msg) => log.info(`${name}, ${msg}`))
|
|
94
|
+
.on('debug', (msg) => log.info(`${name}, debug: ${msg}`))
|
|
95
|
+
.on('warn', (msg) => log.warn(`${name}, ${msg}`))
|
|
96
|
+
.on('error', (msg) => log.error(`${name}, ${msg}`));
|
|
105
97
|
|
|
106
98
|
//connect
|
|
107
99
|
const accountInfo = await melcloud.connect();
|
|
108
100
|
if (!accountInfo?.State) {
|
|
109
|
-
if (logLevel.warn) log.warn(`${
|
|
101
|
+
if (logLevel.warn) log.warn(`${name}, ${accountInfo?.Info}`);
|
|
110
102
|
return;
|
|
111
103
|
}
|
|
112
|
-
if (logLevel.success) log.success(`${
|
|
104
|
+
if (logLevel.success) log.success(`${name}, ${accountInfo.Info}`);
|
|
113
105
|
|
|
114
106
|
//check devices list
|
|
115
107
|
const melcloudDevicesList = await melcloud.checkDevicesList();
|
|
116
108
|
if (!melcloudDevicesList.State) {
|
|
117
|
-
if (logLevel.warn) log.warn(`${
|
|
109
|
+
if (logLevel.warn) log.warn(`${name}, ${melcloudDevicesList.Info}`);
|
|
118
110
|
return;
|
|
119
111
|
}
|
|
120
112
|
if (logLevel.debug) log.info(melcloudDevicesList.Info);
|
|
@@ -128,33 +120,33 @@ class MelCloudPlatform {
|
|
|
128
120
|
const atwDevices = (account.atwDevices || []).filter(device => device.id != null && String(device.id) !== '0');
|
|
129
121
|
const ervDevices = (account.ervDevices || []).filter(device => device.id != null && String(device.id) !== '0');
|
|
130
122
|
const devices = [...ataDevices, ...atwDevices, ...ervDevices];
|
|
131
|
-
if (logLevel.debug) log.info(`${
|
|
123
|
+
if (logLevel.debug) log.info(`${name}, found configured devices ATA: ${ataDevices.length}, ATW: ${atwDevices.length}, ERV: ${ervDevices.length}.`);
|
|
132
124
|
|
|
133
125
|
for (const [index, device] of devices.entries()) {
|
|
134
126
|
device.id = String(device.id);
|
|
135
127
|
const deviceName = device.name;
|
|
136
128
|
const deviceType = device.type;
|
|
137
129
|
const deviceTypeString = device.typeString;
|
|
138
|
-
const defaultTempsFile = `${prefDir}/${
|
|
130
|
+
const defaultTempsFile = `${prefDir}/${name}_${device.id}_Temps`;
|
|
139
131
|
|
|
140
132
|
//chack device is not disabled in config
|
|
141
|
-
const displayType = device.displayType
|
|
133
|
+
const displayType = device.displayType;
|
|
142
134
|
if (!displayType) {
|
|
143
|
-
if (logLevel.warn) log.warn(`${
|
|
135
|
+
if (logLevel.warn) log.warn(`${name}, ${deviceTypeString}, ${deviceName}, disabled in configuration, will not be published in the Home app.`);
|
|
144
136
|
continue;
|
|
145
137
|
}
|
|
146
138
|
|
|
147
139
|
//chack device from config exist on melcloud
|
|
148
140
|
const deviceExistInMelCloud = melcloudDevicesList.Devices.some(dev => dev.DeviceID === device.id);
|
|
149
141
|
if (!deviceExistInMelCloud) {
|
|
150
|
-
if (logLevel.warn) log.warn(`${
|
|
142
|
+
if (logLevel.warn) log.warn(`${name}, ${deviceTypeString}, ${deviceName}, not exist on server, please login to MELCLoud from plugin UI to fix this issue.`);
|
|
151
143
|
continue;
|
|
152
144
|
}
|
|
153
145
|
|
|
154
146
|
// set rest ful port
|
|
155
147
|
account.restFul.port = (device.id).slice(-4).replace(/^0/, '9');
|
|
156
148
|
|
|
157
|
-
if (
|
|
149
|
+
if (type === 'melcloudhome') {
|
|
158
150
|
account.restFul.port = `${3000}${index}`;
|
|
159
151
|
|
|
160
152
|
try {
|
|
@@ -168,7 +160,7 @@ class MelCloudPlatform {
|
|
|
168
160
|
if (logLevel.debug) log.debug(`Default temperature file created: ${defaultTempsFile}`);
|
|
169
161
|
}
|
|
170
162
|
} catch (error) {
|
|
171
|
-
if (logLevel.error) log.error(`${
|
|
163
|
+
if (logLevel.error) log.error(`${name}, ${deviceTypeString}, ${deviceName}, File init error: ${error.message}`);
|
|
172
164
|
continue;
|
|
173
165
|
}
|
|
174
166
|
}
|
|
@@ -187,37 +179,37 @@ class MelCloudPlatform {
|
|
|
187
179
|
configuredDevice = new DeviceErv(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, melcloudDevicesList);
|
|
188
180
|
break;
|
|
189
181
|
default:
|
|
190
|
-
if (logLevel.warn) log.warn(`${
|
|
182
|
+
if (logLevel.warn) log.warn(`${name}, ${deviceTypeString}, ${deviceName}, unknown device: ${deviceType}.`);
|
|
191
183
|
return;
|
|
192
184
|
}
|
|
193
185
|
|
|
194
186
|
configuredDevice.on('devInfo', (info) => logLevel.devInfo && log.info(info))
|
|
195
|
-
.on('success', (msg) => log.success(`${
|
|
196
|
-
.on('info', (msg) => log.info(`${
|
|
197
|
-
.on('debug', (msg) => log.info(`${
|
|
198
|
-
.on('warn', (msg) => log.warn(`${
|
|
199
|
-
.on('error', (msg) => log.error(`${
|
|
187
|
+
.on('success', (msg) => log.success(`${name}, ${deviceTypeString}, ${deviceName}, ${msg}`))
|
|
188
|
+
.on('info', (msg) => log.info(`${name}, ${deviceTypeString}, ${deviceName}, ${msg}`))
|
|
189
|
+
.on('debug', (msg) => log.info(`${name}, ${deviceTypeString}, ${deviceName}, debug: ${msg}`))
|
|
190
|
+
.on('warn', (msg) => log.warn(`${name}, ${deviceTypeString}, ${deviceName}, ${msg}`))
|
|
191
|
+
.on('error', (msg) => log.error(`${name}, ${deviceTypeString}, ${deviceName}, ${msg}`));
|
|
200
192
|
|
|
201
193
|
const accessory = await configuredDevice.start();
|
|
202
194
|
if (accessory) {
|
|
203
195
|
api.publishExternalAccessories(PluginName, [accessory]);
|
|
204
|
-
if (logLevel.success) log.success(`${
|
|
196
|
+
if (logLevel.success) log.success(`${name}, ${deviceTypeString}, ${deviceName}, Published as external accessory.`);
|
|
205
197
|
}
|
|
206
198
|
}
|
|
207
199
|
|
|
208
200
|
//stop start impulse generator
|
|
209
201
|
await impulseGenerator.state(false);
|
|
210
202
|
} catch (error) {
|
|
211
|
-
if (logLevel.error) log.error(`${
|
|
203
|
+
if (logLevel.error) log.error(`${name}, Start impulse generator error, ${error.message ?? error}, trying again.`);
|
|
212
204
|
}
|
|
213
205
|
}).on('state', (state) => {
|
|
214
|
-
if (logLevel.debug) log.info(`${
|
|
206
|
+
if (logLevel.debug) log.info(`${name}, Start impulse generator ${state ? 'started' : 'stopped'}.`);
|
|
215
207
|
});
|
|
216
208
|
|
|
217
209
|
//start impulse generator
|
|
218
210
|
await impulseGenerator.state(true, [{ name: 'start', sampling: 120000 }]);
|
|
219
211
|
} catch (error) {
|
|
220
|
-
if (logLevel.error) log.error(`${
|
|
212
|
+
if (logLevel.error) log.error(`${name}, Did finish launching error: ${error.message ?? error}.`);
|
|
221
213
|
}
|
|
222
214
|
}
|
|
223
215
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.4.1-beta.
|
|
4
|
+
"version": "4.4.1-beta.10",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"mqtt": "^5.14.1",
|
|
40
40
|
"axios": "^1.13.2",
|
|
41
41
|
"express": "^5.2.1",
|
|
42
|
-
"puppeteer": "^24.
|
|
42
|
+
"puppeteer": "^24.33.0",
|
|
43
43
|
"ws": "^8.18.3"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
package/src/constants.js
CHANGED
|
@@ -2,60 +2,67 @@ export const PlatformName = "melcloudcontrol";
|
|
|
2
2
|
export const PluginName = "homebridge-melcloud-control";
|
|
3
3
|
|
|
4
4
|
export const ApiUrls = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
SetAtw: "/Device/SetAtw",
|
|
14
|
-
SetErv: "/Device/SetErv",
|
|
15
|
-
GetRefreshUnit: "/Device/RequestRefresh?id=deviceid",
|
|
16
|
-
UpdateApplicationOptions: "/User/UpdateApplicationOptions",
|
|
17
|
-
HolidayModeUpdate: "/HolidayMode/Update",
|
|
18
|
-
EnergyCostReport: "/EnergyCost/Report",
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const ApiUrlsHome = {
|
|
22
|
-
BaseURL: "https://melcloudhome.com",
|
|
23
|
-
GetConfiguration: "https://melcloudhome.com/api/configuration",
|
|
24
|
-
GetUserContext: "/api/user/context",
|
|
25
|
-
GetUserScenes: "/api/user/scenes",
|
|
26
|
-
PostSchedule: "/api/cloudschedule/deviceid", // POST {"days":[2],"time":"17:59:00","enabled":true,"id":"53c5e804-0663-47d0-85c2-2d8ccd2573de","power":false,"operationMode":null,"setPoint":null,"vaneVerticalDirection":null,"vaneHorizontalDirection":null,"setFanSpeed":null}
|
|
27
|
-
PostProtectionFrost: "/api/protection/frost", // POST {"enabled":true,"min":13,"max":16,"units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
|
|
28
|
-
PostProtectionOverheat: "/api/protection/overheat", // POST {"enabled":true,"min":32,"max":35,"units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
|
|
29
|
-
PostHolidayMode: " /api/holidaymode", // POST {"enabled":true,"startDate":"2025-11-11T17:42:24.913","endDate":"2026-06-01T09:18:00","units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
|
|
30
|
-
PutAta: "/api/ataunit/deviceid",
|
|
31
|
-
PutAtw: "/api/atwunit/deviceid",
|
|
32
|
-
PutErv: "/api/ervunit/deviceid",
|
|
33
|
-
PutScheduleEnabled: "/api/cloudschedule/deviceid/enabled", // PUT {"enabled":true}
|
|
34
|
-
PutScene: {
|
|
35
|
-
Enable: "/api/scene/sceneid/enable",
|
|
36
|
-
Disable: "/api/scene/sceneid/disable",
|
|
5
|
+
Base: "https://app.melcloud.com/Mitsubishi.Wifi.Client",
|
|
6
|
+
Get: {
|
|
7
|
+
UserDetails: "/User/GetUserDetails",
|
|
8
|
+
ListDevices: "/User/ListDevices",
|
|
9
|
+
ListDeviceUnits: "/Device/ListDeviceUnits",
|
|
10
|
+
RefreshUnit: "/Device/RequestRefresh?id=deviceid",
|
|
11
|
+
DeviceState: "/Device/Get?id=DID&buildingID=BID",
|
|
12
|
+
TileState: "/Tile/Get2?id=DID&buildingID=BID",
|
|
37
13
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
14
|
+
Post: {
|
|
15
|
+
ClientLogin: "/Login/ClientLogin",
|
|
16
|
+
Ata: "/Device/SetAta",
|
|
17
|
+
Atw: "/Device/SetAtw",
|
|
18
|
+
Erv: "/Device/SetErv",
|
|
19
|
+
UpdateApplicationOptions: "/User/UpdateApplicationOptions",
|
|
20
|
+
HolidayMode: "/HolidayMode/Update",
|
|
21
|
+
EnergyCostReport: "/EnergyCost/Report",
|
|
46
22
|
},
|
|
47
|
-
|
|
48
|
-
|
|
23
|
+
Home: {
|
|
24
|
+
Base: "https://melcloudhome.com",
|
|
25
|
+
WebSocket: "wss://ws.melcloudhome.com/?hash=",
|
|
26
|
+
Get: {
|
|
27
|
+
Configuration: "/api/configuration",
|
|
28
|
+
ListDevices: "/api/user/context",
|
|
29
|
+
Scenes: "/api/user/scenes",
|
|
30
|
+
},
|
|
31
|
+
Post: {
|
|
32
|
+
Schedule: "/api/cloudschedule/deviceid", // POST {"days":[2],"time":"17:59:00","enabled":true,"id":"53c5e804-0663-47d0-85c2-2d8ccd2573de","power":false,"operationMode":null,"setPoint":null,"vaneVerticalDirection":null,"vaneHorizontalDirection":null,"setFanSpeed":null}
|
|
33
|
+
ProtectionFrost: "/api/protection/frost", // POST {"enabled":true,"min":13,"max":16,"units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
|
|
34
|
+
ProtectionOverheat: "/api/protection/overheat", // POST {"enabled":true,"min":32,"max":35,"units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
|
|
35
|
+
HolidayMode: "/api/holidaymode", // POST {"enabled":true,"startDate":"2025-11-11T17:42:24.913","endDate":"2026-06-01T09:18:00","units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
|
|
36
|
+
Scene: "/api/scene", // POST {"id": "8e484d50-528b-434a-9acb-7d7c81f06a12", "userId": "2db32d6f-c19c-4b1f-a0dd-1915420a5152","name": "Poza domem","enabled": false,"icon": "AwayIcon","ataSceneSettings": [{"unitId": "054dd950-f6e0-4195-bea7-59d8ea0668c2","ataSettings": { "power": false, "operationMode": "heat","setFanSpeed": "auto","vaneHorizontalDirection": "auto", "vaneVerticalDirection": "auto", "setTemperature": 21,"temperatureIncrementOverride": null,"inStandbyMode": null},"previousSettings": null}],"atwSceneSettings": []}
|
|
37
|
+
},
|
|
38
|
+
Put: {
|
|
39
|
+
Ata: "/api/ataunit/deviceid",
|
|
40
|
+
Atw: "/api/atwunit/deviceid",
|
|
41
|
+
Erv: "/api/ervunit/deviceid",
|
|
42
|
+
ScheduleEnableDisable: "/api/cloudschedule/deviceid/enabled", // PUT {"enabled":true}
|
|
43
|
+
SceneEnableDisable: "/api/scene/sceneid/enabledisable",
|
|
44
|
+
},
|
|
45
|
+
Delete: {
|
|
46
|
+
Schedule: "/api/cloudschedule/deviceid/scheduleid",
|
|
47
|
+
Scene: "/api/scene/sceneid"
|
|
48
|
+
},
|
|
49
|
+
Referers: {
|
|
50
|
+
GetPutScenes: "https://melcloudhome.com/scenes",
|
|
51
|
+
PostHolidayMode: "https://melcloudhome.com/ata/deviceid/holidaymode",
|
|
52
|
+
PostProtectionFrost: "https://melcloudhome.com/ata/deviceid/frostprotection",
|
|
53
|
+
PostProtectionOverheat: "https://melcloudhome.com/ata/deviceid/overheatprotection",
|
|
54
|
+
PutDeviceSettings: "https://melcloudhome.com/dashboard",
|
|
55
|
+
PutScheduleEnabled: "https://melcloudhome.com/ata/deviceid/schedule",
|
|
56
|
+
}
|
|
57
|
+
}
|
|
49
58
|
};
|
|
50
59
|
|
|
51
|
-
export const DeviceType =
|
|
52
|
-
"Air Conditioner",
|
|
53
|
-
"Heat Pump",
|
|
54
|
-
"Unknown",
|
|
55
|
-
"Energy Recovery Ventilation"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
export const TemperatureDisplayUnits = ["°C", "°F"];
|
|
60
|
+
export const DeviceType = {
|
|
61
|
+
0: "Air Conditioner",
|
|
62
|
+
1: "Heat Pump",
|
|
63
|
+
2: "Unknown",
|
|
64
|
+
3: "Energy Recovery Ventilation"
|
|
65
|
+
};
|
|
59
66
|
|
|
60
67
|
export const AirConditioner = {
|
|
61
68
|
SystemMapEnumToString: { 0: "Air Conditioner Off", 1: "Air Conditioner On", 2: "Air Conditioner Offline" },
|
|
@@ -183,6 +190,11 @@ export const Ventilation = {
|
|
|
183
190
|
}
|
|
184
191
|
};
|
|
185
192
|
|
|
193
|
+
export const TemperatureDisplayUnits = {
|
|
194
|
+
0: "°C",
|
|
195
|
+
1: "°F"
|
|
196
|
+
};
|
|
197
|
+
|
|
186
198
|
export const AccessLevel = {
|
|
187
199
|
Quest: 3,
|
|
188
200
|
Owner: 4
|
package/src/deviceata.js
CHANGED
|
@@ -65,7 +65,6 @@ class DeviceAta extends EventEmitter {
|
|
|
65
65
|
|
|
66
66
|
//presets configured
|
|
67
67
|
for (const preset of this.presets) {
|
|
68
|
-
preset.name = preset.name;
|
|
69
68
|
preset.serviceType = serviceType[preset.displayType];
|
|
70
69
|
preset.characteristicType = characteristicType[preset.displayType];
|
|
71
70
|
preset.state = false;
|
|
@@ -74,7 +73,6 @@ class DeviceAta extends EventEmitter {
|
|
|
74
73
|
|
|
75
74
|
//schedules configured
|
|
76
75
|
for (const schedule of this.schedules) {
|
|
77
|
-
schedule.name = schedule.name;
|
|
78
76
|
schedule.serviceType = serviceType[schedule.displayType];
|
|
79
77
|
schedule.characteristicType = characteristicType[schedule.displayType];
|
|
80
78
|
schedule.state = false;
|
|
@@ -82,7 +80,6 @@ class DeviceAta extends EventEmitter {
|
|
|
82
80
|
|
|
83
81
|
//scenes configured
|
|
84
82
|
for (const scene of this.scenes) {
|
|
85
|
-
scene.name = scene.name;
|
|
86
83
|
scene.serviceType = serviceType[scene.displayType];
|
|
87
84
|
scene.characteristicType = characteristicType[scene.displayType];
|
|
88
85
|
scene.state = false;
|
|
@@ -90,7 +87,6 @@ class DeviceAta extends EventEmitter {
|
|
|
90
87
|
|
|
91
88
|
//buttons configured
|
|
92
89
|
for (const button of this.buttons) {
|
|
93
|
-
button.name = button.name;
|
|
94
90
|
button.serviceType = serviceType[button.displayType];
|
|
95
91
|
button.characteristicType = characteristicType[button.displayType];
|
|
96
92
|
button.state = false;
|
|
@@ -522,8 +518,8 @@ class DeviceAta extends EventEmitter {
|
|
|
522
518
|
|
|
523
519
|
try {
|
|
524
520
|
this.accessory.useFahrenheit = value ? true : false;
|
|
525
|
-
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
526
521
|
this.accountInfo.UseFahrenheit = value ? true : false;
|
|
522
|
+
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
527
523
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'account', this.accountInfo);
|
|
528
524
|
} catch (error) {
|
|
529
525
|
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
@@ -615,8 +611,8 @@ class DeviceAta extends EventEmitter {
|
|
|
615
611
|
|
|
616
612
|
try {
|
|
617
613
|
this.accessory.useFahrenheit = value ? true : false;
|
|
618
|
-
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
619
614
|
this.accountInfo.UseFahrenheit = value ? true : false;
|
|
615
|
+
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
620
616
|
await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'account', this.accountInfo);
|
|
621
617
|
} catch (error) {
|
|
622
618
|
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
package/src/deviceatw.js
CHANGED
|
@@ -69,7 +69,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
69
69
|
|
|
70
70
|
//presets configured
|
|
71
71
|
for (const preset of this.presets) {
|
|
72
|
-
preset.name = preset.name;
|
|
73
72
|
preset.serviceType = serviceType[preset.displayType];
|
|
74
73
|
preset.characteristicType = characteristicType[preset.displayType];
|
|
75
74
|
preset.state = false;
|
|
@@ -78,7 +77,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
78
77
|
|
|
79
78
|
//schedules configured
|
|
80
79
|
for (const schedule of this.schedules) {
|
|
81
|
-
schedule.name = schedule.name;
|
|
82
80
|
schedule.serviceType = serviceType[schedule.displayType];
|
|
83
81
|
schedule.characteristicType = characteristicType[schedule.displayType];
|
|
84
82
|
schedule.state = false;
|
|
@@ -86,7 +84,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
86
84
|
|
|
87
85
|
//scenes configured
|
|
88
86
|
for (const scene of this.scenes) {
|
|
89
|
-
scene.name = scene.name;
|
|
90
87
|
scene.serviceType = serviceType[scene.displayType];
|
|
91
88
|
scene.characteristicType = characteristicType[scene.displayType];
|
|
92
89
|
scene.state = false;
|
|
@@ -94,7 +91,6 @@ class DeviceAtw extends EventEmitter {
|
|
|
94
91
|
|
|
95
92
|
//buttons configured
|
|
96
93
|
for (const button of this.buttons) {
|
|
97
|
-
button.name = button.name;
|
|
98
94
|
button.serviceType = serviceType[button.displayType];
|
|
99
95
|
button.characteristicType = characteristicType[button.displayType];
|
|
100
96
|
button.state = false;
|
|
@@ -645,8 +641,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
645
641
|
|
|
646
642
|
try {
|
|
647
643
|
this.accessory.useFahrenheit = value ? true : false;
|
|
648
|
-
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
649
644
|
this.accountInfo.UseFahrenheit = value ? true : false;
|
|
645
|
+
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
650
646
|
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'account', this.accountInfo);
|
|
651
647
|
} catch (error) {
|
|
652
648
|
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
@@ -826,8 +822,8 @@ class DeviceAtw extends EventEmitter {
|
|
|
826
822
|
|
|
827
823
|
try {
|
|
828
824
|
this.accessory.useFahrenheit = value ? true : false;
|
|
829
|
-
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
830
825
|
this.accountInfo.UseFahrenheit = value ? true : false;
|
|
826
|
+
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
831
827
|
await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'account', this.accountInfo);
|
|
832
828
|
} catch (error) {
|
|
833
829
|
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
package/src/deviceerv.js
CHANGED
|
@@ -61,7 +61,6 @@ class DeviceErv extends EventEmitter {
|
|
|
61
61
|
|
|
62
62
|
//presets configured
|
|
63
63
|
for (const preset of this.presets) {
|
|
64
|
-
preset.name = preset.name;
|
|
65
64
|
preset.serviceType = serviceType[preset.displayType];
|
|
66
65
|
preset.characteristicType = characteristicType[preset.displayType];
|
|
67
66
|
preset.state = false;
|
|
@@ -70,7 +69,6 @@ class DeviceErv extends EventEmitter {
|
|
|
70
69
|
|
|
71
70
|
//schedules configured
|
|
72
71
|
for (const schedule of this.schedules) {
|
|
73
|
-
schedule.name = schedule.name;
|
|
74
72
|
schedule.serviceType = serviceType[schedule.displayType];
|
|
75
73
|
schedule.characteristicType = characteristicType[schedule.displayType];
|
|
76
74
|
schedule.state = false;
|
|
@@ -78,7 +76,6 @@ class DeviceErv extends EventEmitter {
|
|
|
78
76
|
|
|
79
77
|
//scenes configured
|
|
80
78
|
for (const scene of this.scenes) {
|
|
81
|
-
scene.name = scene.name;
|
|
82
79
|
scene.serviceType = serviceType[scene.displayType];
|
|
83
80
|
scene.characteristicType = characteristicType[scene.displayType];
|
|
84
81
|
scene.state = false;
|
|
@@ -86,7 +83,6 @@ class DeviceErv extends EventEmitter {
|
|
|
86
83
|
|
|
87
84
|
//buttons configured
|
|
88
85
|
for (const button of this.buttons) {
|
|
89
|
-
button.name = button.name;
|
|
90
86
|
button.serviceType = serviceType[button.displayType];
|
|
91
87
|
button.characteristicType = characteristicType[button.displayType];
|
|
92
88
|
button.state = false;
|
|
@@ -404,8 +400,8 @@ class DeviceErv extends EventEmitter {
|
|
|
404
400
|
if (supportsAutoVentilationMode && supportsCoolOperationMode) {
|
|
405
401
|
melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
|
|
406
402
|
.setProps({
|
|
407
|
-
minValue: this.accessory.
|
|
408
|
-
maxValue: this.accessory.
|
|
403
|
+
minValue: this.accessory.minTempCoolDryAuto,
|
|
404
|
+
maxValue: this.accessory.maxTempCoolDryAuto,
|
|
409
405
|
minStep: this.accessory.temperatureIncrement
|
|
410
406
|
})
|
|
411
407
|
.onGet(async () => {
|
|
@@ -454,8 +450,8 @@ class DeviceErv extends EventEmitter {
|
|
|
454
450
|
|
|
455
451
|
try {
|
|
456
452
|
this.accessory.useFahrenheit = value ? true : false;
|
|
457
|
-
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
458
453
|
this.accountInfo.UseFahrenheit = value ? true : false;
|
|
454
|
+
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
459
455
|
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, 'account', this.accountInfo);
|
|
460
456
|
} catch (error) {
|
|
461
457
|
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
@@ -548,8 +544,8 @@ class DeviceErv extends EventEmitter {
|
|
|
548
544
|
|
|
549
545
|
try {
|
|
550
546
|
this.accessory.useFahrenheit = value ? true : false;
|
|
551
|
-
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
552
547
|
this.accountInfo.UseFahrenheit = value ? true : false;
|
|
548
|
+
if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
|
|
553
549
|
await this.melCloudErv.send(this.accountType, this.displayType, deviceData, 'account', this.accountInfo);
|
|
554
550
|
} catch (error) {
|
|
555
551
|
if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
|
|
@@ -713,7 +709,7 @@ class DeviceErv extends EventEmitter {
|
|
|
713
709
|
}
|
|
714
710
|
|
|
715
711
|
//holiday mode
|
|
716
|
-
if (this.holidayModeSupport && this.accessory.
|
|
712
|
+
if (this.holidayModeSupport && this.accessory.holidayMode.Enabled !== null) {
|
|
717
713
|
//control
|
|
718
714
|
if (this.logDebug) this.emit('debug', `Prepare holiday mode control service`);
|
|
719
715
|
this.holidayModeControlService = new Service.Switch(`${serviceName} Holiday Mode`, `holidayModeControlService${deviceId}`);
|
|
@@ -721,7 +717,7 @@ class DeviceErv extends EventEmitter {
|
|
|
721
717
|
this.holidayModeControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode`);
|
|
722
718
|
this.holidayModeControlService.getCharacteristic(Characteristic.On)
|
|
723
719
|
.onGet(async () => {
|
|
724
|
-
const state = this.accessory.
|
|
720
|
+
const state = this.accessory.holidayMode.Enabled;
|
|
725
721
|
return state;
|
|
726
722
|
})
|
|
727
723
|
.onSet(async (state) => {
|
|
@@ -741,7 +737,7 @@ class DeviceErv extends EventEmitter {
|
|
|
741
737
|
this.holidayModeControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode Control`);
|
|
742
738
|
this.holidayModeControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
743
739
|
.onGet(async () => {
|
|
744
|
-
const state = this.accessory.
|
|
740
|
+
const state = this.accessory.holidayMode.Enabled;
|
|
745
741
|
return state;
|
|
746
742
|
})
|
|
747
743
|
accessory.addService(this.holidayModeControlSensorService);
|
|
@@ -753,7 +749,7 @@ class DeviceErv extends EventEmitter {
|
|
|
753
749
|
this.holidayModeSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode State`);
|
|
754
750
|
this.holidayModeSensorService.getCharacteristic(Characteristic.ContactSensorState)
|
|
755
751
|
.onGet(async () => {
|
|
756
|
-
const state = this.accessory.
|
|
752
|
+
const state = this.accessory.holidayMode.Active;
|
|
757
753
|
return state;
|
|
758
754
|
})
|
|
759
755
|
accessory.addService(this.holidayModeSensorService);
|
|
@@ -1150,11 +1146,12 @@ class DeviceErv extends EventEmitter {
|
|
|
1150
1146
|
|
|
1151
1147
|
//presets schedule
|
|
1152
1148
|
const presetsOnServer = deviceData.Presets ?? [];
|
|
1153
|
-
const scheduleEnabled = deviceData.ScheduleEnabled;
|
|
1154
1149
|
const schedulesOnServer = deviceData.Schedule ?? [];
|
|
1150
|
+
const scheduleEnabled = deviceData.ScheduleEnabled;
|
|
1155
1151
|
const scenesOnServer = deviceData.Scenes ?? [];
|
|
1156
|
-
|
|
1157
|
-
|
|
1152
|
+
|
|
1153
|
+
//protection
|
|
1154
|
+
const holidayMode = deviceData.HolidayMode ?? {};
|
|
1158
1155
|
|
|
1159
1156
|
//device control
|
|
1160
1157
|
const hideRoomTemperature = deviceData.HideRoomTemperature;
|
|
@@ -1187,8 +1184,8 @@ class DeviceErv extends EventEmitter {
|
|
|
1187
1184
|
const temperatureIncrement = deviceData.Device[tempStepKey] ?? 1;
|
|
1188
1185
|
const minTempHeat = 10;
|
|
1189
1186
|
const maxTempHeat = 31;
|
|
1190
|
-
const
|
|
1191
|
-
const
|
|
1187
|
+
const minTempCoolDryAuto = 16;
|
|
1188
|
+
const maxTempCoolDryAuto = 31;
|
|
1192
1189
|
|
|
1193
1190
|
//device state
|
|
1194
1191
|
const power = deviceData.Device.Power;
|
|
@@ -1210,7 +1207,9 @@ class DeviceErv extends EventEmitter {
|
|
|
1210
1207
|
const obj = {
|
|
1211
1208
|
presets: presetsOnServer,
|
|
1212
1209
|
schedules: schedulesOnServer,
|
|
1210
|
+
scheduleEnabled: scheduleEnabled,
|
|
1213
1211
|
scenes: scenesOnServer,
|
|
1212
|
+
holidayMode: holidayMode,
|
|
1214
1213
|
supportsRoomTemperature: supportsRoomTemperature,
|
|
1215
1214
|
supportsSupplyTemperature: supportsSupplyTemperature,
|
|
1216
1215
|
supportsOutdoorTemperature: supportsOutdoorTemperature,
|
|
@@ -1227,6 +1226,10 @@ class DeviceErv extends EventEmitter {
|
|
|
1227
1226
|
supportsBypassVentilationMode: supportsBypassVentilationMode,
|
|
1228
1227
|
supportsAutomaticFanSpeed: supportsAutomaticFanSpeed,
|
|
1229
1228
|
supportsStanbyMode: supportsStanbyMode,
|
|
1229
|
+
minTempHeat: minTempHeat,
|
|
1230
|
+
maxTempHeat: maxTempHeat,
|
|
1231
|
+
minTempCoolDryAuto: minTempCoolDryAuto,
|
|
1232
|
+
maxTempCoolDryAuto: maxTempCoolDryAuto,
|
|
1230
1233
|
coreMaintenanceRequired: coreMaintenanceRequired,
|
|
1231
1234
|
filterMaintenanceRequired: filterMaintenanceRequired,
|
|
1232
1235
|
actualVentilationMode: actualVentilationMode,
|
|
@@ -1246,18 +1249,10 @@ class DeviceErv extends EventEmitter {
|
|
|
1246
1249
|
defaultCoolingSetTemperature: defaultCoolingSetTemperature,
|
|
1247
1250
|
lockPhysicalControl: 0,
|
|
1248
1251
|
temperatureIncrement: temperatureIncrement,
|
|
1249
|
-
minTempHeat: minTempHeat,
|
|
1250
|
-
temperatureIncrement: maxTempHeat,
|
|
1251
|
-
minTempCoolDry: minTempCoolDry,
|
|
1252
|
-
maxTempCoolDry: maxTempCoolDry,
|
|
1253
1252
|
useFahrenheit: this.accountInfo.useFahrenheit ? 1 : 0,
|
|
1254
1253
|
temperatureUnit: TemperatureDisplayUnits[this.accountInfo.useFahrenheit ? 1 : 0],
|
|
1255
1254
|
isConnected: isConnected,
|
|
1256
|
-
isInError: isInError
|
|
1257
|
-
scheduleEnabled: scheduleEnabled,
|
|
1258
|
-
holidayModeEnabled: holidayModeEnabled,
|
|
1259
|
-
holidayModeActive: holidayModeActive,
|
|
1260
|
-
scheduleEnabled: scheduleEnabled
|
|
1255
|
+
isInError: isInError
|
|
1261
1256
|
};
|
|
1262
1257
|
|
|
1263
1258
|
//characteristics array
|
|
@@ -1414,10 +1409,10 @@ class DeviceErv extends EventEmitter {
|
|
|
1414
1409
|
this.errorService?.updateCharacteristic(Characteristic.ContactSensorState, isInError);
|
|
1415
1410
|
|
|
1416
1411
|
//holiday mode
|
|
1417
|
-
if (this.holidayModeSupport &&
|
|
1418
|
-
this.holidayModeControlService?.updateCharacteristic(Characteristic.On,
|
|
1419
|
-
this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState,
|
|
1420
|
-
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState,
|
|
1412
|
+
if (this.holidayModeSupport && holidayMode.Enabled !== null) {
|
|
1413
|
+
this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayMode.Enabled);
|
|
1414
|
+
this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayMode.Enabled);
|
|
1415
|
+
this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayMode.Active);
|
|
1421
1416
|
}
|
|
1422
1417
|
|
|
1423
1418
|
//presets
|