NickStallman / home-assistant-repo

18 stars 5 forks source link

Watchdog triggered but tries to reconnect only once #25

Open schoppfe opened 2 weeks ago

schoppfe commented 2 weeks ago

Hello,

I am using the Winet Extractor Addon in Home Assistant, with my inverter connected via Wi-Fi. The Wi-Fi connection is unstable, and occasionally, the connection drops. When this happens, the addon's watchdog correctly detects the loss of connection and attempts to reconnect. However, the watchdog seems to only attempt the reconnection once. If that attempt fails, the addon does not retry further.

Below is an excerpt from the logs:

2024-10-09 16:15:20 error: Watchdog triggered, reconnecting 
2024-10-09 16:15:20 warn: Reconnecting to Winet 
2024-10-09 16:17:50 error: Websocket error: connect ETIMEDOUT 192.168.xxx.xxx:8082 {
  errno: -110,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '192.168.xxx.xxx',
  port: 8082,
  stack: 'Error: connect ETIMEDOUT 192.168.xxx.xxx:8082\n' +
    '    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1606:16)',
  [Symbol(level)]: 'error',
  [Symbol(splat)]: [
    Error: connect ETIMEDOUT 192.168.xxx.xxx:8082
        at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1606:16) {
      errno: -110,
      code: 'ETIMEDOUT',
      syscall: 'connect',
      address: '192.168.xxx.xxx',
      port: 8082
    }
  ]
}
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
2024-10-09 16:31:00 info: Configured sensor: SH20T_xxxxxxxxxx total_pv_yield 
2024-10-09 16:31:00 info: Configured sensor: SH20T_xxxxxxxxxx [...]

After this, the addon does not attempt further reconnections. The only way to recover is by manually restarting the addon, which then works perfectly.

Would it be possible to add a retry mechanism that attempts to reconnect multiple times if the first attempt fails?

Thank you for your time and for the great work on this addon!

Best regards, schoppfe

baylockzathras commented 5 days ago

Experiencing the same here, when i restart my router, addon looses connection, but does not seem to recover. Restartng addon also resolves problem.