mgcrea / homebridge-tydom

Homebridge plugin to manage Tydom hardware by Delta Dore from Apple HomeKit.
63 stars 14 forks source link

Doesn't reconnect to Tydom if connection fail #43

Open myhomeiot opened 3 years ago

myhomeiot commented 3 years ago

Plugin doesn't try to reconnect to Tydom if connection fails. After power outage when plugin started before Tydom finish booting or after plugin get some strange replies from Tydom it's fails and doesn't try to recconect. Will be great if in case of connection problem plugin will try to connect every minute or if this interval will be configured in plugin configuration. Log messages for 2 cases log.txt

StephanH27 commented 3 years ago

I think I have the same problem. My NAS is behind a 4G Box, and the provider stops all connexions every 24h I have to relaunch HomeBridge every day ...

romaindebrito commented 3 years ago

J’ai la même chose, après un laps de temps, Il est nécessaire de redémarrer homebridge voir même d’ouvrir une fois l’application tydom pour que tout reparte correctement.

Une idée ?

mgcrea commented 3 years ago

Strange as there already is an auto-retry in node-tydom-client, and tested as working so I guess this must be an edge case.

You should have logs like:

You should try to update to latest version as I have put a few fixes there.

StephanH27 commented 3 years ago

I've the last version but the problem still exist. But I have a doubt with HomeKit ... Sometimes, on the same WLAN, Siri on my iPhone doesn't have Pb to open my Garage, but HomePod (HomeKit Concentrateur) answers me It can't access My home from Internet ... I really think that 3G/4G access (without public IPv4) is a problem ...

myhomeiot commented 3 years ago

Strange as there already is an auto-retry in node-tydom-client, and tested as working so I guess this must be an edge case.

You should have logs like:

  • Configuring socket reconnection timeout
  • About to attempt to reconnect to hostname

You should try to update to latest version as I have put a few fixes there.

When I report the problem I already was at version 0.19.10

myhomeiot commented 3 years ago

It's stuck one more time, here the log. After I restart homebridge container the plugin connects to Tydom without problems.

mgcrea commented 3 years ago

@myhomeiot Looking at your logs, it looks like you have an unsupported thermostat that is crashing the plugin, I've pushed a fix to v0.20.2you should try it.

myhomeiot commented 3 years ago

Updated to 0.20.2 get message in the log: Failed to properly create the thermostat accesory for device 1545245522, did not found object in array that matches {"name": "thermicLevel"} in [{"name":"localisation","type":"string","permission":"w","enum_values":["START"]},{"name":"modeAsso","type":"string","permission":"w","enum_values":["START"]}]

Device 1545245522 it's not the real thermostat, it's a Tydom repeater like this one TYXIA ERX 1000 it's can be used to extend coverage for any Tydom devices but in my case it's connected to thermostat.

I think plugin should skip this kind of devices.

mgcrea commented 3 years ago

@myhomeiot interesting, any change you could provide config dumps so I can look into it?

You can use https://gist.github.com to post the generated file.

myhomeiot commented 3 years ago

I can confirm that version 0.20.12 (some earlier versions as well) doesn't have this problem, I the log I can see that it's reconnects to Tydom when connection fails (usually happened once per few days): [1/15/2021, 8:44:18 PM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/15/2021, 8:44:24 PM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/16/2021, 1:21:44 PM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/16/2021, 1:21:58 PM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/19/2021, 12:48:08 AM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/19/2021, 12:48:14 AM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/22/2021, 4:17:56 AM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/22/2021, 4:18:02 AM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/22/2021, 4:18:55 AM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/22/2021, 4:19:08 AM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/22/2021, 4:31:44 AM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/22/2021, 4:31:48 AM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/22/2021, 4:31:49 AM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/22/2021, 4:31:55 AM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/23/2021, 2:41:44 AM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/23/2021, 2:41:50 AM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/24/2021, 4:24:46 PM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/24/2021, 4:24:51 PM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/25/2021, 11:05:28 PM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/25/2021, 11:05:33 PM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/25/2021, 11:05:36 PM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/25/2021, 11:05:42 PM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/26/2021, 4:32:51 AM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/26/2021, 4:32:57 AM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/26/2021, 5:18:43 AM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/26/2021, 5:18:47 AM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/29/2021, 3:38:32 PM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/29/2021, 3:38:38 PM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX' [1/29/2021, 8:45:14 PM] [Tydom] Disconnected from Tydom hostname='x.x.x.x'" [1/29/2021, 8:45:30 PM] [Tydom] Successfully connected to Tydom hostname='x.x.x.x' with username='XXXXX'

myhomeiot commented 3 years ago

Today I found that plugin doesn't reconnect to Tydom after following error in the log:

[2/4/2021, 6:09:18 PM] Disconnected from Tydom hostname='x.x.x.x'"
(node:356) UnhandledPromiseRejectionWarning: RequestError: connect EHOSTUNREACH x.x.x.x:443
    at ClientRequest.<anonymous> (/homebridge/node_modules/homebridge-tydom/node_modules/got/dist/source/core/index.js:953:111)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:327:22)
    at ClientRequest.origin.emit (/homebridge/node_modules/homebridge-tydom/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
(node:356) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 52)
(node:356) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.