gadget-monk / homebridge-poolcontroller

Homebridge plugin for Pentair pools
6 stars 4 forks source link

Plugin Taking down Homebridge #16

Open arrmo opened 1 year ago

arrmo commented 1 year ago

Hi,

The machine that I have running njsPC happened to go down (power outage), but that in turn took down my Homebridge install - yikes! 😆. Here is the error that kept showing up in the Homebridge log ... seems to be due to this plugin? When the njsPC was turned back on ... all back to normal.

[1/26/2023, 6:22:39 AM] [PoolControllerPlatform] Error fetching data: connect EHOSTUNREACH 192.168.2.125:4200
[1/26/2023, 6:22:39 AM] Error: connect EHOSTUNREACH 192.168.2.125:4200
    at Function.AxiosError.from (/usr/lib/node_modules/axios/lib/core/AxiosError.js:89:14)
    at RedirectableRequest.handleRequestError (/usr/lib/node_modules/axios/lib/adapters/http.js:533:25)
    at RedirectableRequest.emit (node:events:390:28)
    at ClientRequest.eventHandlers.<computed> (/usr/lib/node_modules/follow-redirects/index.js:14:24)
    at ClientRequest.emit (node:events:390:28)
    at Socket.socketErrorListener (node:_http_client:447:9)
    at Socket.emit (node:events:390:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
[1/26/2023, 6:22:39 am] [SmartThings-v2] ERROR: uncaughtException: connect EHOSTUNREACH 192.168.2.125:4200
Error: connect EHOSTUNREACH 192.168.2.125:4200
    at Function.AxiosError.from (/usr/lib/node_modules/axios/lib/core/AxiosError.js:89:14)
    at RedirectableRequest.handleRequestError (/usr/lib/node_modules/axios/lib/adapters/http.js:533:25)
    at RedirectableRequest.emit (node:events:390:28)
    at ClientRequest.eventHandlers.<computed> (/usr/lib/node_modules/follow-redirects/index.js:14:24)
    at ClientRequest.emit (node:events:390:28)
    at Socket.socketErrorListener (node:_http_client:447:9)
    at Socket.emit (node:events:390:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
[1/26/2023, 6:22:39 AM] Got SIGTERM, shutting down Homebridge...

Thoughts?

Thanks!

kurtifier commented 9 months ago

I have a similar issue where if the pool controller hasn't started, it forces homebridge to reboot.

justinharrell commented 5 months ago

Went through same thing, there is no error handling on: https://github.com/gadget-monk/homebridge-poolcontroller/blob/59c44d5451d65422e5116784024ca7612568b63d/index.js#L125

Would be better the try catch that and log something friendlier, looked at trying to have the plugin go into a failed state more gracefully but looks like some work.

Easier to just set the plugin as a child bridge: https://github.com/homebridge/homebridge/wiki/Child-Bridges which isolates and prevents it from crashing the main bridge, it will then crash and restart about once every 3 minutes when it hits network timeout. Will have to be registered separately in HomeKit though...