Skip to content

daikin_madoka: bump inter-query delay 50→200 ms in update() (multi-device fix) - #13

Closed
pridmen wants to merge 1 commit into
Petapton:madokafrom
pridmen:madoka-poll-delay-200ms
Closed

pridmen wants to merge 1 commit into
Petapton:madokafrom
pridmen:madoka-poll-delay-200ms

Conversation

@pridmen

@pridmen pridmen commented May 16, 2026

Copy link
Copy Markdown

When two BRC1H controllers are paired through one ESP32 (single BLE proxy serving multiple rooms), 50 ms between the back-to-back CMD_GET_* queries in update() is too tight: chunked notifications from the two devices interleave, and process_incoming_chunk_() trips on

[E] Another packet with the same chunk ID is already in the buffer.

followed shortly by

Dropped XX BLE events due to buffer overflow

200 ms (the value SET_SETTING_STATUS and SET_FAN_SPEED already use) gives each device enough time to finish its notify chunks before the next query goes out. Total update() cycle goes from ~250 ms to ~1 s, well within PollingComponent's default 60 s interval, so no perceptible polling slowdown.

One-line change.

Test plan

  • Two BRC1H paired via one BLE proxy, default ESPHome update_interval — no more chunk-ID collisions in logs.
  • Single BRC1H — unchanged (slightly longer initial cycle by 750 ms, negligible).

When two BRC1H controllers are paired through one ESP32 (e.g. a single
BLE proxy serving multiple bedrooms), 50 ms between the back-to-back
CMD_GET_* queries in update() is too tight: chunked notifications from
the two devices interleave, and process_incoming_chunk_() trips on
'Another packet with the same chunk ID is already in the buffer'
followed by 'Dropped XX BLE events due to buffer overflow'.

200 ms (the value SET_SETTING_STATUS / SET_FAN_SPEED already use) is
enough to let one device finish responding before the next query goes
out. Total update cycle goes from ~250 ms to ~1 s, well within
PollingComponent's default 60 s interval, so no noticeable polling
slowdown.

Verified on two BRC1H + one m5stack-bleproxy.
@pridmen
pridmen requested a review from Petapton as a code owner May 16, 2026 22:51
@github-actions

Copy link
Copy Markdown

To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file:

external_components:
  - source: github://Petapton/esphome@pull/13/head
    components: [daikin_madoka]
    refresh: 1h

(Added by the PR bot)

@Petapton

Copy link
Copy Markdown
Owner

I'm quite sure this is not the way it works, since two devices mean two component instances (which don't share the same memory), so I see no risk of interleaving.
Again, please provide logs.

@pridmen

pridmen commented Jun 26, 2026

Copy link
Copy Markdown
Author

You're right, and thanks for the push-back — two devices are two independent component instances with separate buffers, so my "interleaving in process_incoming_chunk_()" framing is wrong and I can't back it with a clean log. Please disregard that explanation.

What I actually observed on one ESP32 proxying two BRC1H was contention at the radio/connection level, not in the chunk buffer. The second link kept failing to establish:

ESP_GATTC_DISCONNECT_EVT, reason 0x3e        (BLE_HCI_CONN_FAIL_TO_ESTABLISH)
ESP_GATTC_OPEN_EVT in DISCONNECTING state (status=133)

i.e. the same scan ↔ connect/establish contention class as esphome#5119 / esphome#12970, made worse by a weak link to the second BRC1H. Bumping the inter-query delay was me chasing a symptom — it never addressed the real cause.

I've since split the two BRC1H onto two separate ESP32s, each placed close to its panel, which is what actually fixed it. The previously-flaky link is now solid:

[C][esp32_ble_client]:   Address: 00:CC:3F:E4:EE:1A
[C][esp32_ble_client]:   State: ESTABLISHED
[D][daikin_madoka:297]: Got update request...

So I'd treat this PR as not the right fix. I'm keeping it open only because I still want to get two-on-one-ESP working eventually; if I manage that I'll come back with proper logs, otherwise I'll close it. Happy for you to close it now if you prefer.

@Petapton Petapton closed this Jun 26, 2026
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.

2 participants