From 545468ad2ff114f74c69982850837ec3367ee051 Mon Sep 17 00:00:00 2001 From: Benjamin Pearce Date: Tue, 10 Dec 2024 01:45:51 -0500 Subject: [PATCH 1/4] added quiet fan and prevented coercing set temperature on fan only and dry modes --- esphome/components/daikin/daikin.cpp | 16 +++++++++------- esphome/components/daikin/daikin.h | 10 +++++----- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/esphome/components/daikin/daikin.cpp b/esphome/components/daikin/daikin.cpp index bb8587fbeb..2c51dfcd9c 100644 --- a/esphome/components/daikin/daikin.cpp +++ b/esphome/components/daikin/daikin.cpp @@ -65,7 +65,7 @@ void DaikinClimate::transmit_state() { transmit.perform(); } -uint8_t DaikinClimate::operation_mode_() { +uint8_t DaikinClimate::operation_mode_() const { uint8_t operating_mode = DAIKIN_MODE_ON; switch (this->mode) { case climate::CLIMATE_MODE_COOL: @@ -92,9 +92,12 @@ uint8_t DaikinClimate::operation_mode_() { return operating_mode; } -uint16_t DaikinClimate::fan_speed_() { +uint16_t DaikinClimate::fan_speed_() const { uint16_t fan_speed; switch (this->fan_mode.value()) { + case climate::CLIMATE_FAN_QUIET: + fan_speed = DAIKIN_FAN_SILENT << 8; + break; case climate::CLIMATE_FAN_LOW: fan_speed = DAIKIN_FAN_1 << 8; break; @@ -126,7 +129,7 @@ uint16_t DaikinClimate::fan_speed_() { return fan_speed; } -uint8_t DaikinClimate::temperature_() { +uint8_t DaikinClimate::temperature_() const { // Force special temperatures depending on the mode switch (this->mode) { case climate::CLIMATE_MODE_FAN_ONLY: @@ -170,9 +173,6 @@ bool DaikinClimate::parse_state_frame_(const uint8_t frame[]) { this->mode = climate::CLIMATE_MODE_OFF; } uint8_t temperature = frame[6]; - if (!(temperature & 0xC0)) { - this->target_temperature = temperature >> 1; - } uint8_t fan_mode = frame[8]; uint8_t swing_mode = frame[9]; if (fan_mode & 0xF && swing_mode & 0xF) { @@ -187,9 +187,11 @@ bool DaikinClimate::parse_state_frame_(const uint8_t frame[]) { switch (fan_mode & 0xF0) { case DAIKIN_FAN_1: case DAIKIN_FAN_2: - case DAIKIN_FAN_SILENT: this->fan_mode = climate::CLIMATE_FAN_LOW; break; + case DAIKIN_FAN_SILENT: + this->fan_mode = climate::CLIMATE_FAN_QUIET; + break; case DAIKIN_FAN_3: this->fan_mode = climate::CLIMATE_FAN_MEDIUM; break; diff --git a/esphome/components/daikin/daikin.h b/esphome/components/daikin/daikin.h index b4ac309de9..159292cb55 100644 --- a/esphome/components/daikin/daikin.h +++ b/esphome/components/daikin/daikin.h @@ -44,17 +44,17 @@ class DaikinClimate : public climate_ir::ClimateIR { public: DaikinClimate() : climate_ir::ClimateIR(DAIKIN_TEMP_MIN, DAIKIN_TEMP_MAX, 1.0f, true, true, - {climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, climate::CLIMATE_FAN_MEDIUM, - climate::CLIMATE_FAN_HIGH}, + {climate::CLIMATE_FAN_QUIET, climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, + climate::CLIMATE_FAN_MEDIUM, climate::CLIMATE_FAN_HIGH}, {climate::CLIMATE_SWING_OFF, climate::CLIMATE_SWING_VERTICAL, climate::CLIMATE_SWING_HORIZONTAL, climate::CLIMATE_SWING_BOTH}) {} protected: // Transmit via IR the state of this climate controller. void transmit_state() override; - uint8_t operation_mode_(); - uint16_t fan_speed_(); - uint8_t temperature_(); + uint8_t operation_mode_() const; + uint16_t fan_speed_() const; + uint8_t temperature_() const; // Handle received IR Buffer bool on_receive(remote_base::RemoteReceiveData data) override; bool parse_state_frame_(const uint8_t frame[]); From 085016d583e950d18de1b4509b6e53fc5fea9165 Mon Sep 17 00:00:00 2001 From: Benjamin Pearce Date: Tue, 10 Dec 2024 02:10:14 -0500 Subject: [PATCH 2/4] organized switch better --- esphome/components/daikin/daikin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esphome/components/daikin/daikin.cpp b/esphome/components/daikin/daikin.cpp index 2c51dfcd9c..83c1268dcf 100644 --- a/esphome/components/daikin/daikin.cpp +++ b/esphome/components/daikin/daikin.cpp @@ -189,9 +189,6 @@ bool DaikinClimate::parse_state_frame_(const uint8_t frame[]) { case DAIKIN_FAN_2: this->fan_mode = climate::CLIMATE_FAN_LOW; break; - case DAIKIN_FAN_SILENT: - this->fan_mode = climate::CLIMATE_FAN_QUIET; - break; case DAIKIN_FAN_3: this->fan_mode = climate::CLIMATE_FAN_MEDIUM; break; @@ -202,6 +199,9 @@ bool DaikinClimate::parse_state_frame_(const uint8_t frame[]) { case DAIKIN_FAN_AUTO: this->fan_mode = climate::CLIMATE_FAN_AUTO; break; + case DAIKIN_FAN_SILENT: + this->fan_mode = climate::CLIMATE_FAN_QUIET; + break; } this->publish_state(); return true; From 1ee0bd2ee9a111cd83eaaffe3d14ab6a739434fa Mon Sep 17 00:00:00 2001 From: Benjamin Pearce Date: Tue, 10 Dec 2024 18:37:43 -0500 Subject: [PATCH 3/4] fixed temperature read from receiver --- esphome/components/daikin/daikin.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/esphome/components/daikin/daikin.cpp b/esphome/components/daikin/daikin.cpp index 83c1268dcf..09dd64118b 100644 --- a/esphome/components/daikin/daikin.cpp +++ b/esphome/components/daikin/daikin.cpp @@ -151,19 +151,25 @@ bool DaikinClimate::parse_state_frame_(const uint8_t frame[]) { if (frame[DAIKIN_STATE_FRAME_SIZE - 1] != checksum) return false; uint8_t mode = frame[5]; + // Temperature is given in degrees celcius * 2 + // only update for states that use the temperature + uint8_t temperature = frame[6]; if (mode & DAIKIN_MODE_ON) { switch (mode & 0xF0) { case DAIKIN_MODE_COOL: this->mode = climate::CLIMATE_MODE_COOL; + this->target_temperature = static_cast(temperature * 0.5f); break; case DAIKIN_MODE_DRY: this->mode = climate::CLIMATE_MODE_DRY; break; case DAIKIN_MODE_HEAT: this->mode = climate::CLIMATE_MODE_HEAT; + this->target_temperature = static_cast(temperature * 0.5f); break; case DAIKIN_MODE_AUTO: this->mode = climate::CLIMATE_MODE_HEAT_COOL; + this->target_temperature = static_cast(temperature * 0.5f); break; case DAIKIN_MODE_FAN: this->mode = climate::CLIMATE_MODE_FAN_ONLY; @@ -172,7 +178,6 @@ bool DaikinClimate::parse_state_frame_(const uint8_t frame[]) { } else { this->mode = climate::CLIMATE_MODE_OFF; } - uint8_t temperature = frame[6]; uint8_t fan_mode = frame[8]; uint8_t swing_mode = frame[9]; if (fan_mode & 0xF && swing_mode & 0xF) { From 52cb8b9cd7e1a41de228fe8c7a54cbea06b7a2d1 Mon Sep 17 00:00:00 2001 From: Benjamin Pearce Date: Sat, 14 Dec 2024 20:32:28 -0500 Subject: [PATCH 4/4] removed auto heat/cool from fixed temperature --- esphome/components/daikin/daikin.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/esphome/components/daikin/daikin.cpp b/esphome/components/daikin/daikin.cpp index 09dd64118b..359c63aeca 100644 --- a/esphome/components/daikin/daikin.cpp +++ b/esphome/components/daikin/daikin.cpp @@ -134,7 +134,6 @@ uint8_t DaikinClimate::temperature_() const { switch (this->mode) { case climate::CLIMATE_MODE_FAN_ONLY: return 0x32; - case climate::CLIMATE_MODE_HEAT_COOL: case climate::CLIMATE_MODE_DRY: return 0xc0; default: