sj26 / homebridge-intesisbox

Homebridge plugin for Intesisbox gateways
MIT License
2 stars 4 forks source link

Connection Keeps Closing #3

Open kadevv opened 3 years ago

kadevv commented 3 years ago

Hello, my bridge keeps closing the connection and it messes around with some automations I have how can I stop the connection from closing. [23/01/2021, 18:17:29] [Thermostat] Connection closed, reconnecting in 5 seconds [23/01/2021, 18:17:34] [Thermostat] Connecting to Intesisbox at 10.0.1.120:3310 [23/01/2021, 18:17:34] [Thermostat] Device turned ON [23/01/2021, 18:17:34] [Thermostat] Device set to COOL mode [23/01/2021, 18:17:34] [Thermostat] Device fanspeed set to: AUTO [23/01/2021, 18:17:34] [Thermostat] Device vertical vane set to: 2 [23/01/2021, 18:17:34] [Thermostat] Device target temperature set to: 240 [23/01/2021, 18:17:34] [Thermostat] Device ambient temperature now: 270 [23/01/2021, 18:17:34] [Thermostat] Device error status: OK [23/01/2021, 18:17:34] [Thermostat] Device error code: 0

Thanks, KAV

sj26 commented 3 years ago

Sorry, I'm not sure. The plugin itself shouldn't issue commands without being told to by homebridge (or HomeKit).

Red1994 commented 3 years ago

I have the same behavior. It seems that the intesisbox closes the connection if inactive for 2 min. The intesisbox protocol suggests a PING at 1 min intervals to keep to connection open. I am not sure how to get the plugin to PING the intesisbox at 1 min intervals.

Red1994 commented 2 years ago

I have added code on my installation to ping the intesisbox every 90 seconds. This keeps the connection open and avoids reconnection. I was previously experiencing non responsive command on first try (but it caused a reconnection) and then responsive command on the second try. With this change I am now getting consistent responsive commands on first try. Additions to the code in BOLD

this.connect();

this.ping();   }   // Device communications   connect(callback) { this.buffer = ""; this.log("Connecting to Intesisbox at "+this.host+":"+this.port) this.socket = net.connect(this.port, this.host, this.onSocketConnect.bind(this)); this.socket.on("error", this.onSocketError.bind(this)); this.socket.on("close", this.onSocketClose.bind(this)); this.socket.on("line", this.onSocketLine.bind(this)); this.socket.on("data", this.onSocketData.bind(this)); }   ping(callback) { setInterval(function() { this.log("Ping"); this.send("PING"); }.bind(this), 90000); }

carbonappsx commented 2 years ago

I have added code on my installation to ping the intesisbox every 90 seconds. This keeps the connection open and avoids reconnection. I was previously experiencing non responsive command on first try (but it caused a reconnection) and then responsive command on the second try. With this change I am now getting consistent responsive commands on first try. Additions to the code in BOLD

this.connect();

this.ping();   }   // Device communications   connect(callback) { this.buffer = ""; this.log("Connecting to Intesisbox at "+this.host+":"+this.port) this.socket = net.connect(this.port, this.host, this.onSocketConnect.bind(this)); this.socket.on("error", this.onSocketError.bind(this)); this.socket.on("close", this.onSocketClose.bind(this)); this.socket.on("line", this.onSocketLine.bind(this)); this.socket.on("data", this.onSocketData.bind(this)); }   ping(callback) { setInterval(function() { this.log("Ping"); this.send("PING"); }.bind(this), 90000); }

Where do I add this code?

Red1994 commented 2 years ago

I added the code highlighted in green below:

On 11 Aug 2022, at 3:23 pm, carbonappsx @.***> wrote:

I have added code on my installation to ping the intesisbox every 90 seconds. This keeps the connection open and avoids reconnection. I was previously experiencing non responsive command on first try (but it caused a reconnection) and then responsive command on the second try. With this change I am now getting consistent responsive commands on first try. Additions to the code in BOLD

this.connect();

this.ping(); } // Device communications connect(callback) { this.buffer = ""; this.log("Connecting to Intesisbox at "+this.host+":"+this.port) this.socket = net.connect(this.port, this.host, this.onSocketConnect.bind(this)); this.socket.on("error", this.onSocketError.bind(this)); this.socket.on("close", this.onSocketClose.bind(this)); this.socket.on("line", this.onSocketLine.bind(this)); this.socket.on("data", this.onSocketData.bind(this)); } ping(callback) { setInterval(function() { this.log("Ping"); this.send("PING"); }.bind(this), 90000); }

Where do I add this code?

— Reply to this email directly, view it on GitHub https://github.com/sj26/homebridge-intesisbox/issues/3#issuecomment-1211563247, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIRYTSW5JPWATYQT4XZQ4NDVYSE3JANCNFSM4WPO7NDA. You are receiving this because you commented.

Red1994 commented 2 years ago

I have a macOS set up and I added the code to the file:

homebridge-intesisbox

located at:

/usr/local/lib/node_modules

Except below (added lines highlighted in green):

On 11 Aug 2022, at 3:31 pm, Peter Crawford @.***> wrote:

I added the code highlighted in green below:

> On 11 Aug 2022, at 3:23 pm, carbonappsx ***@***.*** ***@***.***>> wrote: > > > I have added code on my installation to ping the intesisbox every 90 seconds. This keeps the connection open and avoids reconnection. I was previously experiencing non responsive command on first try (but it caused a reconnection) and then responsive command on the second try. With this change I am now getting consistent responsive commands on first try. Additions to the code in BOLD > > this.connect(); > > this.ping(); } // Device communications connect(callback) { this.buffer = ""; this.log("Connecting to Intesisbox at "+this.host+":"+this.port) this.socket = net.connect(this.port, this.host, this.onSocketConnect.bind(this)); this.socket.on("error", this.onSocketError.bind(this)); this.socket.on("close", this.onSocketClose.bind(this)); this.socket.on("line", this.onSocketLine.bind(this)); this.socket.on("data", this.onSocketData.bind(this)); } ping(callback) { setInterval(function() { this.log("Ping"); this.send("PING"); }.bind(this), 90000); } > > Where do I add this code? > > — > Reply to this email directly, view it on GitHub , or unsubscribe . > You are receiving this because you commented. >