thomasloven / hass-plejd

🔹 Plejd BLE integration for Home Assistant
87 stars 9 forks source link

Retry write when InProgress #4

Closed bnordli closed 1 year ago

bnordli commented 1 year ago

This frequently occurs when activating a Home Assistant scene with multiple lights. The wait interval usually succeeds on the second try on my installation, but feel free to tweak it!

The other errors should probably be handled by trying to reconnect before writing again?

thomasloven commented 1 year ago

I believe this would only work on linux backends. The Bleak library also supports windows, macOS and android which do not rely on bluez. Also, there's esphome proxies.

bnordli commented 1 year ago

That's a good point. I don't known enough about Bluetooth to figure out what the general solution to this is.

The best way would be for the official integration to support retries, but I think this is the best effort we have at the moment. It is clear that we absolutely need some retry functionality, or changing multiple lights at once will consistently fail.

(klali did something similar in their integration: https://github.com/klali/ha-plejd/commit/338b42c9f1ff3d987789d3ec526a558d1709651d)

thomasloven commented 1 year ago

I've removed an optimization meant to speed up operation for well behaved bluetooth backends like bluez. Maybe things will actually work better without it.

bnordli commented 1 year ago

Thank you, I don't get any exceptions with the new code. I'll close this for now.