aso824 / yeehack

Alternative way to control bluetooth Yeelock devices
Apache License 2.0
20 stars 2 forks source link

Improve bluetooth timeout and connection abort issues #7

Closed kingmercian closed 1 year ago

kingmercian commented 1 year ago

update bleak to 0.20.0 - Adds automatic retry on le-connection-abort-… This updates Bleak to version 0.20.0 (and bleaks dependency dbus-fast to 1.84.2) which resolves an issue I had with failures due to returned error le-connection-abort-by-local https://github.com/hbldh/bleak/issues/1220.

add configurable bluetooth timeout to CLI and webserver This adds a configurable timeout value in the CLI and webserver to extend BleakClient connection timeout, this is helpful for users who may have particularly noisy environments/slower devices. This change requires the timeout value to be provided in the json body on a POST message. CLI will default to 5 seconds if not specified. README is updated for these changes.

update readme to add docker compose host mode info Recommend to use docker host mode to prevent issues between host/container contention with bluetooth. Since using host mode in combination with these changes I have had no failures whereas before I had intermittent success.

update readme to add homeassistant service for temporary unlock Add example service REST call for temporary unlock in home assistant to readme.

aso824 commented 1 year ago

Thanks for your contribution!

Awesome that you upgraded the library and added timeout; I'm going to change it a little (here, after merge):

  1. Host docker network does not seems to have sense for me, as there is already port mapping used
  2. After testing I noticed that default timeout set to 5s is sometimes too small, I'll increase it to 10s
  3. I'll allow to call endpoints without given timeout to maintain backward compatibility

Anyway, thanks! Sorry that you have waited so long; you're welcome with next PRs.