Conversation
|
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/14/head
components: [daikin_madoka]
refresh: 1h(Added by the PR bot) |
…lently When one ESP32 proxies two BRC1H pairs over BLE, the back-to-back SET_OPERATION_MODE (600 ms) and SET_SETTING_STATUS (200 ms) we emit from control() occasionally have the second chunk silently dropped by one of the pulses. SET_OPERATION_MODE goes through (the LCD switches to the requested mode icon), but SET_SETTING_STATUS does not, so the unit stays physically off. Polling 5–15 s later reports status=0 and flips climate::mode to OFF in HA, surprising the user who just turned it on. The other paired BRC1H on the same ESP works fine in the same window. The existing BLE_SEND_MAX_RETRIES loop in query_() only retries the raw chunk write; if all 5 writes succeed at the link layer but the pulse-side parser silently rejects, we never know. Add a higher-level status retry: stash the last requested status byte in last_set_status_byte_ on every control() that emits SET_SETTING_STATUS. In parse_cb_, on CMD_GET_SETTING_STATUS readback within STATUS_RETRY_WINDOW_MS (30 s after control()) — if cur_status_.status disagrees with our intent, re-send SET_SETTING_STATUS once more, up to MAX_STATUS_RETRIES (2). Patch the local cur_status_.status so the downstream switch doesn't flip climate to OFF based on the stale readback. Caveats: - If the user toggled the unit on the BRC1H buttons within the same 30 s window, we'd fight back briefly. Acceptable: the user usually notices and either the second retry settles or a fresh control() resets the guard. - 30 s window is conservative; in practice a single retry resolves it within the same poll cycle.
c4b24cf to
f106a24
Compare
|
Can't reproduce. Please at least provide logs. |
|
Fair — and I can't hand you a fresh log right now, because the setup this reproduced on (two BRC1H on one ESP32) has been dismantled. I split them onto two ESP32s placed near each panel after fighting persistent How it showed up when it did: one ESP, two BRC1H, back-to-back How to reproduce / catch it on a two-on-one-ESP rig: I plan to revisit two-on-one-ESP later; when I do, I'll capture the readback-vs-intent mismatch and post it. Keeping it open until then — close if you'd rather. |
When one ESP32 proxies two BRC1H pairs over BLE, the back-to-back
SET_OPERATION_MODE(600 ms) andSET_SETTING_STATUS(200 ms) emitted fromcontrol()occasionally have one of the two chunks silently dropped by one of the pulses. In the case this PR addresses, the dropped chunk isSET_SETTING_STATUS:SET_OPERATION_MODEgoes through (LCD switches to the requested mode icon), but the on/off state does not — the unit stays physically off. Polling 5–15 s later reportscur_status_.status = 0and flipsclimate::modetoOFFin HA, surprising the user who just turned it on. The other paired BRC1H on the same ESP works fine in the same window.The dropped chunk can be either of the two, not specifically the second one. The symmetric case —
SET_OPERATION_MODEitself dropped whileSET_SETTING_STATUSlands — produces a different symptom (mode silently reverts to the previous one within ~24 s of a HomeKit/HA mode change). That case is handled by the companion PR #15, which adds the same retry pattern forCMD_GET_OPERATION_MODE. Both retries shareSTATUS_RETRY_WINDOW_MS/MAX_STATUS_RETRIES.The existing
BLE_SEND_MAX_RETRIESloop inquery_()only retries the raw chunk write; if all 5 writes succeed at the link layer but the pulse-side parser silently rejects them, we never know. This PR adds a higher-level status retry:last_set_status_byte_+last_set_ms_+status_retry_count_whenevercontrol()emits aSET_SETTING_STATUS.parse_cb_, onCMD_GET_SETTING_STATUSreadback withinSTATUS_RETRY_WINDOW_MS(30 s after control()) — ifcur_status_.statusdisagrees with our intent, re-sendSET_SETTING_STATUS, up toMAX_STATUS_RETRIES(2).cur_status_.statusso the downstream switch doesn't flipclimate::modeto OFF based on the stale readback.Independent of #10 (sticky fan_only) / #11 (control cooldown) / #12 (notify gate) / #13 (poll delay). Companion to #15 (symmetric
SET_OPERATION_MODEretry).Caveats
control()resets the guard.Test plan
SET_SETTING_STATUSagain and the unit catches up — no manual "press fan_only twice" needed.last_set_ms_stays 0 until firstcontrol()).OFFfrom BRC1H buttons within window: HA shows the unit ON for ~10 s while retries fire, then accepts the off after retries exhaust. Tolerable trade-off vs. the symptom we fix.