zilvinasbin / has_domintell

Domintell modules for Home Assistant
MIT License
7 stars 8 forks source link

Lost connection after cable disconnect or after router reboot #6

Open yaccri opened 3 years ago

yaccri commented 3 years ago

After any connection loss to the router, the interface loses the connection to the Domintell devices and do not try to re-establish the connection. Can you ping the Domintell device every 60 seconds, and when response is not received, attempt to re-establish the connection?

dnouls commented 3 years ago

Ah that explains why the integration stops working even though I adjusted the disconnect timeout on my domintell ETH02 module! My switches and router are frequently auto-updated.

yaccri commented 3 years ago

There's already a ping_daemon function in \connections__init__.py. If the calling function will wait for the ping_daemon response and reset communication when no response is received, it should solve the issue.

yaccri commented 3 years ago

I made a simple workaround by changing the "&PING" command with "LOGIN". It seems to solve the problem but I'm not sure if there are any side effects to this. I will report back if I find any related issues.

zilvinasbin commented 3 years ago

I made a simple workaround by changing the "&PING" command with "LOGIN".

Did it work for you now?

zilvinasbin commented 3 years ago

There's already a ping_daemon function in \connectionsinit.py. If the calling function will wait for the ping_daemon response and reset communication when no response is received, it should solve the issue.

I will checkit. I personally never experienced this problem.

yaccri commented 3 years ago

I made a simple workaround by changing the "&PING" command with "LOGIN".

Did it work for you now?

Yes, and I didn't notice any issues.

zilvinasbin commented 3 years ago

&LOGIN returns "INFO:Session opened:INFO" on success, or on error "INFO:Auth failed:INFO" or INFO:Access denied. Close current session:INFO

So it reopens the session for you, or error messages get ignored by the driver.

&PING returns status of all modules. Driver understands these messages and updates status.

So if for some reason Master did not returns the status of the module, &PING forces to send status, and updates info on HA

I think, for now, this quick-fix solves the problem but would be good to update the ping_daemon procedure to include Login on failure. Haven't tested it yet, but because UDP is used here, you may not receive a response at all if the session is closed.

Let's leave this issue open, will try to fix it when have some free time.

dnouls commented 3 years ago

Still suffering from this problem. According to the Domintell protocol documentation you should send a HELLO command to keep the session open.

--- from the docs --- Keep session open To keep session opened, you have to send one command (or LightProtocol string) to DETH02. The best way is to use HELLO command. PING command should be avoid to keep a session opened as it will generate a lot of trafic on Domintell Bus and takes ressources in Master (DGQG01).

HELLO < INFO:World:INFO d) Refresh statuses As said above , PING command must be used carefully. Generally, use it after a LOGIN (if your application has already been configured using APPINFO). PING <... There is not string/flags to notify end of list of statuses.

dnouls commented 2 years ago

Any progress on this issue ? I can only use the domintell integration for a few hours and then it stops working. Is there somewhere good documentation that explains how I can build my own version of this plugin and run it without deploying to a release server ?