simple-sonoff-server icon indicating copy to clipboard operation
simple-sonoff-server copied to clipboard

Disconnects exactly after one minute and never connects again

Open juancgalvez opened this issue 7 years ago • 7 comments

I tried with node-red-contrib-sonoff-server and noticed that after exactly one minute the device times out and disconnects.

Then I installed your software and the same thing happens exactly one minute after the device connects for the first time, and never reconnects again.

This is what I get:

SONOFF Server Started On Port 1080 API Server Started On Port 1081 WS | Server is up 192.168.7.118:1443 to ::ffff:192.168.7.108:27428 REQ | WS | DEV | {"userAgent":"device","apikey":"22d634b7-6a4b-4253-be7d-7835fcc213ad","deviceid":"100000xxxx","action":"register","version":2,"romVersion":"1.2.0","model":"ITA-GZ1-GL","ts":206} INFO | WS | Device 100000xxxx registered RES | WS | DEV | {"error":0,"deviceid":"100000xxxx","apikey":"111111111-1111-1111-1111-111111111111"} REQ | WS | DEV | {"userAgent":"device","apikey":"111111111-1111-1111-1111-11111111111","deviceid":"100000xxxx","action":"date"} RES | WS | DEV | {"error":0,"deviceid":"100000xxxx","apikey":"111111111-1111-1111-1111-111111111111","date":"2018-05-24T21:23:42.314Z"} REQ | WS | DEV | {"userAgent":"device","apikey":"111111111-1111-1111-1111-11111111111","deviceid":"100000xxxx","action":"update","params":{"switch":"off","fwVersion":"1.2.0"}} RES | WS | DEV | {"error":0,"deviceid":"100000xxxx","apikey":"111111111-1111-1111-1111-111111111111"} REQ | WS | DEV | {"userAgent":"device","apikey":"111111111-1111-1111-1111-11111111111","deviceid":"100000xxxx","action":"query","params":["timers"]} RES | WS | DEV | {"error":0,"deviceid":"100000xxxx","apikey":"111111111-1111-1111-1111-111111111111","params":{}} Connection closed: connection timed out (408) Device 100000xxxx disconnected

I replaced my device's last four digits with xxxx.

What could be wrong?

juancgalvez avatar May 24 '18 21:05 juancgalvez

I was having the same problem on m Raspberry pi 3. So I changed to Windows and now the disconnection rate is much, much less.

pabloalcantara avatar May 25 '18 18:05 pabloalcantara

Thank you for your reply.

I upgraded my Sonoff to firmware version 1.6 and everything stopped working. The device didn't even connect to itead's server.

Finally, I flashed Espurna and everything is working fine with Node-red using MQTT and HTTP API.

juancgalvez avatar May 26 '18 02:05 juancgalvez

It looks like the updated firmware does an SSL certificate validation, so it will not work.

ricardojlrufino avatar Jun 08 '18 14:06 ricardojlrufino

On disconnecting every time, it happens to me too ... Even in the Java implementation I did. But, it reconnects again ... but this seems to me to be a problem

It seems to me that some PING / PONG control is missing in particular.

ricardojlrufino avatar Jun 08 '18 14:06 ricardojlrufino

@juancgalvez upgrading to 1.6 will break the the used interface due to a verified ssl certificate mirko/SonOTA#58 #6

mdopp avatar Jun 08 '18 14:06 mdopp

@ricardojlrufino I would search for the disconnects inside your local network or an software. Using OpenHab on a Raspberry runs fine, without unexpected disconnects

mdopp avatar Jun 08 '18 14:06 mdopp

I implemented a java version, and a fixed a BUG in PING, because it have no data... A library I used had this problem

ricardojlrufino avatar Jun 12 '18 02:06 ricardojlrufino