Skip to content

Home Assistant fixes and improvements (Claude-code assisted)#30

Open
andreaippo wants to merge 19 commits into
mduran80:mainfrom
andreaippo:main
Open

Home Assistant fixes and improvements (Claude-code assisted)#30
andreaippo wants to merge 19 commits into
mduran80:mainfrom
andreaippo:main

Conversation

@andreaippo

Copy link
Copy Markdown

Hi @mduran80 ,

I have stumbled on https://github.com/dasimon135/daikin_madoka which relies on your work, and I'm grateful to both you and dasimon135 for that, as I'm finally able to integrate my Madoka bluetooth thermostat in the latest version of Home Assistant.

It didn't work out of the box, however. The daikin_madoka repo documents an incompability between the bleak version referenced by the library and the one provided by the HA runtime.

I'm not a python dev, so please forgive if some terms are incorrect here - I hope my point came across nevertheless.

I created personal forks of both repos just for the sake of trying to make things work with the latest version of Home Assistant, and with some help from Claude Code, got the library to work (as far as my limited testing can tell) with a usage of bleak that is compatible with Home Assistant's expectations.

My forks are meant to be ephemeral: my idea from the start was to submit all changes upstream as soon as I got something working, so that the entire smart home community can benefit from them - just like intended by you and dasimon135.

So, kindly review these changes (Claude/Gemini assisted, since I'm proficient in Java) and consider them for merging.

Thanks!

P.S. I apologize for the scarce commit message hygiene - I was just rushing towards making everything work in Home Assistant. I leave it to you to choose a meaningful merge commit message.

Thanks again for your work! :)

dasimon135 added a commit to dasimon135/pymadoka that referenced this pull request Jun 27, 2026
… PR mduran80#30)

Integrates Andrea Ippolito's Home Assistant improvements on top of the
EyeBrightness feature:
- fix bleak 'discover' import removed in bleak 0.20 (discover = BleakScanner.discover)
- optional, lazily-imported HA path via bleak_retry_connector (hass=None keeps
  the standalone/CLI path working)
- connection resilience: _is_starting reentrancy guard, conditional reconnect,
  safer cleanup, exponential backoff
- per-operation asyncio.Lock + 10s wait_for timeout in Feature.query/update
- Controller(address, ..., hass=None, name=None) new signature
- eye_brightness feature preserved and wired into Controller
- bump version 0.2.15 -> 0.2.16

Co-Authored-By: Andrea Ippolito <andreaippo@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
andreaippo and others added 10 commits June 29, 2026 22:48
This reverts commit 9d0a80a.
This reverts commit 26cd167.
This reverts commit 130859f.
Harden BLE resilience without changing any public interface (drop-in):
- feature: short per-attempt command timeout + bounded retries instead of a
  single 10s wait, so lost responses recover fast and latency stays low.
- connection: fix response-queue desync/leak on timeout; add a time-bounded
  stale-response guard so a delayed reply to a timed-out command cannot be
  mis-matched to the next command sharing its id; fail in-flight requests
  immediately on disconnect; exponential reconnect backoff on all paths;
  shorter escalating GATT write-retry backoff.
- transport: length-based message reassembly (fixes 19-vs-20 chunk-count
  mismatch that could complete a truncated message) + duplicate-chunk guard.
- consts: expose resilience/latency tuning knobs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant