Comments (8)
A long time ago there was a bug where the websocket connection was opened more than once.
But it was fixed.
It would be nice if you can provide a log with the instance running in log level debug, while this is happen.
from iobroker.deconz.
@Jey-Cee
Thanks. Please see log below. It's currently happening again. Let me know if you need more. I am trying to no restart the adapter for the next 24-48 hours.
deconz.0
2022-11-07 12:43:48.368 debug Websocket message: {"e":"changed","id":"37","r":"sensors","state":{"buttonevent":3002,"lastupdated":"2022-11-07T11:43:48.366"},"t":"event","uniqueid":"00:00:00:00:01:75:34:7e-f2"}
deconz.0
2022-11-07 12:43:48.367 debug Websocket message: {"e":"changed","id":"37","r":"sensors","state":{"buttonevent":3002,"lastupdated":"2022-11-07T11:43:48.366"},"t":"event","uniqueid":"00:00:00:00:01:75:34:7e-f2"}
deconz.0
2022-11-07 12:43:48.126 debug Websocket message: {"e":"changed","id":"37","r":"sensors","state":{"buttonevent":3000,"lastupdated":"2022-11-07T11:43:48.125"},"t":"event","uniqueid":"00:00:00:00:01:75:34:7e-f2"}
deconz.0
2022-11-07 12:43:48.126 debug Websocket message: {"e":"changed","id":"37","r":"sensors","state":{"buttonevent":3000,"lastupdated":"2022-11-07T11:43:48.125"},"t":"event","uniqueid":"00:00:00:00:01:75:34:7e-f2"}
deconz.0
2022-11-07 12:43:46.540 debug Event has attr-Tag
deconz.0
2022-11-07 12:43:46.539 debug Websocket message: {"attr":{"id":"15","lastannounced":"2022-10-09T17:23:55Z","lastseen":"2022-11-07T11:43Z","manufacturername":"innr","modelid":"SP 220","name":"Katzenbrunnen","swversion":"2.3","type":"On/Off plug-in unit","uniqueid":"0c:43:14:ff:fe:e0:10:09-01"},"e":"changed","id":"15","r":"lights","t":"event","uniqueid":"0c:43:14:ff:fe:e0:10:09-01"}
deconz.0
2022-11-07 12:43:46.539 debug Event has attr-Tag
deconz.0
2022-11-07 12:43:46.538 debug Websocket message: {"attr":{"id":"15","lastannounced":"2022-10-09T17:23:55Z","lastseen":"2022-11-07T11:43Z","manufacturername":"innr","modelid":"SP 220","name":"Katzenbrunnen","swversion":"2.3","type":"On/Off plug-in unit","uniqueid":"0c:43:14:ff:fe:e0:10:09-01"},"e":"changed","id":"15","r":"lights","t":"event","uniqueid":"0c:43:14:ff:fe:e0:10:09-01"}
deconz.0
2022-11-07 12:43:41.830 debug Websocket message: {"e":"changed","id":"37","r":"sensors","state":{"buttonevent":4002,"lastupdated":"2022-11-07T11:43:41.829"},"t":"event","uniqueid":"00:00:00:00:01:75:34:7e-f2"}
deconz.0
2022-11-07 12:43:41.830 debug Websocket message: {"e":"changed","id":"37","r":"sensors","state":{"buttonevent":4002,"lastupdated":"2022-11-07T11:43:41.829"},"t":"event","uniqueid":"00:00:00:00:01:75:34:7e-f2"}
deconz.0
2022-11-07 12:43:41.639 debug Websocket message: {"e":"changed","id":"37","r":"sensors","state":{"buttonevent":4000,"lastupdated":"2022-11-07T11:43:41.638"},"t":"event","uniqueid":"00:00:00:00:01:75:34:7e-f2"}
deconz.0
2022-11-07 12:43:41.638 debug Websocket message: {"e":"changed","id":"37","r":"sensors","state":{"buttonevent":4000,"lastupdated":"2022-11-07T11:43:41.638"},"t":"event","uniqueid":"00:00:00:00:01:75:34:7e-f2"}
from iobroker.deconz.
But it looks like 2 open connections, as it gets every event twice.
from iobroker.deconz.
Can't we just check on the ws object between 576 and 577 if it's null and, if not, terminate the prior socket before creating a new one?
It's not going to solve the root cause, but it should mitigate the issue, right?
I mean, as far as I can see, this is the only place where a new socket is created. Which means, for whatever reason, either user, host or port is null.
Lines 576 to 577 in 7d3c67c
from iobroker.deconz.
The root cause here is that the adapter renews the websocket connection every 60 seconds, while there is no possibility to check if the connection is still working.
Your idea could be a soulution if the connection wasn't terminated before for any reason.
from iobroker.deconz.
Got it.
How about these lines?
Lines 67 to 73 in 7d3c67c
I think they could be changed to below, getting the 2nd if out of the 1st if:
if(reconnect !== null){ clearTimeout(reconnect); } if(ws !== null){ ws.terminate(); } await getAutoUpdates();
I am not pretty sure. But can't it be that, right at the start of the instance, "reconnect" is not yet initiated but an onStateChange is fired. Leading to a new call to getAutoUpdates(), without terminating the previous connection?
It's not happening often so it must be something happening rarely, maybe based on bad timing.
Or how about putting a ws.terminate(); right in front of below line?
Line 577 in 7d3c67c
from iobroker.deconz.
Does your change work as solution?
from iobroker.deconz.
@Jey-Cee: Yes, looks like. I have no issues since I use my fork.
from iobroker.deconz.
Related Issues (20)
- [Bug]: Sensor wird nicht erkannt HOT 12
- Bridge-Port HOT 5
- [Bug]:Websocket port not configurable HOT 5
- [Bug]: NOUS A1Z Zigbee Steckdosen lassen sich nicht mehr schalten bzw. Änderungen am Schaltzustand werden nicht erkannt HOT 8
- [Issue]: deconz.0.Sensors.Id or deconz.0.sensors.MACAdress HOT 2
- [Bug]: Use latest API - Update needed HOT 11
- [Bug]: DP Level ändert sich nicht auf 0 %, wenn Licht ausgeschaltet wurde HOT 2
- Question: old Adapter Version 2.06 => 2.07 Update HOT 12
- [Idee]: Geräte nach "Type" gruppieren HOT 3
- [Bug]: websocket port problem HOT 4
- [Bug]: Osram Plug is not a light HOT 2
- Update stable version in repo from 1.3.21 to 1.3.22 HOT 1
- [Bug]: Could not connect to websocket instance of deConz/Phoscon. Error: Unexpected server response: 200 HOT 1
- Lagging receiving and sending with Deconz versions above 2.23.02 HOT 1
- [Bug]: Silvercrest Smart Plug TS011F with Measurement of consumption HOT 1
- [Bug]: Einige Objekte funktionieren nicht richtig HOT 2
- Transfer object tree structure "by hardware-id" from 2.0.6 branch into master?
- Update stable version in repo from 1.3.23 to 1.4.0 HOT 3
- Paid or Free - what about release 1.4.0 ? HOT 4
- [Bug]: Adapter crashes without Internet connection HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iobroker.deconz.