@smarterhomeapp/homebridge-vantage 1.0.2 → 1.0.3
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 +7 -5
- package/dist/vantageInfusion.d.ts +4 -0
- package/dist/vantageInfusion.js +24 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Homebridge Vantage Controls
|
|
2
|
+
[](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
|
|
2
3
|
|
|
3
|
-
A [Homebridge](https://homebridge.io/) plugin for Vantage Controls InFusion system.
|
|
4
|
+
A [Homebridge](https://homebridge.io/) plugin for Vantage Controls InFusion system.
|
|
5
|
+
This plugin replaces the one sold on smarterhome.io allowing anyone to download on the platform of their choice.
|
|
4
6
|
|
|
5
7
|
## Features
|
|
6
8
|
|
|
@@ -20,7 +22,7 @@ npm install -g homebridge
|
|
|
20
22
|
|
|
21
23
|
2. Install this plugin:
|
|
22
24
|
```bash
|
|
23
|
-
npm install -g homebridge-vantage
|
|
25
|
+
npm install -g @smarterhomeapp/homebridge-vantage
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
3. Add the platform to your `config.json`:
|
|
@@ -74,7 +76,7 @@ npm install -g homebridge-vantage
|
|
|
74
76
|
|
|
75
77
|
1. Clone the repository:
|
|
76
78
|
```bash
|
|
77
|
-
git clone https://github.com/
|
|
79
|
+
git clone https://github.com/smarterhomeapp/homebridge-vantage.git
|
|
78
80
|
cd homebridge-vantage
|
|
79
81
|
```
|
|
80
82
|
|
|
@@ -125,5 +127,5 @@ MIT License - see LICENSE file for details.
|
|
|
125
127
|
## Support
|
|
126
128
|
|
|
127
129
|
For issues and questions:
|
|
128
|
-
- [GitHub Issues](https://github.com/
|
|
129
|
-
- [Homebridge Community](https://github.com/homebridge/homebridge)
|
|
130
|
+
- [GitHub Issues](https://github.com/smarterhomeapp/homebridge-vantage/issues)
|
|
131
|
+
- [Homebridge Community](https://github.com/homebridge/homebridge)
|
|
@@ -29,6 +29,10 @@ export declare class VantageInfusion extends EventEmitter {
|
|
|
29
29
|
/** XML/config discovery; returns devices (replaces old Discover/DiscoverSSL) */
|
|
30
30
|
discoverDevices(): Promise<VantageDevice[]>;
|
|
31
31
|
private processConfigurationXml;
|
|
32
|
+
/** Escape text for XML (same as sanitize in index.js). */
|
|
33
|
+
private static escapeXml;
|
|
34
|
+
/** Build cache XML from readObjects (same structure + sanitization as original index.js). */
|
|
35
|
+
private buildCacheXml;
|
|
32
36
|
private pullConfigurationXml;
|
|
33
37
|
setBrightness(vid: string, level: number): Promise<void>;
|
|
34
38
|
setHue(vid: string, hue: number): Promise<void>;
|
package/dist/vantageInfusion.js
CHANGED
|
@@ -48,6 +48,7 @@ const TYPE_THERMO = [
|
|
|
48
48
|
'Tekmar.tN4_Gateway_482_Zone_-_Slab_Only_CHILD',
|
|
49
49
|
'Tekmar.tN4_Gateway_482_Zone_CHILD',
|
|
50
50
|
'Legrand.MH_HVAC_Control_CHILD',
|
|
51
|
+
'Vantage.HVAC-IU-Zone_CHILD'
|
|
51
52
|
];
|
|
52
53
|
const TYPE_BLIND = [
|
|
53
54
|
'Blind',
|
|
@@ -413,6 +414,25 @@ class VantageInfusion extends events_1.EventEmitter {
|
|
|
413
414
|
}
|
|
414
415
|
return filtered;
|
|
415
416
|
}
|
|
417
|
+
/** Escape text for XML (same as sanitize in index.js). */
|
|
418
|
+
static escapeXml(s) {
|
|
419
|
+
return String(s)
|
|
420
|
+
.replace(/&/g, '&')
|
|
421
|
+
.replace(/</g, '<')
|
|
422
|
+
.replace(/>/g, '>')
|
|
423
|
+
.replace(/"/g, '"')
|
|
424
|
+
.replace(/'/g, ''');
|
|
425
|
+
}
|
|
426
|
+
/** Build cache XML from readObjects (same structure + sanitization as original index.js). */
|
|
427
|
+
buildCacheXml(readObjects) {
|
|
428
|
+
const frag = readObjects.map((o) => {
|
|
429
|
+
const k = Object.keys(o)[0];
|
|
430
|
+
const v = o[k];
|
|
431
|
+
const body = Object.keys(v).map((kk) => `<${kk}>${VantageInfusion.escapeXml(String(v[kk]))}</${kk}>`).join('');
|
|
432
|
+
return `<Object><${k}>${body}</${k}></Object>`;
|
|
433
|
+
}).join('');
|
|
434
|
+
return `<Project><Objects>${frag}</Objects></Project>`;
|
|
435
|
+
}
|
|
416
436
|
pullConfigurationXml() {
|
|
417
437
|
return new Promise((resolve) => {
|
|
418
438
|
const finishOnce = (socket, xml) => {
|
|
@@ -456,15 +476,7 @@ class VantageInfusion extends events_1.EventEmitter {
|
|
|
456
476
|
return;
|
|
457
477
|
}
|
|
458
478
|
if (readObjects.length && Date.now() - lastProgress > 2000) {
|
|
459
|
-
|
|
460
|
-
const xml = '<Project><Objects>' +
|
|
461
|
-
readObjects.map((o) => {
|
|
462
|
-
const k = Object.keys(o)[0];
|
|
463
|
-
const v = o[k];
|
|
464
|
-
const body = Object.keys(v).map((kk) => `<${kk}>${String(v[kk])}</${kk}>`).join('');
|
|
465
|
-
return `<Object><${k}>${body}</${k}></Object>`;
|
|
466
|
-
}).join('') +
|
|
467
|
-
'</Objects></Project>';
|
|
479
|
+
const xml = this.buildCacheXml(readObjects);
|
|
468
480
|
clearInterval(watchdog);
|
|
469
481
|
finishOnce(socket, xml);
|
|
470
482
|
}
|
|
@@ -572,14 +584,7 @@ class VantageInfusion extends events_1.EventEmitter {
|
|
|
572
584
|
}
|
|
573
585
|
// ----- END CONDITION -----
|
|
574
586
|
if (shouldBreak) {
|
|
575
|
-
const xml =
|
|
576
|
-
readObjects.map((o) => {
|
|
577
|
-
const k = Object.keys(o)[0];
|
|
578
|
-
const v = o[k];
|
|
579
|
-
const body = Object.keys(v).map((kk) => `<${kk}>${String(v[kk])}</${kk}>`).join('');
|
|
580
|
-
return `<Object><${k}>${body}</${k}></Object>`;
|
|
581
|
-
}).join('') +
|
|
582
|
-
'</Objects></Project>';
|
|
587
|
+
const xml = this.buildCacheXml(readObjects);
|
|
583
588
|
clearLoginFallback();
|
|
584
589
|
clearInterval(watchdog);
|
|
585
590
|
finishOnce(socket, xml);
|
|
@@ -589,14 +594,7 @@ class VantageInfusion extends events_1.EventEmitter {
|
|
|
589
594
|
socket.on('end', () => {
|
|
590
595
|
this.opts.log.info("ending" + shouldBreak);
|
|
591
596
|
if (!finishOnce._done && readObjects.length) {
|
|
592
|
-
const xml =
|
|
593
|
-
readObjects.map((o) => {
|
|
594
|
-
const k = Object.keys(o)[0];
|
|
595
|
-
const v = o[k];
|
|
596
|
-
const body = Object.keys(v).map((kk) => `<${kk}>${String(v[kk])}</${kk}>`).join('');
|
|
597
|
-
return `<Object><${k}>${body}</${k}></Object>`;
|
|
598
|
-
}).join('') +
|
|
599
|
-
'</Objects></Project>';
|
|
597
|
+
const xml = this.buildCacheXml(readObjects);
|
|
600
598
|
clearLoginFallback();
|
|
601
599
|
clearInterval(watchdog);
|
|
602
600
|
finishOnce(socket, xml);
|
|
@@ -605,14 +603,7 @@ class VantageInfusion extends events_1.EventEmitter {
|
|
|
605
603
|
socket.on('close', () => {
|
|
606
604
|
this.opts.log.debug("closing " + shouldBreak);
|
|
607
605
|
if (!finishOnce._done && readObjects.length) {
|
|
608
|
-
const xml =
|
|
609
|
-
readObjects.map((o) => {
|
|
610
|
-
const k = Object.keys(o)[0];
|
|
611
|
-
const v = o[k];
|
|
612
|
-
const body = Object.keys(v).map((kk) => `<${kk}>${String(v[kk])}</${kk}>`).join('');
|
|
613
|
-
return `<Object><${k}>${body}</${k}></Object>`;
|
|
614
|
-
}).join('') +
|
|
615
|
-
'</Objects></Project>';
|
|
606
|
+
const xml = this.buildCacheXml(readObjects);
|
|
616
607
|
clearLoginFallback();
|
|
617
608
|
clearInterval(watchdog);
|
|
618
609
|
finishOnce(socket, xml);
|