homebridge-melcloud-control 2.5.0-beta.40 → 2.5.0-beta.42
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/config.schema.json +21 -27
- package/homebridge-ui/public/index.html +14 -13
- package/package.json +1 -1
package/config.schema.json
CHANGED
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
"description": "Here select the language used in MELCloud account.",
|
|
206
206
|
"required": true
|
|
207
207
|
},
|
|
208
|
-
"
|
|
208
|
+
"ataDevices": {
|
|
209
209
|
"title": "Devices ATA",
|
|
210
210
|
"type": "array",
|
|
211
211
|
"items": {
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
},
|
|
259
259
|
"required": false
|
|
260
260
|
},
|
|
261
|
-
"
|
|
261
|
+
"atwDevices": {
|
|
262
262
|
"title": "Devices ATW",
|
|
263
263
|
"type": "array",
|
|
264
264
|
"items": {
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
},
|
|
313
313
|
"required": false
|
|
314
314
|
},
|
|
315
|
-
"
|
|
315
|
+
"ervDevices": {
|
|
316
316
|
"title": "Devices ERV",
|
|
317
317
|
"type": "array",
|
|
318
318
|
"items": {
|
|
@@ -1591,15 +1591,15 @@
|
|
|
1591
1591
|
"title": "Air Conditioner",
|
|
1592
1592
|
"items": [
|
|
1593
1593
|
{
|
|
1594
|
-
"key": "accounts[].
|
|
1594
|
+
"key": "accounts[].ataDevices",
|
|
1595
1595
|
"type": "tabarray",
|
|
1596
1596
|
"title": "{{ value.name }}",
|
|
1597
1597
|
"items": [
|
|
1598
|
-
"accounts[].
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
"
|
|
1602
|
-
|
|
1598
|
+
"accounts[].ataDevices[].name",
|
|
1599
|
+
"accounts[].ataDevices[].id",
|
|
1600
|
+
"accounts[].ataDevices[].type",
|
|
1601
|
+
"accounts[].ataDevices[].displayMode"
|
|
1602
|
+
]
|
|
1603
1603
|
},
|
|
1604
1604
|
"accounts[].ataDisplayMode",
|
|
1605
1605
|
"accounts[].ataPresets",
|
|
@@ -1671,18 +1671,15 @@
|
|
|
1671
1671
|
"title": "Heat Pump",
|
|
1672
1672
|
"items": [
|
|
1673
1673
|
{
|
|
1674
|
-
"key": "accounts[].
|
|
1674
|
+
"key": "accounts[].atwDevices",
|
|
1675
1675
|
"type": "tabarray",
|
|
1676
1676
|
"title": "{{ value.name }}",
|
|
1677
1677
|
"items": [
|
|
1678
|
-
"accounts[].
|
|
1679
|
-
"accounts[].
|
|
1680
|
-
"accounts[].
|
|
1681
|
-
"accounts[].
|
|
1682
|
-
]
|
|
1683
|
-
"condition": {
|
|
1684
|
-
"functionBody": "return model.accounts[arrayIndices].devicesAtw.length > 0"
|
|
1685
|
-
}
|
|
1678
|
+
"accounts[].atwDevices[].name",
|
|
1679
|
+
"accounts[].atwDevices[].id",
|
|
1680
|
+
"accounts[].atwDevices[].type",
|
|
1681
|
+
"accounts[].atwDevices[].displayMode"
|
|
1682
|
+
]
|
|
1686
1683
|
},
|
|
1687
1684
|
"accounts[].atwDisplayMode",
|
|
1688
1685
|
"accounts[].atwPresets",
|
|
@@ -1749,18 +1746,15 @@
|
|
|
1749
1746
|
"title": "Energy Recovery Ventilation",
|
|
1750
1747
|
"items": [
|
|
1751
1748
|
{
|
|
1752
|
-
"key": "accounts[].
|
|
1749
|
+
"key": "accounts[].ervDevices",
|
|
1753
1750
|
"type": "tabarray",
|
|
1754
1751
|
"title": "{{ value.name }}",
|
|
1755
1752
|
"items": [
|
|
1756
|
-
"accounts[].
|
|
1757
|
-
"accounts[].
|
|
1758
|
-
"accounts[].
|
|
1759
|
-
"accounts[].
|
|
1760
|
-
]
|
|
1761
|
-
"condition": {
|
|
1762
|
-
"functionBody": "return model.accounts[arrayIndices].devicesErv.length > 0"
|
|
1763
|
-
}
|
|
1753
|
+
"accounts[].ervDevices[].name",
|
|
1754
|
+
"accounts[].ervDevices[].id",
|
|
1755
|
+
"accounts[].ervDevices[].type",
|
|
1756
|
+
"accounts[].ervDevices[].displayMode"
|
|
1757
|
+
]
|
|
1764
1758
|
},
|
|
1765
1759
|
"accounts[].ervDisplayMode",
|
|
1766
1760
|
"accounts[].ervPresets",
|
|
@@ -147,31 +147,32 @@
|
|
|
147
147
|
const info = response.info ?? '';
|
|
148
148
|
const status = response.status;
|
|
149
149
|
const devices = response.data ?? [];
|
|
150
|
-
const
|
|
151
|
-
const typeAtw = [];
|
|
152
|
-
const typeErv = [];
|
|
150
|
+
const newDevices = [];
|
|
153
151
|
|
|
154
152
|
switch (status) {
|
|
155
153
|
case 0:
|
|
156
|
-
const devicesCount = devices.length;
|
|
157
|
-
document.getElementById('info').innerHTML = `Success, found ${devicesCount} ${devicesCount !== 1 ? 'devices' : 'device'}. Now You can start to configure it.`;
|
|
158
|
-
document.getElementById('info').style.color = 'green';
|
|
159
|
-
|
|
160
154
|
//get device info fom devices
|
|
161
155
|
devices.forEach((deviceInfo, index) => {
|
|
162
156
|
const deviceType = deviceInfo.Type;
|
|
163
157
|
const deviceId = deviceInfo.DeviceID;
|
|
164
158
|
const deviceName = deviceInfo.DeviceName;
|
|
159
|
+
const ataDevices = pluginConfig[0].accounts[this.deviceIndex].ataDevices;
|
|
160
|
+
const atwDevices = pluginConfig[0].accounts[this.deviceIndex].atwDevices;
|
|
161
|
+
const ervDevices = pluginConfig[0].accounts[this.deviceIndex].ervDevices;
|
|
162
|
+
const ataDeviceIdExist = ataDevices.some(device => device.id === deviceId)
|
|
163
|
+
const atwDeviceIdExist = atwDevices.some(device => device.id === deviceId)
|
|
164
|
+
const ervDeviceIdExist = ervDevices.some(device => device.id === deviceId)
|
|
165
|
+
const pushNewDevice = !deviceIdExist ? newDevices.push(deviceId) : false;
|
|
165
166
|
|
|
166
167
|
const device = { name: deviceName, id: deviceId, type: deviceType, displayMode: 0 };
|
|
167
|
-
const pushTypeAta = deviceType === 0 ?
|
|
168
|
-
const pushTypeAtw = deviceType === 1 ?
|
|
169
|
-
const pushTypeErv = deviceType === 3 ?
|
|
168
|
+
const pushTypeAta = deviceType === 0 && !ataDeviceIdExist ? ataDevices.push(device) : false;
|
|
169
|
+
const pushTypeAtw = deviceType === 1 && !atwDeviceIdExist ? atwDevices.push(device) : false;
|
|
170
|
+
const pushTypeErv = deviceType === 3 && !ervDeviceIdExist ? ervDevices.push(device) : false;
|
|
170
171
|
});
|
|
171
172
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
const devicesCount = newDevices.length;
|
|
174
|
+
document.getElementById('info').innerHTML = `Success, found ${devicesCount} ${devicesCount !== 1 ? 'new devices' : 'new device'}. Now You can start to configure it.`;
|
|
175
|
+
document.getElementById('info').style.color = 'green';
|
|
175
176
|
|
|
176
177
|
await homebridge.updatePluginConfig(pluginConfig);
|
|
177
178
|
await homebridge.savePluginConfig(pluginConfig);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "2.5.0-beta.
|
|
4
|
+
"version": "2.5.0-beta.42",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|