valiquette / homebridge-orbit-irrigation

Provides Homebridge support for Orbit B-Hyve devices
MIT License
9 stars 1 forks source link

Websocket closed shutting down Homebridge #60

Closed wanderleyteixeira closed 1 year ago

wanderleyteixeira commented 1 year ago

Error after restarting home bridge with Orbit

[05/06/2023, 01:57:48] [B-Hyve] Orbit Platform finished loading
[05/06/2023, 01:57:52] Error: WebSocket was closed before the connection was established
    at WebSocket.close (/usr/lib/node_modules/homebridge-orbit-irrigation/node_modules/ws/lib/websocket.js:285:7)
    at ReconnectingWebSocket._disconnect (/usr/lib/node_modules/homebridge-orbit-irrigation/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:539:22)
    at ReconnectingWebSocket._handleError (/usr/lib/node_modules/homebridge-orbit-irrigation/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:180:19)
    at ReconnectingWebSocket._handleTimeout (/usr/lib/node_modules/homebridge-orbit-irrigation/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:529:14)
    at Timeout.<anonymous> (/usr/lib/node_modules/homebridge-orbit-irrigation/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:524:75)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
[05/06/2023, 01:57:52] Got SIGTERM, shutting down Homebridge...
[05/06/2023, 01:57:52] UnhandledPromiseRejection: 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(). The promise rejected with the reason "#<ErrorEvent>".
[05/06/2023, 01:57:54] [B-Hyve] WebSocket connection established
valiquette commented 1 year ago

Was this a one time error or is this consistent? Is it stuck in a restart loop?

wanderleyteixeira commented 1 year ago

Hello @valiquette it happens all the time after I enable orbit

valiquette commented 1 year ago

Can you attach some logging before that event?

wanderleyteixeira commented 1 year ago

Thank you for looking into this. 🙏🏻 This is all I see so far.

[05/06/2023, 01:54:45] [B-Hyve] Error getting API key Request failed with status code 504
[05/06/2023, 01:54:46] [B-Hyve] "<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"
[05/06/2023, 01:54:46] [B-Hyve] Failed to get devices. Retry attempt 1 of 3 in 60 seconds...
[05/06/2023, 01:55:46] [B-Hyve] Getting Account info...
[05/06/2023, 01:55:46] [B-Hyve] Found account for AAA BBB
[05/06/2023, 01:56:47] [B-Hyve] Error getting devices Request failed with status code 504
[05/06/2023, 01:56:47] [B-Hyve] "<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"
[05/06/2023, 01:56:47] [B-Hyve] Failed to get devices. Retry attempt 2 of 3 in 60 seconds...
[05/06/2023, 01:57:47] [B-Hyve] Getting Account info...
[05/06/2023, 01:57:47] [B-Hyve] Found account for AAA BBB
[05/06/2023, 01:57:48] [B-Hyve] Online device BH1-0001 b-hyve hub found at the configured location address: XXXX Street
[05/06/2023, 01:57:48] [B-Hyve] Offline device HT25-0000 not used found at the configured location address: YYYY Ave
[05/06/2023, 01:57:48] [B-Hyve] not used is disconnected! This will show as non-responding in Homekit until the connection is restored.
[05/06/2023, 01:57:48] [B-Hyve] backyard is disconnected! This will show as non-responding in Homekit until the connection is restored.
[05/06/2023, 01:57:48] [B-Hyve] Offline device HT25-0000 backyard found at the configured location address: XXXX Street
[05/06/2023, 01:57:48] [B-Hyve] Skipping Bridge BH1-0001 b-hyve hub based on config
[05/06/2023, 01:57:48] [B-Hyve] not used disconnected at 2023-06-03T23:25:46.781Z! This will show as non-responding in Homekit until the connection is restored.
[05/06/2023, 01:57:48] [B-Hyve] Configure Irrigation system for not used
[05/06/2023, 01:57:48] [B-Hyve] Adding Battery status for not used
[05/06/2023, 01:57:48] [B-Hyve] Configured zone-1 for Zone 1 with 1 min runtime
[05/06/2023, 01:57:48] [B-Hyve] backyard disconnected at 2023-06-05T00:45:54.271Z! This will show as non-responding in Homekit until the connection is restored.
[05/06/2023, 01:57:48] [B-Hyve] Configure Irrigation system for backyard
[05/06/2023, 01:57:48] [B-Hyve] Adding Battery status for backyard
[05/06/2023, 01:57:48] [B-Hyve] Configured zone-1 for Zone 1 with 1 min runtime
[05/06/2023, 01:57:48] [B-Hyve] Orbit Platform finished loading
[05/06/2023, 01:57:52] Error: WebSocket was closed before the connection was established
    at WebSocket.close (/usr/lib/node_modules/homebridge-orbit-irrigation/node_modules/ws/lib/websocket.js:285:7)
    at ReconnectingWebSocket._disconnect (/usr/lib/node_modules/homebridge-orbit-irrigation/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:539:22)
    at ReconnectingWebSocket._handleError (/usr/lib/node_modules/homebridge-orbit-irrigation/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:180:19)
    at ReconnectingWebSocket._handleTimeout (/usr/lib/node_modules/homebridge-orbit-irrigation/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:529:14)
    at Timeout.<anonymous> (/usr/lib/node_modules/homebridge-orbit-irrigation/node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:524:75)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
[05/06/2023, 01:57:52] Got SIGTERM, shutting down Homebridge...
[05/06/2023, 01:57:52] UnhandledPromiseRejection: 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(). The promise rejected with the reason "#<ErrorEvent>".
[05/06/2023, 01:57:54] [B-Hyve] WebSocket connection established
[05/06/2023, 01:57:57] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[05/06/2023, 01:58:02] [HB Supervisor] Restarting Homebridge...
valiquette commented 1 year ago

There is a new version published. I was able to find some example of this in my own log, but they recovered. There may have been a server issue. I corrected the close before open error and the subsequent error that caused the restart. Not sure this will correct the issue you were seeing. If you still have an issue can you attach the a new log output?

wanderleyteixeira commented 1 year ago

So far so good. Keep you posted. Thank you.