From 9d234882e086ffd5c7ea5eb99a0693a19482c058 Mon Sep 17 00:00:00 2001 From: pridmen <15156664+pridmen@users.noreply.github.com> Date: Sun, 17 May 2026 01:49:28 +0300 Subject: [PATCH] daikin_madoka: 5s cooldown between control() and the next poll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After SET_OPERATION_MODE / SET_SETTING_STATUS / SET_SETPOINT the BRC1H takes a few hundred milliseconds (sometimes much longer for SET_OPERATION_MODE) to settle internally before its GET responses match what we just wrote. When PollingComponent's next tick fires within that window, the readback can return the *previous* state and overwrite climate::mode in ESPHome, leading to visible 'set cool → flip back to fan_only briefly → flip to cool again' jitter in HA UI. Stamp millis() on every control(), and short-circuit update() for the next 5 seconds. After 5s clear the stamp so normal polling resumes. No behaviour change in steady state — affects only the first 1-2 polls after a control command. --- esphome/components/daikin_madoka/daikin_madoka.cpp | 6 ++++++ esphome/components/daikin_madoka/daikin_madoka.h | 1 + 2 files changed, 7 insertions(+) diff --git a/esphome/components/daikin_madoka/daikin_madoka.cpp b/esphome/components/daikin_madoka/daikin_madoka.cpp index 283fe0a96ac7..24f5e9542d2c 100644 --- a/esphome/components/daikin_madoka/daikin_madoka.cpp +++ b/esphome/components/daikin_madoka/daikin_madoka.cpp @@ -45,6 +45,7 @@ void DaikinMadoka::loop() { void DaikinMadoka::control(const ClimateCall &call) { if (this->node_state != espbt::ClientState::ESTABLISHED) return; + this->last_control_ms_ = millis(); if (call.get_mode().has_value()) { ClimateMode mode = *call.get_mode(); uint8_t mode_out = 255, status_out = 0; @@ -209,6 +210,11 @@ void DaikinMadoka::update() { ESP_LOGD(TAG, "...but device is disconnected"); return; } + if (this->last_control_ms_ > 0 && millis() - this->last_control_ms_ < 5000) { + ESP_LOGD(TAG, "...skipping, cooldown after control command"); + return; + } + this->last_control_ms_ = 0; std::vector all_cmds{CMD_GET_SETTING_STATUS, CMD_GET_OPERATION_MODE, CMD_GET_SETPOINT, CMD_GET_FAN_SPEED, CMD_GET_SENSOR_INFORMATION}; diff --git a/esphome/components/daikin_madoka/daikin_madoka.h b/esphome/components/daikin_madoka/daikin_madoka.h index c9725276f434..561545d5e1ab 100644 --- a/esphome/components/daikin_madoka/daikin_madoka.h +++ b/esphome/components/daikin_madoka/daikin_madoka.h @@ -52,6 +52,7 @@ static const espbt::ESPBTUUID WWR_CHARACTERISTIC_UUID = class DaikinMadoka : public climate::Climate, public esphome::ble_client::BLEClientNode, public PollingComponent { protected: bool should_update_ = false; + uint32_t last_control_ms_{0}; std::queue> received_chunks_ = {}; std::map> pending_chunks_ = {}; uint16_t notify_handle_;