From 0898e4eb6d60af3f8c3f936854be67c1c5171443 Mon Sep 17 00:00:00 2001 From: ElVit Date: Sun, 22 Mar 2026 10:23:21 +0100 Subject: [PATCH 1/4] Add switch "error_reset" --- components/panasonic_heatpump/README.md | 2 ++ .../climate/panasonic_heatpump_climate.cpp | 2 +- .../number/panasonic_heatpump_number.cpp | 2 +- components/panasonic_heatpump/panasonic_heatpump.h | 4 ++++ .../select/panasonic_heatpump_select.cpp | 2 +- components/panasonic_heatpump/switch/__init__.py | 5 +++++ .../switch/panasonic_heatpump_switch.cpp | 10 +++++++++- .../switch/panasonic_heatpump_switch.h | 1 + .../water_heater/panasonic_heatpump_water_heater.cpp | 2 +- 9 files changed, 25 insertions(+), 5 deletions(-) diff --git a/components/panasonic_heatpump/README.md b/components/panasonic_heatpump/README.md index fdca9bf..041758d 100644 --- a/components/panasonic_heatpump/README.md +++ b/components/panasonic_heatpump/README.md @@ -565,6 +565,8 @@ switch: name: "Set External Heat Cool Control" set34: name: "Set Bivalent Control" + error_reset: + name: "Error Reset (Restart)" ``` ### Selects diff --git a/components/panasonic_heatpump/climate/panasonic_heatpump_climate.cpp b/components/panasonic_heatpump/climate/panasonic_heatpump_climate.cpp index 82403da..ec219b2 100644 --- a/components/panasonic_heatpump/climate/panasonic_heatpump_climate.cpp +++ b/components/panasonic_heatpump/climate/panasonic_heatpump_climate.cpp @@ -82,7 +82,7 @@ void PanasonicHeatpumpClimate::control(const climate::ClimateCall& call) { } this->publish_state(); - this->keep_state_ = 2; + this->keep_state_ = KEEP_STATE; } void PanasonicHeatpumpClimate::publish_new_state(const std::vector& data) { diff --git a/components/panasonic_heatpump/number/panasonic_heatpump_number.cpp b/components/panasonic_heatpump/number/panasonic_heatpump_number.cpp index 86b46d4..57389e0 100644 --- a/components/panasonic_heatpump/number/panasonic_heatpump_number.cpp +++ b/components/panasonic_heatpump/number/panasonic_heatpump_number.cpp @@ -116,7 +116,7 @@ void PanasonicHeatpumpNumber::control(float value) { }; this->publish_state(state); - this->keep_state_ = 2; + this->keep_state_ = KEEP_STATE; } void PanasonicHeatpumpNumber::publish_new_state(const std::vector& data) { diff --git a/components/panasonic_heatpump/panasonic_heatpump.h b/components/panasonic_heatpump/panasonic_heatpump.h index 27c737e..f1481bc 100644 --- a/components/panasonic_heatpump/panasonic_heatpump.h +++ b/components/panasonic_heatpump/panasonic_heatpump.h @@ -15,6 +15,10 @@ #define PANASONIC_HEATPUMP_VERSION "0.0.8" #endif +#ifndef KEEP_STATE +#define KEEP_STATE 1 +#endif + namespace esphome { namespace panasonic_heatpump { enum LoopState : uint8_t { diff --git a/components/panasonic_heatpump/select/panasonic_heatpump_select.cpp b/components/panasonic_heatpump/select/panasonic_heatpump_select.cpp index 2fdf519..797fa14 100644 --- a/components/panasonic_heatpump/select/panasonic_heatpump_select.cpp +++ b/components/panasonic_heatpump/select/panasonic_heatpump_select.cpp @@ -42,7 +42,7 @@ void PanasonicHeatpumpSelect::control(const std::string& value) { }; this->publish_state(value); - this->keep_state_ = 2; + this->keep_state_ = KEEP_STATE; } void PanasonicHeatpumpSelect::publish_new_state(const std::vector& data) { diff --git a/components/panasonic_heatpump/switch/__init__.py b/components/panasonic_heatpump/switch/__init__.py index 055dcbd..55992b6 100644 --- a/components/panasonic_heatpump/switch/__init__.py +++ b/components/panasonic_heatpump/switch/__init__.py @@ -20,6 +20,7 @@ CONF_SET31 = "set31" # Set External Error CONF_SET32 = "set32" # Set External Compressor Control CONF_SET33 = "set33" # Set External Heat Cool Control CONF_SET34 = "set34" # Set Bivalent Control +CONF_ERROR = "error_reset" # Error Reset (Restart) TYPES = [ CONF_SET1, @@ -35,6 +36,7 @@ TYPES = [ CONF_SET32, CONF_SET33, CONF_SET34, + CONF_ERROR, ] PanasonicHeatpumpSwitch = panasonic_heatpump_ns.class_( @@ -85,6 +87,9 @@ CONFIG_SCHEMA = cv.Schema( cv.Optional(CONF_SET34): switch.switch_schema( PanasonicHeatpumpSwitch, ), + cv.Optional(CONF_ERROR): switch.switch_schema( + PanasonicHeatpumpSwitch, + ), } ).extend(cv.COMPONENT_SCHEMA) diff --git a/components/panasonic_heatpump/switch/panasonic_heatpump_switch.cpp b/components/panasonic_heatpump/switch/panasonic_heatpump_switch.cpp index 162ec1c..868017c 100644 --- a/components/panasonic_heatpump/switch/panasonic_heatpump_switch.cpp +++ b/components/panasonic_heatpump/switch/panasonic_heatpump_switch.cpp @@ -52,12 +52,15 @@ void PanasonicHeatpumpSwitch::write_state(bool state) { case SwitchIds::CONF_SET34: this->parent_->set_command_byte(PanasonicCommand::setPlus1(value), 26); break; + case SwitchIds::CONF_ERROR: + this->parent_->set_command_byte(value, 8); + break; default: return; }; this->publish_state(state); - this->keep_state_ = 2; + this->keep_state_ = KEEP_STATE; } void PanasonicHeatpumpSwitch::publish_new_state(const std::vector& data) { @@ -130,6 +133,11 @@ void PanasonicHeatpumpSwitch::publish_new_state(const std::vector& data if (this->state == new_state) return; break; + case SwitchIds::CONF_ERROR: + new_state = PanasonicDecode::getBinaryState(data[8]); + if (this->state == new_state) + return; + break; default: return; }; diff --git a/components/panasonic_heatpump/switch/panasonic_heatpump_switch.h b/components/panasonic_heatpump/switch/panasonic_heatpump_switch.h index eeea73e..e6cc3c4 100644 --- a/components/panasonic_heatpump/switch/panasonic_heatpump_switch.h +++ b/components/panasonic_heatpump/switch/panasonic_heatpump_switch.h @@ -21,6 +21,7 @@ enum SwitchIds : uint8_t { CONF_SET32, CONF_SET33, CONF_SET34, + CONF_ERROR, }; class PanasonicHeatpumpSwitch : public switch_::Switch, diff --git a/components/panasonic_heatpump/water_heater/panasonic_heatpump_water_heater.cpp b/components/panasonic_heatpump/water_heater/panasonic_heatpump_water_heater.cpp index 710c0d7..383a7d9 100644 --- a/components/panasonic_heatpump/water_heater/panasonic_heatpump_water_heater.cpp +++ b/components/panasonic_heatpump/water_heater/panasonic_heatpump_water_heater.cpp @@ -40,7 +40,7 @@ void PanasonicHeatpumpWaterHeater::control(const water_heater::WaterHeaterCall& }; this->publish_state(); - this->keep_state_ = 2; + this->keep_state_ = KEEP_STATE; } void PanasonicHeatpumpWaterHeater::publish_new_state(const std::vector& data) { From 3904459871a0fda4cede48a51a318e4176727722 Mon Sep 17 00:00:00 2001 From: ElVit Date: Sun, 22 Mar 2026 10:27:10 +0100 Subject: [PATCH 2/4] Set heatpump version to 0.0.8-beta.2 --- components/panasonic_heatpump/panasonic_heatpump.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/panasonic_heatpump/panasonic_heatpump.h b/components/panasonic_heatpump/panasonic_heatpump.h index f1481bc..e422eb0 100644 --- a/components/panasonic_heatpump/panasonic_heatpump.h +++ b/components/panasonic_heatpump/panasonic_heatpump.h @@ -12,7 +12,7 @@ #include "commands.h" #ifndef PANASONIC_HEATPUMP_VERSION -#define PANASONIC_HEATPUMP_VERSION "0.0.8" +#define PANASONIC_HEATPUMP_VERSION "0.0.8-beta.2" #endif #ifndef KEEP_STATE From 49067807071477d66f5e8cde66a52e24cdf1e974 Mon Sep 17 00:00:00 2001 From: ElVit Date: Sun, 22 Mar 2026 13:19:47 +0100 Subject: [PATCH 3/4] Do not chunk uart messages --- components/panasonic_heatpump/helpers.cpp | 6 +----- components/panasonic_heatpump/helpers.h | 4 ---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/components/panasonic_heatpump/helpers.cpp b/components/panasonic_heatpump/helpers.cpp index a2fdaf8..29e5b71 100644 --- a/components/panasonic_heatpump/helpers.cpp +++ b/components/panasonic_heatpump/helpers.cpp @@ -32,11 +32,7 @@ void PanasonicHelpers::log_uart_hex(UartLogDirection direction, const uint8_t* d delay(10); logStr += byte_array_to_hex_string(data, length, separator); - - for (size_t i = 0; i < logStr.length(); i += UART_LOG_CHUNK_SIZE) { - ESP_LOGI(TAG, "%s %s", msgDir.c_str(), logStr.substr(i, UART_LOG_CHUNK_SIZE).c_str()); - delay(10); - } + ESP_LOGI(TAG, "%s %s", msgDir.c_str(), logStr.c_str()); } std::string PanasonicHelpers::byte_array_to_hex_string(const std::vector& data, const char separator) { diff --git a/components/panasonic_heatpump/helpers.h b/components/panasonic_heatpump/helpers.h index af71f9c..042234a 100644 --- a/components/panasonic_heatpump/helpers.h +++ b/components/panasonic_heatpump/helpers.h @@ -5,10 +5,6 @@ #include #include -#ifndef UART_LOG_CHUNK_SIZE -#define UART_LOG_CHUNK_SIZE 120 -#endif - namespace esphome { namespace panasonic_heatpump { enum UartLogDirection : uint8_t { From 668795309c00d97cf6c3bc54edff0dc8906e2073 Mon Sep 17 00:00:00 2001 From: ElVit Date: Sun, 22 Mar 2026 13:29:45 +0100 Subject: [PATCH 4/4] Add error_reset to unit test --- components/panasonic_heatpump/README.md | 2 +- components/panasonic_heatpump/switch/__init__.py | 2 +- tests/panasonic_heatpump/test_panasonic_heatpump_full.yaml | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/panasonic_heatpump/README.md b/components/panasonic_heatpump/README.md index 041758d..4167139 100644 --- a/components/panasonic_heatpump/README.md +++ b/components/panasonic_heatpump/README.md @@ -566,7 +566,7 @@ switch: set34: name: "Set Bivalent Control" error_reset: - name: "Error Reset (Restart)" + name: "Error Reset (Restart Heatpump)" ``` ### Selects diff --git a/components/panasonic_heatpump/switch/__init__.py b/components/panasonic_heatpump/switch/__init__.py index 55992b6..150ec64 100644 --- a/components/panasonic_heatpump/switch/__init__.py +++ b/components/panasonic_heatpump/switch/__init__.py @@ -20,7 +20,7 @@ CONF_SET31 = "set31" # Set External Error CONF_SET32 = "set32" # Set External Compressor Control CONF_SET33 = "set33" # Set External Heat Cool Control CONF_SET34 = "set34" # Set Bivalent Control -CONF_ERROR = "error_reset" # Error Reset (Restart) +CONF_ERROR = "error_reset" # Error Reset (Restart Heatpump) TYPES = [ CONF_SET1, diff --git a/tests/panasonic_heatpump/test_panasonic_heatpump_full.yaml b/tests/panasonic_heatpump/test_panasonic_heatpump_full.yaml index 26441ac..7841fbe 100644 --- a/tests/panasonic_heatpump/test_panasonic_heatpump_full.yaml +++ b/tests/panasonic_heatpump/test_panasonic_heatpump_full.yaml @@ -469,6 +469,8 @@ switch: name: "Set External Heat Cool Control" set34: name: "Set Bivalent Control" + error_reset: + name: "Error Reset (Restart Heatpump)" # Test climate platform climate: