@smarterhomeapp/homebridge-vantage 1.0.1 → 1.0.2
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/dist/platform.js +1 -1
- package/dist/settings.d.ts +1 -1
- package/dist/settings.js +1 -1
- package/dist/vantageInfusion.js +37 -7
- package/package.json +1 -1
package/dist/platform.js
CHANGED
|
@@ -219,7 +219,7 @@ class VantagePlatform {
|
|
|
219
219
|
const svc = acc.getService(S.Thermostat);
|
|
220
220
|
if (!svc || !dev)
|
|
221
221
|
return;
|
|
222
|
-
this.log.
|
|
222
|
+
this.log.debug(`thermostatIndoorModeChange (VID=${vid}, Name=${dev.name}, Mode=${mode}, TargetTemp=${targetTemp})`);
|
|
223
223
|
// this.log.info(`Before update - dev.mode=${dev.mode}, dev.targetTemp=${dev.targetTemp}, dev.heating=${dev.heating}, dev.cooling=${dev.cooling}`);
|
|
224
224
|
if (targetTemp === -1) {
|
|
225
225
|
// Only update mode when targetTemp is -1 (mode change without temperature)
|
package/dist/settings.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PLUGIN_NAME = "homebridge-vantage";
|
|
1
|
+
export declare const PLUGIN_NAME = "@smarterhomeapp/homebridge-vantage";
|
|
2
2
|
export declare const PLATFORM_NAME = "VantageControls";
|
package/dist/settings.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PLATFORM_NAME = exports.PLUGIN_NAME = void 0;
|
|
4
|
-
exports.PLUGIN_NAME = 'homebridge-vantage';
|
|
4
|
+
exports.PLUGIN_NAME = '@smarterhomeapp/homebridge-vantage';
|
|
5
5
|
exports.PLATFORM_NAME = 'VantageControls';
|
package/dist/vantageInfusion.js
CHANGED
|
@@ -93,8 +93,13 @@ class VantageInfusion extends events_1.EventEmitter {
|
|
|
93
93
|
this.isInsecureCfg = false;
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
// Probe sequentially to avoid controller session limits
|
|
97
|
+
const cmdResult = await this.portUsable(3001, 'STATUS ALL\n');
|
|
98
|
+
// brief backoff before probing config port
|
|
99
|
+
await new Promise((r) => setTimeout(r, 150));
|
|
100
|
+
const cfgResult = await this.portUsable(2001, '<IIntrospection><GetInterfaces><call></call></GetInterfaces></IIntrospection>\n');
|
|
101
|
+
this.isInsecureCmd = !!cmdResult;
|
|
102
|
+
this.isInsecureCfg = !!cfgResult;
|
|
98
103
|
}
|
|
99
104
|
// Legacy-style port logs
|
|
100
105
|
this.opts.log.info(this.isInsecureCmd ? 'Using insecure port: 3001' : 'Using SSL port: 3010');
|
|
@@ -104,21 +109,46 @@ class VantageInfusion extends events_1.EventEmitter {
|
|
|
104
109
|
portUsable(port, probe) {
|
|
105
110
|
return new Promise((resolve) => {
|
|
106
111
|
let sawData = false;
|
|
112
|
+
this.opts.log.debug(`Testing ${this.opts.ipaddress}:${port} with probe: "${probe.trim()}"`);
|
|
107
113
|
const sock = net.connect({ host: this.opts.ipaddress, port }, () => {
|
|
114
|
+
this.opts.log.debug(`Connected to ${this.opts.ipaddress}:${port}`);
|
|
115
|
+
// improve send behavior
|
|
116
|
+
sock.setNoDelay(true);
|
|
117
|
+
// keep a post-connect timeout; fail if no reply in time
|
|
118
|
+
sock.setTimeout(8000);
|
|
119
|
+
// write immediately
|
|
120
|
+
this.opts.log.debug(`Sending initial probe on port ${port}`);
|
|
108
121
|
sock.write(probe);
|
|
122
|
+
// send a second probe shortly after to coax a response
|
|
123
|
+
setTimeout(() => {
|
|
124
|
+
if (!sawData) {
|
|
125
|
+
this.opts.log.debug(`Re-sending probe on port ${port}`);
|
|
126
|
+
sock.write(probe);
|
|
127
|
+
}
|
|
128
|
+
}, 150);
|
|
129
|
+
});
|
|
130
|
+
sock.once('connect', () => {
|
|
131
|
+
this.opts.log.debug(`Port ${port} connection established`);
|
|
109
132
|
});
|
|
110
|
-
sock.
|
|
111
|
-
|
|
112
|
-
|
|
133
|
+
sock.on('data', (data) => {
|
|
134
|
+
const text = data.toString();
|
|
135
|
+
this.opts.log.debug(`Port ${port} received data: ${text.slice(0, 200).replace(/\r/g, '\\r').replace(/\n/g, '\\n')}`);
|
|
113
136
|
sawData = true;
|
|
114
137
|
resolve(true);
|
|
115
138
|
sock.destroy();
|
|
116
139
|
});
|
|
140
|
+
sock.on('timeout', () => {
|
|
141
|
+
this.opts.log.debug(`Port ${port} post-connect timeout`);
|
|
142
|
+
sock.destroy();
|
|
143
|
+
});
|
|
117
144
|
sock.on('close', () => {
|
|
145
|
+
this.opts.log.debug(`Port ${port} closed, sawData: ${sawData}`);
|
|
118
146
|
if (!sawData)
|
|
119
147
|
resolve(false);
|
|
120
148
|
});
|
|
121
|
-
sock.on('error', () => {
|
|
149
|
+
sock.on('error', (err) => {
|
|
150
|
+
const msg = err instanceof Error ? `${err.code || ''} ${err.message}` : String(err);
|
|
151
|
+
this.opts.log.debug(`Port ${port} error: ${msg}`);
|
|
122
152
|
/* resolve on close path */
|
|
123
153
|
});
|
|
124
154
|
});
|
|
@@ -573,7 +603,7 @@ class VantageInfusion extends events_1.EventEmitter {
|
|
|
573
603
|
}
|
|
574
604
|
});
|
|
575
605
|
socket.on('close', () => {
|
|
576
|
-
this.opts.log.
|
|
606
|
+
this.opts.log.debug("closing " + shouldBreak);
|
|
577
607
|
if (!finishOnce._done && readObjects.length) {
|
|
578
608
|
const xml = '<Project><Objects>' +
|
|
579
609
|
readObjects.map((o) => {
|