naofireblade / homebridge-neato

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

Delay on homebridge restart #60

Closed Lorccan closed 3 years ago

Lorccan commented 3 years ago

I've had a couple of occasions recently where I've restarted homebridge and found my D7 and associated controls disappear from Home app. If I do another restart, it will usually reappear, but in the default room and this means that automations have to be set up again.

I wonder if this is something to do with unavailability of Neato's api and if it might be fixable by either looping the login [to Neato] until robot details are received or by introducing a (configurable) delay to allow time for the connection?

EDIT: this is what I see in the log:

[15/02/2021, 14:44:17] Registering platform 'homebridge-neato.NeatoVacuumRobot'
[15/02/2021, 14:44:18] [NeatoVacuumRobot] Initializing NeatoVacuumRobot platform...
[15/02/2021, 14:44:18] [NeatoVacuumRobot] Refresh is set to: auto
[15/02/2021, 14:44:19] [NeatoVacuumRobot] Error getting robot meta information: Error: connect ECONNREFUSED 18.234.134.123:4443: null

then, after a restart:

[15/02/2021, 14:45:43] Registering platform 'homebridge-neato.NeatoVacuumRobot'
[15/02/2021, 14:45:43] [NeatoVacuumRobot] Initializing NeatoVacuumRobot platform...
[15/02/2021, 14:45:43] [NeatoVacuumRobot] Refresh is set to: auto
[15/02/2021, 14:46:01] [NeatoVacuumRobot] Error getting robot meta information: Error: Request failed with status code 404: null

then, after another restart (some hours later when I noticed what was happening) all loaded correctly, but Home automations etc were broken.

CooperCGN commented 3 years ago

I had this happen a few times too and as I created some pretty complex automations which got broken a few times in the end I decided to remove the robots from them. I think the plugin needs to check if the api is available on start, just removing them from the setup is pretty annoying.

naofireblade commented 3 years ago

I'm working on a fix. More information can be found in #44