naofireblade / homebridge-neato

A Neato vacuum robot plugin for homebridge.
MIT License
69 stars 18 forks source link

Homebridge crashes when neato servers can’t be reached #33

Closed CooperCGN closed 3 years ago

CooperCGN commented 5 years ago

So this is really weird. When I restart my Pi the neato plugin throws the following error protocol. If I restart the service a few minutes later everything suddenly works fine. Any idea what this might be causing? (Credentials edited)

May 29 10:59:44 raspberrypi systemd[1]: Started Node.js HomeKit Server.
May 29 10:59:52 raspberrypi homebridge[390]: [5/29/2019, 10:59:52 AM] Loaded config.json with 0 accessories and 2 platforms.
May 29 10:59:52 raspberrypi homebridge[390]: [5/29/2019, 10:59:52 AM] ---
May 29 10:59:53 raspberrypi homebridge[390]: [5/29/2019, 10:59:53 AM] Loaded plugin: homebridge-config-ui-x
May 29 10:59:53 raspberrypi homebridge[390]: [5/29/2019, 10:59:53 AM] Registering platform 'homebridge-config-ui-x.config'
May 29 10:59:53 raspberrypi homebridge[390]: [5/29/2019, 10:59:53 AM] ---
May 29 10:59:54 raspberrypi homebridge[390]: [5/29/2019, 10:59:54 AM] Loaded plugin: homebridge-neato
May 29 10:59:54 raspberrypi homebridge[390]: [5/29/2019, 10:59:54 AM] Registering platform 'homebridge-neato.NeatoVacuumRobot'
May 29 10:59:54 raspberrypi homebridge[390]: [5/29/2019, 10:59:54 AM] ---
May 29 10:59:54 raspberrypi homebridge[390]: [5/29/2019, 10:59:54 AM] Loading 2 platforms...
May 29 10:59:54 raspberrypi homebridge[390]: [5/29/2019, 10:59:54 AM] [NeatoVacuumRobot] Initializing NeatoVacuumRobot platform...
May 29 10:59:54 raspberrypi homebridge[390]: [5/29/2019, 10:59:54 AM] [Config] Initializing config platform...
May 29 10:59:54 raspberrypi homebridge[390]: [5/29/2019, 10:59:54 AM] [Config] Spawning homebridge-config-ui-x with PID 697
May 29 10:59:54 raspberrypi homebridge[390]: [5/29/2019, 10:59:54 AM] Loading 0 accessories...
May 29 10:59:55 raspberrypi homebridge[390]: [5/29/2019, 10:59:55 AM] [NeatoVacuumRobot] { Error: getaddrinfo EAI_AGAIN beehive.neatocloud.com beehive.neatocloud.com:443
May 29 10:59:55 raspberrypi homebridge[390]:     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
May 29 10:59:55 raspberrypi homebridge[390]:   errno: 'EAI_AGAIN',
May 29 10:59:55 raspberrypi homebridge[390]:   code: 'EAI_AGAIN',
May 29 10:59:55 raspberrypi homebridge[390]:   syscall: 'getaddrinfo',
May 29 10:59:55 raspberrypi homebridge[390]:   hostname: 'beehive.neatocloud.com',
May 29 10:59:55 raspberrypi homebridge[390]:   host: 'beehive.neatocloud.com',
May 29 10:59:55 raspberrypi homebridge[390]:   port: 443,
May 29 10:59:55 raspberrypi homebridge[390]:   config:
May 29 10:59:55 raspberrypi homebridge[390]:    { adapter: [Function: httpAdapter],
May 29 10:59:55 raspberrypi homebridge[390]:      transformRequest: { '0': [Function: transformRequest] },
May 29 10:59:55 raspberrypi homebridge[390]:      transformResponse: { '0': [Function: transformResponse] },
May 29 10:59:55 raspberrypi homebridge[390]:      timeout: 0,
May 29 10:59:55 raspberrypi homebridge[390]:      xsrfCookieName: 'XSRF-TOKEN',
May 29 10:59:55 raspberrypi homebridge[390]:      xsrfHeaderName: 'X-XSRF-TOKEN',
May 29 10:59:55 raspberrypi homebridge[390]:      maxContentLength: -1,
May 29 10:59:55 raspberrypi homebridge[390]:      validateStatus: [Function: validateStatus],
May 29 10:59:55 raspberrypi homebridge[390]:      headers:
May 29 10:59:55 raspberrypi homebridge[390]:       { Accept: 'application/vnd.neato.nucleo.v1',
May 29 10:59:55 raspberrypi homebridge[390]:         'Content-Type': 'application/json;charset=utf-8',
May 29 10:59:55 raspberrypi homebridge[390]:         'User-Agent': 'axios/0.18.0',
May 29 10:59:55 raspberrypi homebridge[390]:         'Content-Length': 58 },
May 29 10:59:55 raspberrypi homebridge[390]:      method: 'post',
May 29 10:59:55 raspberrypi homebridge[390]:      url: 'https://beehive.neatocloud.com/sessions',
May 29 10:59:55 raspberrypi homebridge[390]:      data: '{"email":"******************","password":"***********************"}' },
May 29 10:59:55 raspberrypi homebridge[390]:   request:
May 29 10:59:55 raspberrypi homebridge[390]:    Writable {
May 29 10:59:55 raspberrypi homebridge[390]:      _writableState:
May 29 10:59:55 raspberrypi homebridge[390]:       WritableState {
May 29 10:59:55 raspberrypi homebridge[390]:         objectMode: false,
May 29 10:59:55 raspberrypi homebridge[390]:         highWaterMark: 16384,
May 29 10:59:55 raspberrypi homebridge[390]:         finalCalled: false,
May 29 10:59:55 raspberrypi homebridge[390]:         needDrain: false,
May 29 10:59:55 raspberrypi homebridge[390]:         ending: false,
May 29 10:59:55 raspberrypi homebridge[390]:         ended: false,
May 29 10:59:55 raspberrypi homebridge[390]:         finished: false,
May 29 10:59:55 raspberrypi homebridge[390]:         destroyed: false,
May 29 10:59:55 raspberrypi homebridge[390]:         decodeStrings: true,
May 29 10:59:55 raspberrypi homebridge[390]:         defaultEncoding: 'utf8',
May 29 10:59:55 raspberrypi homebridge[390]:         length: 0,
May 29 10:59:55 raspberrypi homebridge[390]:         writing: false,
May 29 10:59:55 raspberrypi homebridge[390]:         corked: 0,
May 29 10:59:55 raspberrypi homebridge[390]:         sync: true,
May 29 10:59:55 raspberrypi homebridge[390]:         bufferProcessing: false,
May 29 10:59:55 raspberrypi homebridge[390]:         onwrite: [Function: bound onwrite],
May 29 10:59:55 raspberrypi homebridge[390]:         writecb: null,
May 29 10:59:55 raspberrypi homebridge[390]:         writelen: 0,
May 29 10:59:55 raspberrypi homebridge[390]:         bufferedRequest: null,
May 29 10:59:55 raspberrypi homebridge[390]:         lastBufferedRequest: null,
May 29 10:59:55 raspberrypi homebridge[390]:         pendingcb: 0,
May 29 10:59:55 raspberrypi homebridge[390]:         prefinished: false,
May 29 10:59:55 raspberrypi homebridge[390]:         errorEmitted: false,
May 29 10:59:55 raspberrypi homebridge[390]:         emitClose: true,
May 29 10:59:55 raspberrypi homebridge[390]:         bufferedRequestCount: 0,
May 29 10:59:55 raspberrypi homebridge[390]:         corkedRequestsFree: [Object] },
May 29 10:59:55 raspberrypi homebridge[390]:      writable: true,
May 29 10:59:55 raspberrypi homebridge[390]:      _events:
May 29 10:59:55 raspberrypi homebridge[390]:       [Object: null prototype] {
May 29 10:59:55 raspberrypi homebridge[390]:         response: [Function: handleResponse],
May 29 10:59:55 raspberrypi homebridge[390]:         error: [Function: handleRequestError] },
May 29 10:59:55 raspberrypi homebridge[390]:      _eventsCount: 2,
May 29 10:59:55 raspberrypi homebridge[390]:      _maxListeners: undefined,
May 29 10:59:55 raspberrypi homebridge[390]:      _options:
May 29 10:59:55 raspberrypi homebridge[390]:       { maxRedirects: 21,
May 29 10:59:55 raspberrypi homebridge[390]:         maxBodyLength: 10485760,
May 29 10:59:55 raspberrypi homebridge[390]:         protocol: 'https:',
May 29 10:59:55 raspberrypi homebridge[390]:         path: '/sessions',
May 29 10:59:55 raspberrypi homebridge[390]:         method: 'post',
May 29 10:59:55 raspberrypi homebridge[390]:         headers: [Object],
May 29 10:59:55 raspberrypi homebridge[390]:         agent: undefined,
May 29 10:59:55 raspberrypi homebridge[390]:         auth: undefined,
May 29 10:59:55 raspberrypi homebridge[390]:         hostname: 'beehive.neatocloud.com',
May 29 10:59:55 raspberrypi homebridge[390]:         port: null,
May 29 10:59:55 raspberrypi homebridge[390]:         nativeProtocols: [Object],
May 29 10:59:55 raspberrypi homebridge[390]:         pathname: '/sessions' },
May 29 10:59:55 raspberrypi homebridge[390]:      _ended: false,
May 29 10:59:55 raspberrypi homebridge[390]:      _ending: true,
May 29 10:59:55 raspberrypi homebridge[390]:      _redirectCount: 0,
May 29 10:59:55 raspberrypi homebridge[390]:      _redirects: [],
May 29 10:59:55 raspberrypi homebridge[390]:      _requestBodyLength: 58,
May 29 10:59:55 raspberrypi homebridge[390]:      _requestBodyBuffers: [ [Object] ],
May 29 10:59:55 raspberrypi homebridge[390]:      _onNativeResponse: [Function],
May 29 10:59:55 raspberrypi homebridge[390]:      _currentRequest:
May 29 10:59:55 raspberrypi homebridge[390]:       ClientRequest {
May 29 10:59:55 raspberrypi homebridge[390]:         _events: [Object],
May 29 10:59:55 raspberrypi homebridge[390]:         _eventsCount: 6,
May 29 10:59:55 raspberrypi homebridge[390]:         _maxListeners: undefined,
May 29 10:59:55 raspberrypi homebridge[390]:         output: [],
May 29 10:59:55 raspberrypi homebridge[390]:         outputEncodings: [],
May 29 10:59:55 raspberrypi homebridge[390]:         outputCallbacks: [],
May 29 10:59:55 raspberrypi homebridge[390]:         outputSize: 0,
May 29 10:59:55 raspberrypi homebridge[390]:         writable: true,
May 29 10:59:55 raspberrypi homebridge[390]:         _last: true,
May 29 10:59:55 raspberrypi homebridge[390]:         chunkedEncoding: false,
May 29 10:59:55 raspberrypi homebridge[390]:         shouldKeepAlive: false,
May 29 10:59:55 raspberrypi homebridge[390]:         useChunkedEncodingByDefault: true,
May 29 10:59:55 raspberrypi homebridge[390]:         sendDate: false,
May 29 10:59:55 raspberrypi homebridge[390]:         _removedConnection: false,
May 29 10:59:55 raspberrypi homebridge[390]:         _removedContLen: false,
May 29 10:59:55 raspberrypi homebridge[390]:         _removedTE: false,
May 29 10:59:55 raspberrypi homebridge[390]:         _contentLength: null,
May 29 10:59:55 raspberrypi homebridge[390]:         _hasBody: true,
May 29 10:59:55 raspberrypi homebridge[390]:         _trailer: '',
May 29 10:59:55 raspberrypi homebridge[390]:         finished: false,
May 29 10:59:55 raspberrypi homebridge[390]:         _headerSent: true,
May 29 10:59:55 raspberrypi homebridge[390]:         socket: [TLSSocket],
May 29 10:59:55 raspberrypi homebridge[390]:         connection: [TLSSocket],
May 29 10:59:55 raspberrypi homebridge[390]:         _header:
May 29 10:59:55 raspberrypi homebridge[390]:          'POST /sessions HTTP/1.1\r\nAccept: application/vnd.neato.nucleo.v1\r\nContent-Type: application/json;charset=utf-8\r\nUser-Agent: axios/0.18.0\r\nContent-
May 29 10:59:55 raspberrypi homebridge[390]:         _onPendingData: [Function: noopPendingOutput],
May 29 10:59:55 raspberrypi homebridge[390]:         agent: [Agent],
May 29 10:59:55 raspberrypi homebridge[390]:         socketPath: undefined,
May 29 10:59:55 raspberrypi homebridge[390]:         timeout: undefined,
May 29 10:59:55 raspberrypi homebridge[390]:         method: 'POST',
May 29 10:59:55 raspberrypi homebridge[390]:         path: '/sessions',
May 29 10:59:55 raspberrypi homebridge[390]:         _ended: false,
May 29 10:59:55 raspberrypi homebridge[390]:         res: null,
May 29 10:59:55 raspberrypi homebridge[390]:         aborted: undefined,
May 29 10:59:55 raspberrypi homebridge[390]:         timeoutCb: null,
May 29 10:59:55 raspberrypi homebridge[390]:         upgradeOrConnect: false,
May 29 10:59:55 raspberrypi homebridge[390]:         parser: null,
May 29 10:59:55 raspberrypi homebridge[390]:         maxHeadersCount: null,
May 29 10:59:55 raspberrypi homebridge[390]:         _redirectable: [Circular],
May 29 10:59:55 raspberrypi homebridge[390]:         [Symbol(isCorked)]: false,
May 29 10:59:55 raspberrypi homebridge[390]:         [Symbol(outHeadersKey)]: [Object] },
May 29 10:59:55 raspberrypi homebridge[390]:      _currentUrl: 'https://beehive.neatocloud.com/sessions' },
May 29 10:59:55 raspberrypi homebridge[390]:   response: undefined }
May 29 10:59:55 raspberrypi homebridge[390]: [5/29/2019, 10:59:55 AM] [NeatoVacuumRobot] Can't log on to neato cloud. Please check your credentials.
May 29 10:59:55 raspberrypi homebridge[390]: (node:390) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
May 29 10:59:55 raspberrypi homebridge[390]:     at /usr/local/lib/node_modules/homebridge-neato/index.js:43:36
May 29 10:59:55 raspberrypi homebridge[390]:     at /usr/local/lib/node_modules/homebridge-neato/index.js:60:5
May 29 10:59:55 raspberrypi homebridge[390]:     at Client.<anonymous> (/usr/local/lib/node_modules/homebridge-neato/node_modules/node-botvac/lib/client.js:19:25)
May 29 10:59:55 raspberrypi homebridge[390]:     at /usr/local/lib/node_modules/homebridge-neato/node_modules/node-botvac/lib/api.js:34:45
May 29 10:59:55 raspberrypi homebridge[390]:     at process._tickCallback (internal/process/next_tick.js:68:7)
May 29 10:59:55 raspberrypi homebridge[390]: (node:390) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block
May 29 10:59:55 raspberrypi homebridge[390]: (node:390) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node
May 29 11:00:22 raspberrypi homebridge[390]: [5/29/2019, 11:00:22 AM] [Config] Console v4.4.3 is listening on 0.0.0.0 port 8053
May 29 11:01:25 raspberrypi systemd[1]: Stopping Node.js HomeKit Server...
CooperCGN commented 5 years ago

Not sure what it is actually, but I guess somethings not up and running when I try to start that specific homebridge instance after a reboot. I have it now waiting for two minutes after reboot and it works.

ifeign commented 5 years ago

This has happened before. It's likely on the Neato server end.

https://github.com/naofireblade/homebridge-neato/issues/19

naofireblade commented 5 years ago

Thanks for raising this issue. Fixed in v0.6.3

CooperCGN commented 5 years ago

Last update broke everything, on startup the plugin overrides the error but then also removes both my Neato from HomeKit and from my automations.

naofireblade commented 5 years ago

Your neato and homebridge where on or offline?

CooperCGN commented 5 years ago

Both Neatos were online, I installed the update and did a sudo reboot to see what happens. My Neato homebridge instance started now as expected where it failed before but kicked both robots out of HomeKit. Maybe it’s just me but I have the feeling that the DNS error in the log might me due to something not yet ready networking wise. On the other hand all other plugins that rely on accessing some external API work without problems. Went back to 0.6.2 where I have to do a restart after booting but at least it won’t delete my automations till then.

naofireblade commented 3 years ago

Should be the same issue as #44 and will be fixed with the change to a dynamic platform.