Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlled Connection Retries #66

Merged
merged 5 commits into from Aug 28, 2019

Conversation

afharo
Copy link
Member

@afharo afharo commented Aug 27, 2019

If you start / restart the Homebridge and the Xiaomi is off / battery is empty - then the plugin can not reach the robot.
It comes: "ERR connect | miio.device, next try in 2 minutes | Error: Could not connect to device, handshake timeout“ show here line 402.

Because the Homebridge does not get a Return / Error from homebridge-xiaomi-roborock-vacuum, the Homebridge hangs when the plugin is loaded and no devices in the Homebridge are accessible. In the Apple Home app, all devices from this Homebridge display "No Answer" or "Refresh“.

Instead of hanging forever until the device is connected, I've moved the retries to a setTimeout. That way the promise will either resolve or reject straight away. But we'll keep a retry to connect on every 2 minutes.

Still, whenever there's a new GET/SET request from HomeKit while still disconnected, it will try to connect again. Applying the same behaviour of resolving/rejecting the promise after the first attempt and schedule a reconnection attempt for later.

@afharo afharo requested a review from nicoh88 August 27, 2019 22:49
@nicoh88 nicoh88 merged commit d113af1 into master Aug 28, 2019
@nicoh88 nicoh88 deleted the Controlled_Connection_Retries_Persistence branch August 28, 2019 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants