homebridge-melcloud-control 4.0.0-beta.205 → 4.0.0-beta.206
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 +4 -4
- package/config.schema.json +21 -21
- package/homebridge-ui/public/index.html +1 -1
- package/index.js +2 -2
- package/package.json +1 -1
- package/src/deviceata.js +37 -35
- package/src/deviceatw.js +4 -4
- package/src/deviceerv.js +25 -25
- package/src/melcloud.js +41 -92
- package/src/melcloudata.js +3 -3
- package/src/melclouderv.js +2 -2
package/README.md
CHANGED
|
@@ -207,13 +207,13 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
|
|
|
207
207
|
| `user` | Here set the account username. |
|
|
208
208
|
| `passwd` | Here set the account password. |
|
|
209
209
|
| `language` | Here select the account language. |
|
|
210
|
-
| `
|
|
210
|
+
| `type` | Here select the account type `None/Disabled`, `MELCloud`, `MELCloud Home`. |
|
|
211
211
|
| `ataDevices[]` | Array of ATA devices created automatically after login to MELCloud from plugin config UI. |
|
|
212
212
|
| `ataDevices[].id` | Read only data, do not change it. |
|
|
213
213
|
| `ataDevices[].type` | Read only data, do not change it. |
|
|
214
214
|
| `ataDevices[].typeString` | Read only data, do not change it. |
|
|
215
215
|
| `ataDevices[].name` | Here You can schange the `Accessory Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
216
|
-
| `ataDevices[].
|
|
216
|
+
| `ataDevices[].displayType` | Here select device control mode `None/Disabled`, `Heater/Cooler`, `Thermostat`. |
|
|
217
217
|
| `ataDevices[].heatDryFanMode` | Here select the operatiing mode for `Heat`, if this mode is not supported, it will be disabled. |
|
|
218
218
|
| `ataDevices[].coolDryFanMode` | Here select the operatiing mode for `Cool`, if this mode is not supported, it will be disabled. |
|
|
219
219
|
| `ataDevices[].autoDryFanMode` | Here select the operatiing mode for `Auto`, if this mode is not supported, it will be disabled.. |
|
|
@@ -234,7 +234,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
|
|
|
234
234
|
| `atwDevices[].type` | Read only data, do not change it. |
|
|
235
235
|
| `atwDevices[].typeString` | Read only data, do not change it. |
|
|
236
236
|
| `atwDevices[].name` | Here You can schange the `Accessory Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
237
|
-
| `atwDevices[].
|
|
237
|
+
| `atwDevices[].displayType` | Here select main control mode `None/Disabled`, `Heater/Cooler`, `Thermostat`. |
|
|
238
238
|
| `atwDevices[].hideZone` | Here select which zone need to be hidden `None/Disabled`, `Heat Pump`, `Heat Pump / Zone 1`, `Heat Pump / Zone 1 / Hot Water`, `Heat Pump / Zone 1 / Zone 2`, `Heat Pump / Hot Water`,`Heat Pump / Hot Water / Zone 2`, `Heat Pump / Zone 2`, `Zone 1`, `Zone 1 / Hot Water`, `Zone 1 / Hot Water / Zone 2`, `Zone 1 / Zone 2`, `Hot Water`, `Hot Water / Zone 2`, `Zone 2`, `All`. |
|
|
239
239
|
| `atwDevices[].temperatureSensor` | This enable extra `Room` temperature sensors to use with automations in HomeKit app. |
|
|
240
240
|
| `atwDevices[].temperatureSensorFlow` | This enable extra `Flow` temperature sensors to use with automations in HomeKit app. |
|
|
@@ -260,7 +260,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
|
|
|
260
260
|
| `ervDevices[].type` | Read only data, do not change it. |
|
|
261
261
|
| `ervDevices[].typeString` | Read only data, do not change it. |
|
|
262
262
|
| `ervDevices[].name` | Here You can schange the `Accessory Name` which is exposed to the `Homebridge/HomeKit`. |
|
|
263
|
-
| `ervDevices[].
|
|
263
|
+
| `ervDevices[].displayType` | Here select main control mode `None/Disabled`, `Heater/Cooler`, `Thermostat`. |
|
|
264
264
|
| `ervDevices[].temperatureSensor` | This enable extra `Room` temperature sensors to use with automations in HomeKit app. |
|
|
265
265
|
| `ervDevices[].temperatureSensorOutdoor` | This enable extra `Outdoor` temperature sensors to use with automations in HomeKit app. |
|
|
266
266
|
| `ervDevices[].temperatureSensorSupply` | This enable extra `Supply` temperature sensors to use with automations in HomeKit app. |
|
package/config.schema.json
CHANGED
|
@@ -251,7 +251,7 @@
|
|
|
251
251
|
"default": "Air Conditioner",
|
|
252
252
|
"readonly": true
|
|
253
253
|
},
|
|
254
|
-
"
|
|
254
|
+
"displayType": {
|
|
255
255
|
"title": "Display Type",
|
|
256
256
|
"type": "integer",
|
|
257
257
|
"minimum": 0,
|
|
@@ -786,7 +786,7 @@
|
|
|
786
786
|
}
|
|
787
787
|
},
|
|
788
788
|
"required": [
|
|
789
|
-
"
|
|
789
|
+
"displayType",
|
|
790
790
|
"heatDryFanMode",
|
|
791
791
|
"coolDryFanMode",
|
|
792
792
|
"autoDryFanMode"
|
|
@@ -825,7 +825,7 @@
|
|
|
825
825
|
"type": "string",
|
|
826
826
|
"default": "Heat Pump"
|
|
827
827
|
},
|
|
828
|
-
"
|
|
828
|
+
"displayType": {
|
|
829
829
|
"title": "Display Type",
|
|
830
830
|
"type": "integer",
|
|
831
831
|
"minimum": 0,
|
|
@@ -1323,7 +1323,7 @@
|
|
|
1323
1323
|
}
|
|
1324
1324
|
},
|
|
1325
1325
|
"required": [
|
|
1326
|
-
"
|
|
1326
|
+
"displayType",
|
|
1327
1327
|
"hideZone"
|
|
1328
1328
|
]
|
|
1329
1329
|
},
|
|
@@ -1360,7 +1360,7 @@
|
|
|
1360
1360
|
"type": "string",
|
|
1361
1361
|
"default": "Ventilation"
|
|
1362
1362
|
},
|
|
1363
|
-
"
|
|
1363
|
+
"displayType": {
|
|
1364
1364
|
"title": "Display Type",
|
|
1365
1365
|
"type": "integer",
|
|
1366
1366
|
"minimum": 0,
|
|
@@ -1672,7 +1672,7 @@
|
|
|
1672
1672
|
}
|
|
1673
1673
|
},
|
|
1674
1674
|
"required": [
|
|
1675
|
-
"
|
|
1675
|
+
"displayType"
|
|
1676
1676
|
]
|
|
1677
1677
|
},
|
|
1678
1678
|
"condition": {
|
|
@@ -1867,7 +1867,7 @@
|
|
|
1867
1867
|
"key": "accounts[].ataDevices[].typeString",
|
|
1868
1868
|
"readonly": true
|
|
1869
1869
|
},
|
|
1870
|
-
"accounts[].ataDevices[].
|
|
1870
|
+
"accounts[].ataDevices[].displayType",
|
|
1871
1871
|
{
|
|
1872
1872
|
"key": "accounts[].ataDevices[]",
|
|
1873
1873
|
"title": "Settings",
|
|
@@ -1882,7 +1882,7 @@
|
|
|
1882
1882
|
"accounts[].ataDevices[].refreshInterval"
|
|
1883
1883
|
],
|
|
1884
1884
|
"condition": {
|
|
1885
|
-
"functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].
|
|
1885
|
+
"functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].displayType > 0;"
|
|
1886
1886
|
}
|
|
1887
1887
|
},
|
|
1888
1888
|
{
|
|
@@ -1896,7 +1896,7 @@
|
|
|
1896
1896
|
"accounts[].ataDevices[].temperatureSensorOutdoor"
|
|
1897
1897
|
],
|
|
1898
1898
|
"condition": {
|
|
1899
|
-
"functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].
|
|
1899
|
+
"functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].displayType > 0;"
|
|
1900
1900
|
}
|
|
1901
1901
|
},
|
|
1902
1902
|
{
|
|
@@ -1922,7 +1922,7 @@
|
|
|
1922
1922
|
}
|
|
1923
1923
|
],
|
|
1924
1924
|
"condition": {
|
|
1925
|
-
"functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].
|
|
1925
|
+
"functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].displayType > 0;"
|
|
1926
1926
|
}
|
|
1927
1927
|
},
|
|
1928
1928
|
{
|
|
@@ -1945,7 +1945,7 @@
|
|
|
1945
1945
|
}
|
|
1946
1946
|
],
|
|
1947
1947
|
"condition": {
|
|
1948
|
-
"functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].
|
|
1948
|
+
"functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].displayType > 0;"
|
|
1949
1949
|
}
|
|
1950
1950
|
}
|
|
1951
1951
|
],
|
|
@@ -1981,7 +1981,7 @@
|
|
|
1981
1981
|
"key": "accounts[].atwDevices[].typeString",
|
|
1982
1982
|
"readonly": true
|
|
1983
1983
|
},
|
|
1984
|
-
"accounts[].atwDevices[].
|
|
1984
|
+
"accounts[].atwDevices[].displayType",
|
|
1985
1985
|
{
|
|
1986
1986
|
"key": "accounts[].atwDevices",
|
|
1987
1987
|
"type": "section",
|
|
@@ -1994,7 +1994,7 @@
|
|
|
1994
1994
|
"accounts[].atwDevices[].refreshInterval"
|
|
1995
1995
|
],
|
|
1996
1996
|
"condition": {
|
|
1997
|
-
"functionBody": "return model.accounts[arrayIndices[0]].atwDevices[arrayIndices[1]].
|
|
1997
|
+
"functionBody": "return model.accounts[arrayIndices[0]].atwDevices[arrayIndices[1]].displayType > 0;"
|
|
1998
1998
|
}
|
|
1999
1999
|
},
|
|
2000
2000
|
{
|
|
@@ -2015,7 +2015,7 @@
|
|
|
2015
2015
|
"accounts[].atwDevices[].temperatureSensorReturnZone2"
|
|
2016
2016
|
],
|
|
2017
2017
|
"condition": {
|
|
2018
|
-
"functionBody": "return model.accounts[arrayIndices[0]].atwDevices[arrayIndices[1]].
|
|
2018
|
+
"functionBody": "return model.accounts[arrayIndices[0]].atwDevices[arrayIndices[1]].displayType > 0;"
|
|
2019
2019
|
}
|
|
2020
2020
|
},
|
|
2021
2021
|
{
|
|
@@ -2041,7 +2041,7 @@
|
|
|
2041
2041
|
}
|
|
2042
2042
|
],
|
|
2043
2043
|
"condition": {
|
|
2044
|
-
"functionBody": "return model.accounts[arrayIndices[0]].atwDevices[arrayIndices[1]].
|
|
2044
|
+
"functionBody": "return model.accounts[arrayIndices[0]].atwDevices[arrayIndices[1]].displayType > 0;"
|
|
2045
2045
|
}
|
|
2046
2046
|
},
|
|
2047
2047
|
{
|
|
@@ -2064,7 +2064,7 @@
|
|
|
2064
2064
|
}
|
|
2065
2065
|
],
|
|
2066
2066
|
"condition": {
|
|
2067
|
-
"functionBody": "return model.accounts[arrayIndices[0]].atwDevices[arrayIndices[1]].
|
|
2067
|
+
"functionBody": "return model.accounts[arrayIndices[0]].atwDevices[arrayIndices[1]].displayType > 0;"
|
|
2068
2068
|
}
|
|
2069
2069
|
}
|
|
2070
2070
|
],
|
|
@@ -2100,7 +2100,7 @@
|
|
|
2100
2100
|
"key": "accounts[].ervDevices[].typeString",
|
|
2101
2101
|
"readonly": true
|
|
2102
2102
|
},
|
|
2103
|
-
"accounts[].ervDevices[].
|
|
2103
|
+
"accounts[].ervDevices[].displayType",
|
|
2104
2104
|
{
|
|
2105
2105
|
"key": "accounts[].ervDevices",
|
|
2106
2106
|
"title": "Settings",
|
|
@@ -2112,7 +2112,7 @@
|
|
|
2112
2112
|
"accounts[].ervDevices[].refreshInterval"
|
|
2113
2113
|
],
|
|
2114
2114
|
"condition": {
|
|
2115
|
-
"functionBody": "return model.accounts[arrayIndices[0]].ervDevices[arrayIndices[1]].
|
|
2115
|
+
"functionBody": "return model.accounts[arrayIndices[0]].ervDevices[arrayIndices[1]].displayType > 0;"
|
|
2116
2116
|
}
|
|
2117
2117
|
},
|
|
2118
2118
|
{
|
|
@@ -2127,7 +2127,7 @@
|
|
|
2127
2127
|
"accounts[].ervDevices[].temperatureSensorSupply"
|
|
2128
2128
|
],
|
|
2129
2129
|
"condition": {
|
|
2130
|
-
"functionBody": "return model.accounts[arrayIndices[0]].ervDevices[arrayIndices[1]].
|
|
2130
|
+
"functionBody": "return model.accounts[arrayIndices[0]].ervDevices[arrayIndices[1]].displayType > 0;"
|
|
2131
2131
|
}
|
|
2132
2132
|
},
|
|
2133
2133
|
{
|
|
@@ -2153,7 +2153,7 @@
|
|
|
2153
2153
|
}
|
|
2154
2154
|
],
|
|
2155
2155
|
"condition": {
|
|
2156
|
-
"functionBody": "return model.accounts[arrayIndices[0]].ervDevices[arrayIndices[1]].
|
|
2156
|
+
"functionBody": "return model.accounts[arrayIndices[0]].ervDevices[arrayIndices[1]].displayType > 0;"
|
|
2157
2157
|
}
|
|
2158
2158
|
},
|
|
2159
2159
|
{
|
|
@@ -2176,7 +2176,7 @@
|
|
|
2176
2176
|
}
|
|
2177
2177
|
],
|
|
2178
2178
|
"condition": {
|
|
2179
|
-
"functionBody": "return model.accounts[arrayIndices[0]].ervDevices[arrayIndices[1]].
|
|
2179
|
+
"functionBody": "return model.accounts[arrayIndices[0]].ervDevices[arrayIndices[1]].displayType > 0;"
|
|
2180
2180
|
}
|
|
2181
2181
|
}
|
|
2182
2182
|
],
|
package/index.js
CHANGED
|
@@ -131,9 +131,9 @@ class MelCloudPlatform {
|
|
|
131
131
|
|
|
132
132
|
for (const device of devices) {
|
|
133
133
|
//chack device from config exist on melcloud
|
|
134
|
-
const
|
|
134
|
+
const displayType = device.displayType > 0;
|
|
135
135
|
const deviceExistInMelCloud = devicesInMelcloud.some(dev => dev.DeviceID === device.id);
|
|
136
|
-
if (!deviceExistInMelCloud || !
|
|
136
|
+
if (!deviceExistInMelCloud || !displayType) {
|
|
137
137
|
continue;
|
|
138
138
|
}
|
|
139
139
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.206",
|
|
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/deviceata.js
CHANGED
|
@@ -17,9 +17,16 @@ class DeviceAta extends EventEmitter {
|
|
|
17
17
|
|
|
18
18
|
//account config
|
|
19
19
|
this.account = account;
|
|
20
|
-
this.device = device;
|
|
21
20
|
this.accountType = account.type;
|
|
22
|
-
this.
|
|
21
|
+
this.accountName = account.name;
|
|
22
|
+
this.logDeviceInfo = account.log?.deviceInfo || false;
|
|
23
|
+
this.logInfo = account.log?.info || false;
|
|
24
|
+
this.logWarn = account.log?.warn || false;
|
|
25
|
+
this.logDebug = account.log?.debug || false;
|
|
26
|
+
|
|
27
|
+
//device config
|
|
28
|
+
this.device = device;
|
|
29
|
+
this.displayType = device.displayType;
|
|
23
30
|
this.temperatureSensor = device.temperatureSensor || false;
|
|
24
31
|
this.temperatureSensorOutdoor = device.temperatureSensorOutdoor || false;
|
|
25
32
|
this.heatDryFanMode = device.heatDryFanMode || 1; //NONE, HEAT, DRY, FAN
|
|
@@ -27,11 +34,6 @@ class DeviceAta extends EventEmitter {
|
|
|
27
34
|
this.autoDryFanMode = device.autoDryFanMode || 1; //NONE, AUTO, DRY, FAN
|
|
28
35
|
this.presets = (device.presets || []).filter(preset => (preset.displayType ?? 0) > 0);
|
|
29
36
|
this.buttons = (device.buttonsSensors || []).filter(sensor => (sensor.displayType ?? 0) > 0);
|
|
30
|
-
this.logDeviceInfo = account.log?.deviceInfo || false;
|
|
31
|
-
this.logInfo = account.log?.info || false;
|
|
32
|
-
this.logWarn = account.log?.warn || false;
|
|
33
|
-
this.logDebug = account.log?.debug || false;
|
|
34
|
-
this.accountName = account.name;
|
|
35
37
|
this.deviceId = device.id;
|
|
36
38
|
this.deviceName = device.name;
|
|
37
39
|
this.deviceTypeText = device.typeString;
|
|
@@ -156,67 +158,67 @@ class DeviceAta extends EventEmitter {
|
|
|
156
158
|
case 'Power':
|
|
157
159
|
deviceData.Device[key] = value;
|
|
158
160
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
159
|
-
set = await this.melCloudAta.send(this.accountType, this.
|
|
161
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
160
162
|
break;
|
|
161
163
|
case 'OperationMode':
|
|
162
164
|
deviceData.Device[key] = value;
|
|
163
165
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.OperationMode
|
|
164
|
-
set = await this.melCloudAta.send(this.accountType, this.
|
|
166
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
165
167
|
break;
|
|
166
168
|
case 'SetTemperature':
|
|
167
169
|
deviceData.Device[key] = value;
|
|
168
170
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
169
|
-
set = await this.melCloudAta.send(this.accountType, this.
|
|
171
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
170
172
|
break;
|
|
171
173
|
case 'DefaultCoolingSetTemperature':
|
|
172
174
|
deviceData.Device[key] = value;
|
|
173
175
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
174
|
-
set = await this.melCloudAta.send(this.accountType, this.
|
|
176
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
175
177
|
break;
|
|
176
178
|
case 'DefaultHeatingSetTemperature':
|
|
177
179
|
deviceData.Device[key] = value;
|
|
178
180
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
179
|
-
set = await this.melCloudAta.send(this.accountType, this.
|
|
181
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
180
182
|
break;
|
|
181
183
|
case 'FanSpeed':
|
|
182
184
|
deviceData.Device[key] = value;
|
|
183
185
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
184
|
-
set = await this.melCloudAta.send(this.accountType, this.
|
|
186
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
185
187
|
break;
|
|
186
188
|
case 'VaneHorizontalDirection':
|
|
187
189
|
deviceData.Device[key] = value;
|
|
188
190
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneHorizontalDirection;
|
|
189
|
-
set = await this.melCloudAta.send(this.accountType, this.
|
|
191
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
190
192
|
break;
|
|
191
193
|
case 'VaneVerticalDirection':
|
|
192
194
|
deviceData.Device[key] = value;
|
|
193
195
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalDirection;
|
|
194
|
-
set = await this.melCloudAta.send(this.accountType, this.
|
|
196
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
195
197
|
break;
|
|
196
198
|
case 'HideVaneControls':
|
|
197
199
|
deviceData[key] = value;
|
|
198
200
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
199
|
-
set = await this.melCloudAta.send(this.accountType, this.
|
|
201
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
200
202
|
break;
|
|
201
203
|
case 'HideDryModeControl':
|
|
202
204
|
deviceData[key] = value;
|
|
203
205
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
204
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
206
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
205
207
|
break;
|
|
206
208
|
case 'ProhibitSetTemperature':
|
|
207
209
|
deviceData.Device[key] = value;
|
|
208
210
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
209
|
-
set = await this.melCloudAta.send(this.accountType, this.
|
|
211
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
210
212
|
break;
|
|
211
213
|
case 'ProhibitOperationMode':
|
|
212
214
|
deviceData.Device[key] = value;
|
|
213
215
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
214
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
216
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
215
217
|
break;
|
|
216
218
|
case 'ProhibitPower':
|
|
217
219
|
deviceData.Device[key] = value;
|
|
218
220
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
219
|
-
set = await this.melCloudAta.send(this.accountType, this.
|
|
221
|
+
set = await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
220
222
|
break;
|
|
221
223
|
default:
|
|
222
224
|
this.emit('warn', `${integration}, received key: ${key}, value: ${value}`);
|
|
@@ -264,7 +266,7 @@ class DeviceAta extends EventEmitter {
|
|
|
264
266
|
if (this.logDebug) this.emit('debug', `Prepare accessory`);
|
|
265
267
|
const accessoryName = deviceName;
|
|
266
268
|
const accessoryUUID = AccessoryUUID.generate(accountName + deviceId.toString());
|
|
267
|
-
const accessoryCategory = [Categories.OTHER, Categories.AIR_HEATER, Categories.THERMOSTAT][this.
|
|
269
|
+
const accessoryCategory = [Categories.OTHER, Categories.AIR_HEATER, Categories.THERMOSTAT][this.displayType];
|
|
268
270
|
const accessory = new Accessory(accessoryName, accessoryUUID, accessoryCategory);
|
|
269
271
|
|
|
270
272
|
//information service
|
|
@@ -278,7 +280,7 @@ class DeviceAta extends EventEmitter {
|
|
|
278
280
|
|
|
279
281
|
//melcloud services
|
|
280
282
|
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
281
|
-
switch (this.
|
|
283
|
+
switch (this.displayType) {
|
|
282
284
|
case 1: //Heater Cooler
|
|
283
285
|
if (this.logDebug) this.emit('debug', `Prepare heater/cooler service`);
|
|
284
286
|
this.melCloudService = new Service.HeaterCooler(serviceName, `HeaterCooler ${deviceId}`);
|
|
@@ -295,7 +297,7 @@ class DeviceAta extends EventEmitter {
|
|
|
295
297
|
try {
|
|
296
298
|
deviceData.Device.Power = state
|
|
297
299
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Power;
|
|
298
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
300
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
299
301
|
if (this.logInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
300
302
|
} catch (error) {
|
|
301
303
|
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
@@ -334,7 +336,7 @@ class DeviceAta extends EventEmitter {
|
|
|
334
336
|
};
|
|
335
337
|
|
|
336
338
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.OperationMode;
|
|
337
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
339
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
338
340
|
if (this.logInfo) this.emit('info', `Set operation mode: ${AirConditioner.OperationModeMapEnumToString[value]}`);
|
|
339
341
|
} catch (error) {
|
|
340
342
|
if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
|
|
@@ -376,7 +378,7 @@ class DeviceAta extends EventEmitter {
|
|
|
376
378
|
|
|
377
379
|
deviceData.Device[fanKey] = value
|
|
378
380
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
379
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
381
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
380
382
|
if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeedMapEnumToString[value]}`);
|
|
381
383
|
} catch (error) {
|
|
382
384
|
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
@@ -395,7 +397,7 @@ class DeviceAta extends EventEmitter {
|
|
|
395
397
|
deviceData.Device.VaneHorizontalDirection = value ? 12 : 0;
|
|
396
398
|
deviceData.Device.VaneVerticalDirection = value ? 7 : 0;
|
|
397
399
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalVaneHorizontal;
|
|
398
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
400
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
399
401
|
if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirectionMapEnumToString[value]}`);
|
|
400
402
|
} catch (error) {
|
|
401
403
|
if (this.logWarn) this.emit('warn', `Set vane swing mode error: ${error}`);
|
|
@@ -417,7 +419,7 @@ class DeviceAta extends EventEmitter {
|
|
|
417
419
|
const tempKey = this.accessory.operationMode === 8 ? 'DefaultCoolingSetTemperature' : 'SetTemperature';
|
|
418
420
|
deviceData.Device[tempKey] = value;
|
|
419
421
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
420
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
422
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
421
423
|
if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
422
424
|
} catch (error) {
|
|
423
425
|
if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
@@ -439,7 +441,7 @@ class DeviceAta extends EventEmitter {
|
|
|
439
441
|
const tempKey = this.accessory.operationMode === 8 ? 'DefaultHeatingSetTemperature' : 'SetTemperature';
|
|
440
442
|
deviceData.Device[tempKey] = value;
|
|
441
443
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
442
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
444
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
443
445
|
if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
444
446
|
} catch (error) {
|
|
445
447
|
if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
@@ -458,7 +460,7 @@ class DeviceAta extends EventEmitter {
|
|
|
458
460
|
deviceData.Device.ProhibitOperationMode = value;
|
|
459
461
|
deviceData.Device.ProhibitPower = value;
|
|
460
462
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Prohibit;
|
|
461
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
463
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
462
464
|
if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
463
465
|
} catch (error) {
|
|
464
466
|
if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
@@ -526,7 +528,7 @@ class DeviceAta extends EventEmitter {
|
|
|
526
528
|
};
|
|
527
529
|
|
|
528
530
|
deviceData.Device.OperationMode = value;
|
|
529
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
531
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
530
532
|
const operationModeText = AirConditioner.OperationModeMapEnumToString[value];
|
|
531
533
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
532
534
|
} catch (error) {
|
|
@@ -552,7 +554,7 @@ class DeviceAta extends EventEmitter {
|
|
|
552
554
|
try {
|
|
553
555
|
deviceData.Device.SetTemperature = value;
|
|
554
556
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetTemperature;
|
|
555
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
557
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
556
558
|
if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
557
559
|
} catch (error) {
|
|
558
560
|
if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
|
|
@@ -663,7 +665,7 @@ class DeviceAta extends EventEmitter {
|
|
|
663
665
|
break;
|
|
664
666
|
};
|
|
665
667
|
|
|
666
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
668
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
667
669
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
668
670
|
} catch (error) {
|
|
669
671
|
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
@@ -904,7 +906,7 @@ class DeviceAta extends EventEmitter {
|
|
|
904
906
|
break;
|
|
905
907
|
};
|
|
906
908
|
|
|
907
|
-
await this.melCloudAta.send(this.accountType, this.
|
|
909
|
+
await this.melCloudAta.send(this.accountType, this.displayType, deviceData);
|
|
908
910
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
|
|
909
911
|
} catch (error) {
|
|
910
912
|
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
@@ -1041,7 +1043,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1041
1043
|
};
|
|
1042
1044
|
|
|
1043
1045
|
//operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
|
|
1044
|
-
switch (this.
|
|
1046
|
+
switch (this.displayType) {
|
|
1045
1047
|
case 1: //Heater Cooler
|
|
1046
1048
|
switch (operationMode) {
|
|
1047
1049
|
case 1: //HEAT
|
|
@@ -1322,7 +1324,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1322
1324
|
if (this.logInfo) {
|
|
1323
1325
|
this.emit('info', `Power: ${power ? 'ON' : 'OFF'}`);
|
|
1324
1326
|
this.emit('info', `Target operation mode: ${AirConditioner.OperationModeMapEnumToString[operationMode]}`);
|
|
1325
|
-
this.emit('info', `Current operation mode: ${this.
|
|
1327
|
+
this.emit('info', `Current operation mode: ${this.displayType === 1 ? AirConditioner.CurrentOperationModeHeatherCoolerMapEnumToString[obj.currentOperationMode] : AirConditioner.CurrentOperationModeThermostatMapEnumToString[obj.currentOperationMode]}`);
|
|
1326
1328
|
this.emit('info', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
|
|
1327
1329
|
this.emit('info', `Current temperature: ${roomTemperature}${obj.temperatureUnit}`);
|
|
1328
1330
|
if (supportsOutdoorTemperature && outdoorTemperature !== null) this.emit('info', `Outdoor temperature: ${outdoorTemperature}${obj.temperatureUnit}`);
|
package/src/deviceatw.js
CHANGED
|
@@ -18,7 +18,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
18
18
|
//account config
|
|
19
19
|
this.accountMelcloud = account.displayType === 'melcloud' ? true : false;
|
|
20
20
|
this.device = device;
|
|
21
|
-
this.
|
|
21
|
+
this.displayType = device.displayType;
|
|
22
22
|
this.hideZone = device.hideZone;
|
|
23
23
|
this.temperatureSensor = device.temperatureSensor || false;
|
|
24
24
|
this.temperatureSensorFlow = device.temperatureSensorFlow || false;
|
|
@@ -289,7 +289,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
289
289
|
if (this.logDebug) this.emit('debug', `Prepare accessory`);
|
|
290
290
|
const accessoryName = deviceName;
|
|
291
291
|
const accessoryUUID = AccessoryUUID.generate(accountName + deviceId.toString());
|
|
292
|
-
const accessoryCategory = [Categories.OTHER, Categories.AIR_HEATER, Categories.THERMOSTAT][this.
|
|
292
|
+
const accessoryCategory = [Categories.OTHER, Categories.AIR_HEATER, Categories.THERMOSTAT][this.displayType];
|
|
293
293
|
const accessory = new Accessory(accessoryName, accessoryUUID, accessoryCategory);
|
|
294
294
|
|
|
295
295
|
//information service
|
|
@@ -307,7 +307,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
307
307
|
this.accessory.zones.forEach((zone, i) => {
|
|
308
308
|
const zoneName = zone.name
|
|
309
309
|
const serviceName = `${deviceTypeText} ${accessoryName}: ${zoneName}`;
|
|
310
|
-
switch (this.
|
|
310
|
+
switch (this.displayType) {
|
|
311
311
|
case 1: //Heater Cooler
|
|
312
312
|
if (this.logDebug) this.emit('debug', `Prepare heather/cooler ${zoneName} service`);
|
|
313
313
|
const melCloudService = new Service.HeaterCooler(serviceName, `HeaterCooler ${deviceId} ${i}`);
|
|
@@ -1437,7 +1437,7 @@ class DeviceAtw extends EventEmitter {
|
|
|
1437
1437
|
let temperatureSetPropsMaxValue = 100;
|
|
1438
1438
|
|
|
1439
1439
|
for (let i = 0; i < zonesCount; i++) {
|
|
1440
|
-
switch (this.
|
|
1440
|
+
switch (this.displayType) {
|
|
1441
1441
|
case 1: //Heater Cooler
|
|
1442
1442
|
switch (i) {
|
|
1443
1443
|
case caseHeatPump: //Heat Pump Operation Mode - IDLE, HOT WATER, HEATING ZONES, COOLING, HOT WATER STORAGE, FREEZE STAT, LEGIONELLA, HEATING ECO, MODE 1, MODE 2, MODE 3, HEATING UP /// Unit Status - HEAT, COOL
|
package/src/deviceerv.js
CHANGED
|
@@ -18,7 +18,7 @@ class DeviceErv extends EventEmitter {
|
|
|
18
18
|
//account config
|
|
19
19
|
this.accountMelcloud = account.displayType === 'melcloud' ? true : false;
|
|
20
20
|
this.device = device;
|
|
21
|
-
this.
|
|
21
|
+
this.displayType = device.displayType;
|
|
22
22
|
this.temperatureSensor = device.temperatureSensor || false;
|
|
23
23
|
this.temperatureSensorOutdoor = device.temperatureSensorOutdoor || false;
|
|
24
24
|
this.temperatureSensorSupply = device.temperatureSensorSupply || false;
|
|
@@ -154,57 +154,57 @@ class DeviceErv extends EventEmitter {
|
|
|
154
154
|
case 'Power':
|
|
155
155
|
deviceData.Device[key] = value;
|
|
156
156
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.Power;
|
|
157
|
-
set = await this.melCloudErv.send(deviceData, this.
|
|
157
|
+
set = await this.melCloudErv.send(deviceData, this.displayType);
|
|
158
158
|
break;
|
|
159
159
|
case 'OperationMode':
|
|
160
160
|
deviceData.Device[key] = value;
|
|
161
161
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.OperationMode;
|
|
162
|
-
set = await this.melCloudErv.send(deviceData, this.
|
|
162
|
+
set = await this.melCloudErv.send(deviceData, this.displayType);
|
|
163
163
|
break;
|
|
164
164
|
case 'VentilationMode':
|
|
165
165
|
deviceData.Device[key] = value;
|
|
166
166
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.VentilationMode;
|
|
167
|
-
set = await this.melCloudErv.send(deviceData, this.
|
|
167
|
+
set = await this.melCloudErv.send(deviceData, this.displayType);
|
|
168
168
|
break;
|
|
169
169
|
case 'SetTemperature':
|
|
170
170
|
deviceData.Device[key] = value;
|
|
171
171
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
172
|
-
set = await this.melCloudErv.send(deviceData, this.
|
|
172
|
+
set = await this.melCloudErv.send(deviceData, this.displayType);
|
|
173
173
|
break;
|
|
174
174
|
case 'DefaultCoolingSetTemperature':
|
|
175
175
|
deviceData.Device[key] = value;
|
|
176
176
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
177
|
-
set = await this.melCloudErv.send(deviceData, this.
|
|
177
|
+
set = await this.melCloudErv.send(deviceData, this.displayType);
|
|
178
178
|
break;
|
|
179
179
|
case 'DefaultHeatingSetTemperature':
|
|
180
180
|
deviceData.Device[key] = value;
|
|
181
181
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
182
|
-
set = await this.melCloudErv.send(deviceData, this.
|
|
182
|
+
set = await this.melCloudErv.send(deviceData, this.displayType);
|
|
183
183
|
break;
|
|
184
184
|
case 'NightPurgeMode':
|
|
185
185
|
deviceData.Device[key] = value;
|
|
186
186
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.NightPurgeMode;
|
|
187
|
-
set = await this.melCloudErv.send(deviceData, this.
|
|
187
|
+
set = await this.melCloudErv.send(deviceData, this.displayType);
|
|
188
188
|
break;
|
|
189
189
|
case 'SetFanSpeed':
|
|
190
190
|
deviceData.Device[key] = value;
|
|
191
191
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.SetFanSpeed;
|
|
192
|
-
set = await this.melCloudErv.send(deviceData, this.
|
|
192
|
+
set = await this.melCloudErv.send(deviceData, this.displayType);
|
|
193
193
|
break;
|
|
194
194
|
case 'HideRoomTemperature':
|
|
195
195
|
deviceData[key] = value;
|
|
196
196
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.Prohibit;
|
|
197
|
-
set = await this.melCloudErv.send(deviceData, this.
|
|
197
|
+
set = await this.melCloudErv.send(deviceData, this.displayType);
|
|
198
198
|
break;
|
|
199
199
|
case 'HideSupplyTemperature':
|
|
200
200
|
deviceData[key] = value;
|
|
201
201
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.Prohibit;
|
|
202
|
-
set = await this.melCloudErv.send(deviceData, this.
|
|
202
|
+
set = await this.melCloudErv.send(deviceData, this.displayType);
|
|
203
203
|
break;
|
|
204
204
|
case 'HideOutdoorTemperature':
|
|
205
205
|
deviceData[key] = value;
|
|
206
206
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.Prohibit;
|
|
207
|
-
set = await this.melCloudErv.send(deviceData, this.
|
|
207
|
+
set = await this.melCloudErv.send(deviceData, this.displayType);
|
|
208
208
|
break;
|
|
209
209
|
default:
|
|
210
210
|
this.emit('warn', `${integration}, received key: ${key}, value: ${value}`);
|
|
@@ -251,7 +251,7 @@ class DeviceErv extends EventEmitter {
|
|
|
251
251
|
if (this.logDebug) this.emit('debug', `Prepare accessory`);
|
|
252
252
|
const accessoryName = deviceName;
|
|
253
253
|
const accessoryUUID = AccessoryUUID.generate(accountName + deviceId.toString());
|
|
254
|
-
const accessoryCategory = [Categories.OTHER, Categories.AIR_PURIFIER, Categories.THERMOSTAT][this.
|
|
254
|
+
const accessoryCategory = [Categories.OTHER, Categories.AIR_PURIFIER, Categories.THERMOSTAT][this.displayType];
|
|
255
255
|
const accessory = new Accessory(accessoryName, accessoryUUID, accessoryCategory);
|
|
256
256
|
|
|
257
257
|
//information service
|
|
@@ -265,7 +265,7 @@ class DeviceErv extends EventEmitter {
|
|
|
265
265
|
|
|
266
266
|
//services
|
|
267
267
|
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
268
|
-
switch (this.
|
|
268
|
+
switch (this.displayType) {
|
|
269
269
|
case 1: //Heater Cooler
|
|
270
270
|
if (this.logDebug) this.emit('debug', `Prepare heather/cooler service`);
|
|
271
271
|
this.melCloudService = new Service.HeaterCooler(serviceName, `HeaterCooler ${deviceId}`);
|
|
@@ -279,7 +279,7 @@ class DeviceErv extends EventEmitter {
|
|
|
279
279
|
try {
|
|
280
280
|
deviceData.Device.Power = [false, true][state];
|
|
281
281
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.Power;
|
|
282
|
-
await this.melCloudErv.send(deviceData, this.
|
|
282
|
+
await this.melCloudErv.send(deviceData, this.displayType);
|
|
283
283
|
if (this.logInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
|
|
284
284
|
} catch (error) {
|
|
285
285
|
if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
|
|
@@ -315,7 +315,7 @@ class DeviceErv extends EventEmitter {
|
|
|
315
315
|
};
|
|
316
316
|
|
|
317
317
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.VentilationMode;
|
|
318
|
-
await this.melCloudErv.send(deviceData, this.
|
|
318
|
+
await this.melCloudErv.send(deviceData, this.displayType);
|
|
319
319
|
const operationModeText = Ventilation.VentilationMode[deviceData.Device.VentilationMode];
|
|
320
320
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
321
321
|
} catch (error) {
|
|
@@ -359,7 +359,7 @@ class DeviceErv extends EventEmitter {
|
|
|
359
359
|
break;;
|
|
360
360
|
};
|
|
361
361
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.SetFanSpeed;
|
|
362
|
-
await this.melCloudErv.send(deviceData, this.
|
|
362
|
+
await this.melCloudErv.send(deviceData, this.displayType);
|
|
363
363
|
if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeed[fanSpeedModeText]}`);
|
|
364
364
|
} catch (error) {
|
|
365
365
|
if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
|
|
@@ -381,7 +381,7 @@ class DeviceErv extends EventEmitter {
|
|
|
381
381
|
try {
|
|
382
382
|
deviceData.Device.DefaultCoolingSetTemperature = value;
|
|
383
383
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
384
|
-
await this.melCloudErv.send(deviceData, this.
|
|
384
|
+
await this.melCloudErv.send(deviceData, this.displayType);
|
|
385
385
|
if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
386
386
|
} catch (error) {
|
|
387
387
|
if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
@@ -404,7 +404,7 @@ class DeviceErv extends EventEmitter {
|
|
|
404
404
|
try {
|
|
405
405
|
deviceData.Device.DefaultHeatingSetTemperature = value;
|
|
406
406
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
407
|
-
await this.melCloudErv.send(deviceData, this.
|
|
407
|
+
await this.melCloudErv.send(deviceData, this.displayType);
|
|
408
408
|
if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
409
409
|
} catch (error) {
|
|
410
410
|
if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
|
|
@@ -422,7 +422,7 @@ class DeviceErv extends EventEmitter {
|
|
|
422
422
|
// value = value ? true : false;
|
|
423
423
|
// deviceData.Device = deviceData.Device;
|
|
424
424
|
// deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.Prohibit;
|
|
425
|
-
// await this.melCloudErv.send(deviceData, this.
|
|
425
|
+
// await this.melCloudErv.send(deviceData, this.displayType);
|
|
426
426
|
// if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
|
|
427
427
|
// } catch (error) {
|
|
428
428
|
// if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
|
|
@@ -488,7 +488,7 @@ class DeviceErv extends EventEmitter {
|
|
|
488
488
|
break;
|
|
489
489
|
};
|
|
490
490
|
|
|
491
|
-
await this.melCloudErv.send(deviceData, this.
|
|
491
|
+
await this.melCloudErv.send(deviceData, this.displayType);
|
|
492
492
|
const operationModeText = Ventilation.VentilationMode[deviceData.Device.VentilationMode];
|
|
493
493
|
if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
|
|
494
494
|
} catch (error) {
|
|
@@ -514,7 +514,7 @@ class DeviceErv extends EventEmitter {
|
|
|
514
514
|
try {
|
|
515
515
|
deviceData.Device.SetTemperature = value;
|
|
516
516
|
deviceData.Device.EffectiveFlags = Ventilation.EffectiveFlags.SetTemperature;
|
|
517
|
-
await this.melCloudErv.send(deviceData, this.
|
|
517
|
+
await this.melCloudErv.send(deviceData, this.displayType);
|
|
518
518
|
if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
|
|
519
519
|
} catch (error) {
|
|
520
520
|
if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
|
|
@@ -706,7 +706,7 @@ class DeviceErv extends EventEmitter {
|
|
|
706
706
|
break;
|
|
707
707
|
};
|
|
708
708
|
|
|
709
|
-
await this.melCloudErv.send(deviceData, this.
|
|
709
|
+
await this.melCloudErv.send(deviceData, this.displayType);
|
|
710
710
|
if (this.logInfo) this.emit('info', `${state ? 'Set:' : 'Unset:'} ${name}`);
|
|
711
711
|
} catch (error) {
|
|
712
712
|
if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
|
|
@@ -820,7 +820,7 @@ class DeviceErv extends EventEmitter {
|
|
|
820
820
|
break;
|
|
821
821
|
};
|
|
822
822
|
|
|
823
|
-
await this.melCloudErv.send(deviceData, this.
|
|
823
|
+
await this.melCloudErv.send(deviceData, this.displayType);
|
|
824
824
|
if (this.logInfo) this.emit('info', `${state ? `Set: ${buttonName}` : `Unset: ${buttonName}, Set: ${button.previousValue}`}`);
|
|
825
825
|
} catch (error) {
|
|
826
826
|
if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
|
|
@@ -958,7 +958,7 @@ class DeviceErv extends EventEmitter {
|
|
|
958
958
|
};
|
|
959
959
|
|
|
960
960
|
//ventilation mode - 0, HEAT, 2, COOL, 4, 5, 6, FAN, AUTO
|
|
961
|
-
switch (this.
|
|
961
|
+
switch (this.displayType) {
|
|
962
962
|
case 1: //Heater Cooler
|
|
963
963
|
switch (ventilationMode) {
|
|
964
964
|
case 0: //LOSSNAY
|
package/src/melcloud.js
CHANGED
|
@@ -57,112 +57,61 @@ class MelCloud extends EventEmitter {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
async checkMelcloudDevicesList(contextKey) {
|
|
60
|
-
if (this.logDebug) this.emit('debug', `Connecting to MELCloud Home`);
|
|
61
|
-
|
|
62
60
|
try {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
const axiosInstanceGet = axios.create({
|
|
62
|
+
method: 'GET',
|
|
63
|
+
baseURL: ApiUrls.BaseURL,
|
|
64
|
+
timeout: 15000,
|
|
65
|
+
headers: { 'X-MitsContextKey': contextKey }
|
|
66
66
|
});
|
|
67
|
-
const page = await browser.newPage();
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
if (this.logDebug) this.emit('debug', `Scanning for devices`);
|
|
69
|
+
const listDevicesData = await axiosInstanceGet(ApiUrls.ListDevices);
|
|
70
|
+
const buildingsList = listDevicesData.data;
|
|
71
|
+
if (this.logDebug) this.emit('debug', `Buildings: ${JSON.stringify(buildingsList, null, 2)}`);
|
|
70
72
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const text = await page.evaluate(el => el.textContent, btn);
|
|
75
|
-
if (text.trim() === 'Zaloguj' || text.trim() === 'Log In') {
|
|
76
|
-
loginBtn = btn;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
73
|
+
if (!buildingsList) {
|
|
74
|
+
if (this.logWarn) this.emit('warn', `No building found`);
|
|
75
|
+
return null;
|
|
79
76
|
}
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
await Promise.all([
|
|
84
|
-
loginBtn.click(),
|
|
85
|
-
page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 10000 })
|
|
86
|
-
]);
|
|
87
|
-
|
|
88
|
-
await page.waitForSelector('input[name="username"]', { timeout: 5000 });
|
|
89
|
-
await page.type('input[name="username"]', this.user, { delay: 50 });
|
|
90
|
-
await page.type('input[name="password"]', this.passwd, { delay: 50 });
|
|
78
|
+
await this.functions.saveData(this.buildingsFile, buildingsList);
|
|
79
|
+
if (this.logDebug) this.emit('debug', `Buildings list saved`);
|
|
91
80
|
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
81
|
+
const devices = [];
|
|
82
|
+
for (const building of buildingsList) {
|
|
83
|
+
const buildingStructure = building.Structure;
|
|
84
|
+
const allDevices = [
|
|
85
|
+
...buildingStructure.Floors.flatMap(floor => [
|
|
86
|
+
...floor.Areas.flatMap(area => area.Devices),
|
|
87
|
+
...floor.Devices
|
|
88
|
+
]),
|
|
89
|
+
...buildingStructure.Areas.flatMap(area => area.Devices),
|
|
90
|
+
...buildingStructure.Devices
|
|
91
|
+
];
|
|
97
92
|
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
// Zamiana DeviceID na string
|
|
94
|
+
allDevices.forEach(device => {
|
|
95
|
+
if (device.DeviceID !== undefined && device.DeviceID !== null) {
|
|
96
|
+
device.DeviceID = device.DeviceID.toString();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
const cookies = await page.cookies();
|
|
103
|
-
c1 = cookies.find(c => c.name === '__Secure-monitorandcontrolC1')?.value || c1;
|
|
104
|
-
c2 = cookies.find(c => c.name === '__Secure-monitorandcontrolC2')?.value || c2;
|
|
105
|
-
if (!c1 || !c2) await new Promise(r => setTimeout(r, 500));
|
|
100
|
+
devices.push(...allDevices);
|
|
106
101
|
}
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
const devicesCount = devices.length;
|
|
104
|
+
if (devicesCount === 0) {
|
|
105
|
+
if (this.logWarn) this.emit('warn', `No devices found`);
|
|
110
106
|
return null;
|
|
111
107
|
}
|
|
112
108
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
`__Secure-monitorandcontrolC1=${c1}`,
|
|
116
|
-
`__Secure-monitorandcontrolC2=${c2}`
|
|
117
|
-
].join('; ');
|
|
118
|
-
|
|
119
|
-
const accountInfo = { ContextKey: contextKey, UseFahrenheit: false };
|
|
120
|
-
this.contextKey = contextKey;
|
|
121
|
-
|
|
122
|
-
await this.functions.saveData(this.accountFile, accountInfo);
|
|
123
|
-
if (!refresh) this.emit('success', `Connect to MELCloud Home Success`);
|
|
124
|
-
|
|
125
|
-
await browser.close();
|
|
126
|
-
return accountInfo;
|
|
109
|
+
await this.functions.saveData(this.devicesFile, devices);
|
|
110
|
+
if (this.logDebug) this.emit('debug', `${devicesCount} devices saved`);
|
|
127
111
|
|
|
112
|
+
return devices;
|
|
128
113
|
} catch (error) {
|
|
129
|
-
|
|
130
|
-
const inDocker = isRunningInDocker();
|
|
131
|
-
this.emit('warn', `Missing system libraries detected.`);
|
|
132
|
-
|
|
133
|
-
if (inDocker) {
|
|
134
|
-
this.emit('warn', `Running in Docker — attempting automatic fix...`);
|
|
135
|
-
|
|
136
|
-
const installCmd =
|
|
137
|
-
'apt-get update && apt-get install -y ' +
|
|
138
|
-
'libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 ' +
|
|
139
|
-
'libxcomposite1 libxrandr2 libxdamage1 libxkbcommon0 libpango-1.0-0 ' +
|
|
140
|
-
'libgbm1 libasound2 libxshmfence1 fonts-liberation libappindicator3-1 libu2f-udev';
|
|
141
|
-
|
|
142
|
-
try {
|
|
143
|
-
execSync(installCmd, { stdio: 'inherit' });
|
|
144
|
-
this.emit('debug', `Libraries installed. Retrying Puppeteer...`);
|
|
145
|
-
|
|
146
|
-
const browser = await puppeteer.launch({
|
|
147
|
-
headless: true,
|
|
148
|
-
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
|
149
|
-
});
|
|
150
|
-
await browser.close();
|
|
151
|
-
this.emit('success', `Puppeteer repaired and running.`);
|
|
152
|
-
return true;
|
|
153
|
-
|
|
154
|
-
} catch (fixError) {
|
|
155
|
-
this.emit('error', `Automatic fix failed. You can run manually inside container:\n${installCmd}`);
|
|
156
|
-
throw fixError;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
} else {
|
|
160
|
-
this.emit('error', `System libraries missing. Detected non-Docker environment — please install dependencies manually.`);
|
|
161
|
-
throw error;
|
|
162
|
-
}
|
|
163
|
-
} else {
|
|
164
|
-
throw new Error(`Puppeteer failed: ${error.message}`);
|
|
165
|
-
}
|
|
114
|
+
throw new Error(`Check devices list error: ${error.message}`);
|
|
166
115
|
}
|
|
167
116
|
}
|
|
168
117
|
|
|
@@ -320,7 +269,7 @@ class MelCloud extends EventEmitter {
|
|
|
320
269
|
}
|
|
321
270
|
}
|
|
322
271
|
|
|
323
|
-
isRunningInDocker() {
|
|
272
|
+
async isRunningInDocker() {
|
|
324
273
|
try {
|
|
325
274
|
if (fs.existsSync('/.dockerenv')) return true;
|
|
326
275
|
const cgroup = fs.readFileSync('/proc/1/cgroup', 'utf8');
|
|
@@ -402,7 +351,7 @@ class MelCloud extends EventEmitter {
|
|
|
402
351
|
return accountInfo;
|
|
403
352
|
} catch (error) {
|
|
404
353
|
if (error.message.includes('libnspr4.so') || error.message.includes('Failed to launch the browser process')) {
|
|
405
|
-
const inDocker = this.isRunningInDocker();
|
|
354
|
+
const inDocker = await this.isRunningInDocker();
|
|
406
355
|
if (this.logWarn) this.emit('warn', `Missing system libraries detected.`);
|
|
407
356
|
|
|
408
357
|
if (inDocker) {
|
package/src/melcloudata.js
CHANGED
|
@@ -174,7 +174,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
174
174
|
};
|
|
175
175
|
};
|
|
176
176
|
|
|
177
|
-
async send(accountType,
|
|
177
|
+
async send(accountType, displayType, deviceData) {
|
|
178
178
|
try {
|
|
179
179
|
switch (accountType) {
|
|
180
180
|
case "melcloud":
|
|
@@ -189,7 +189,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
189
189
|
withCredentials: true
|
|
190
190
|
});
|
|
191
191
|
|
|
192
|
-
if (
|
|
192
|
+
if (displayType === 1 && deviceData.Device.OperationMode === 8) {
|
|
193
193
|
deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
194
194
|
}
|
|
195
195
|
|
|
@@ -238,7 +238,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
240
|
|
|
241
|
-
if (
|
|
241
|
+
if (displayType === 1 && deviceData.Device.OperationMode === 8) {
|
|
242
242
|
deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
243
243
|
|
|
244
244
|
if (this.deviceState.DefaultCoolingSetTemperature !== deviceData.Device.DefaultCoolingSetTemperature || this.deviceState.DefaultHeatingSetTemperature !== deviceData.Device.DefaultHeatingSetTemperature) {
|
package/src/melclouderv.js
CHANGED
|
@@ -209,10 +209,10 @@ class MelCloudErv extends EventEmitter {
|
|
|
209
209
|
};
|
|
210
210
|
};
|
|
211
211
|
|
|
212
|
-
async send(deviceData,
|
|
212
|
+
async send(deviceData, displayType) {
|
|
213
213
|
try {
|
|
214
214
|
//set target temp based on display mode and ventilation mode
|
|
215
|
-
switch (
|
|
215
|
+
switch (displayType) {
|
|
216
216
|
case 1: //Heather/Cooler
|
|
217
217
|
switch (deviceData.Device.VentilationMode) {
|
|
218
218
|
case 0: //LOSNAY
|