* fix start issue
This commit is contained in:
+3
-3
@@ -3,9 +3,9 @@ os:
|
||||
- osx
|
||||
language: node_js
|
||||
node_js:
|
||||
- '4'
|
||||
- '6'
|
||||
- '8'
|
||||
- '12'
|
||||
- '14'
|
||||
- '16'
|
||||
services:
|
||||
- mysql
|
||||
- postgresql
|
||||
|
||||
@@ -23,6 +23,10 @@ Please check it https://www.smarthomejetzt.de/mit-iobroker-auf-eine-home-assista
|
||||
-->
|
||||
|
||||
## Changelog
|
||||
|
||||
### __WORK IN PROGRESS__
|
||||
* (Apollon77) Fix start issue
|
||||
|
||||
### 1.0.0 (2020-12-13)
|
||||
* (bluefox) added the support of compact mode
|
||||
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@ version: 'test-{build}'
|
||||
os: Visual Studio 2013
|
||||
environment:
|
||||
matrix:
|
||||
- nodejs_version: '4'
|
||||
- nodejs_version: '6'
|
||||
- nodejs_version: '8'
|
||||
- nodejs_version: '12'
|
||||
- nodejs_version: '14'
|
||||
- nodejs_version: '16'
|
||||
platform:
|
||||
- x86
|
||||
- x64
|
||||
|
||||
+13
-1
@@ -23,6 +23,7 @@ function HASS(options, log) {
|
||||
const requests = {};
|
||||
let connected;
|
||||
let connectTimeout = null;
|
||||
let closed = false;
|
||||
|
||||
function subscribeEvents(socket, callback) {
|
||||
if (socket && typeof socket.send === 'function') {
|
||||
@@ -184,7 +185,7 @@ function HASS(options, log) {
|
||||
that.emit('disconnected');
|
||||
|
||||
}
|
||||
if (!connectTimeout) {
|
||||
if (!connectTimeout && !closed) {
|
||||
setTimeout(() => {
|
||||
connectTimeout = null;
|
||||
that.connect();
|
||||
@@ -248,6 +249,17 @@ function HASS(options, log) {
|
||||
initSocket(this.socket);
|
||||
};
|
||||
|
||||
this.close = function () {
|
||||
if (connectTimeout) {
|
||||
clearTimeout(connectTimeout);
|
||||
connectTimeout = null;
|
||||
}
|
||||
closed = true;
|
||||
if (this.socket) {
|
||||
this.socket.close();
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user