From 30a174a311e67fcc1becacad860f02b4cf8713a9 Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 11:50:41 +0100
Subject: [PATCH 01/15] Update mcp4461.h

---
 esphome/components/mcp4461/mcp4461.h | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/esphome/components/mcp4461/mcp4461.h b/esphome/components/mcp4461/mcp4461.h
index cb9ff0cfaa..ce5299763c 100644
--- a/esphome/components/mcp4461/mcp4461.h
+++ b/esphome/components/mcp4461/mcp4461.h
@@ -53,16 +53,6 @@ enum class Mcp4461EepromLocation : uint8_t {
 
 enum class Mcp4461TerminalIdx : uint8_t { MCP4461_TERMINAL_0 = 0, MCP4461_TERMINAL_1 = 1 };
 
-enum ErrorCode {
-  MCP4461_STATUS_OK = 0,           // CMD completed successfully
-  MCP4461_STATUS_I2C_ERROR,        // Unable to communicate with device
-  MCP4461_STATUS_REGISTER_INVALID, // Status register value was invalid
-  MCP4461_VALUE_INVALID,           // Invalid value given for wiper / eeprom
-  MCP4461_STATUS_WRITE_PROTECTED,  // The value was read, but the CRC over the payload (valid and data) does not match
-  MCP4461_STATUS_WIPER_LOCKED,     // The wiper is locked using WiperLock-technology - all actions for this wiper will be aborted/discarded
-} error_code_{MCP4461_STATUS_OK};
-
-
 class Mcp4461Wiper;
 
 // Mcp4461Component
@@ -121,6 +111,15 @@ class Mcp4461Component : public Component, public i2c::I2CDevice {
   bool wiper_1_disabled_{false};
   bool wiper_2_disabled_{false};
   bool wiper_3_disabled_{false};
+
+  enum ErrorCode {
+    MCP4461_STATUS_OK = 0,           // CMD completed successfully
+    MCP4461_STATUS_I2C_ERROR,        // Unable to communicate with device
+    MCP4461_STATUS_REGISTER_INVALID, // Status register value was invalid
+    MCP4461_VALUE_INVALID,           // Invalid value given for wiper / eeprom
+    MCP4461_WRITE_PROTECTED,  // The value was read, but the CRC over the payload (valid and data) does not match
+    MCP4461_WIPER_LOCKED,     // The wiper is locked using WiperLock-technology - all actions for this wiper will be aborted/discarded
+  } error_code_{MCP4461_STATUS_OK};
 };
 }  // namespace mcp4461
 }  // namespace esphome

From 7ec29930287cf937fb3b25503e0c845bee828555 Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 11:55:02 +0100
Subject: [PATCH 02/15] Update mcp4461.h

---
 esphome/components/mcp4461/mcp4461.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/esphome/components/mcp4461/mcp4461.h b/esphome/components/mcp4461/mcp4461.h
index ce5299763c..fe3da5c632 100644
--- a/esphome/components/mcp4461/mcp4461.h
+++ b/esphome/components/mcp4461/mcp4461.h
@@ -116,9 +116,11 @@ class Mcp4461Component : public Component, public i2c::I2CDevice {
     MCP4461_STATUS_OK = 0,           // CMD completed successfully
     MCP4461_STATUS_I2C_ERROR,        // Unable to communicate with device
     MCP4461_STATUS_REGISTER_INVALID, // Status register value was invalid
+    MCP4461_PARENT_FAILED,           // Parent component failed
     MCP4461_VALUE_INVALID,           // Invalid value given for wiper / eeprom
-    MCP4461_WRITE_PROTECTED,  // The value was read, but the CRC over the payload (valid and data) does not match
-    MCP4461_WIPER_LOCKED,     // The wiper is locked using WiperLock-technology - all actions for this wiper will be aborted/discarded
+    MCP4461_WRITE_PROTECTED,         // The value was read, but the CRC over the payload (valid and data) does not match
+    MCP4461_WIPER_DISABLED,          // The wiper is disabled - all actions for this wiper will be aborted/discarded
+    MCP4461_WIPER_LOCKED,            // The wiper is locked using WiperLock-technology - all actions for this wiper will be aborted/discarded
   } error_code_{MCP4461_STATUS_OK};
 };
 }  // namespace mcp4461

From d8b4ff7e1f6d979538dada17db597d66fecabc07 Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:00:28 +0100
Subject: [PATCH 03/15] Update mcp4461.cpp

---
 esphome/components/mcp4461/mcp4461.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/esphome/components/mcp4461/mcp4461.cpp b/esphome/components/mcp4461/mcp4461.cpp
index 2b84997b99..a0f19ce65c 100644
--- a/esphome/components/mcp4461/mcp4461.cpp
+++ b/esphome/components/mcp4461/mcp4461.cpp
@@ -227,7 +227,7 @@ uint16_t Mcp4461Component::get_wiper_level(Mcp4461WiperIdx wiper) {
   }
   if (!(this->reg_[wiper_idx].enabled)) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_DISABLED)));
-    return;
+    return 0;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   if (!(this->reg_[wiper_idx].enabled)) {
@@ -259,7 +259,7 @@ uint16_t Mcp4461Component::read_wiper_level_(uint8_t wiper) {
 void Mcp4461Component::update_wiper_level(Mcp4461WiperIdx wiper) {
   if (this->is_failed()) {
     ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(this->error_code_)));
-    return 0;
+    return;
   }
   if (!(this->reg_[wiper_idx].enabled)) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_DISABLED)));
@@ -288,7 +288,7 @@ void Mcp4461Component::set_wiper_level(Mcp4461WiperIdx wiper, uint16_t value) {
   }
   if (this->reg_[wiper_idx].wiper_lock_active) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_LOCKED)));
-    return false;
+    return;
   }
   ESP_LOGV(TAG, "Setting MCP4461 wiper %" PRIu8 " to %" PRIu16 "!", wiper_idx, value);
   this->reg_[wiper_idx].state = value;
@@ -319,7 +319,7 @@ void Mcp4461Component::enable_wiper(Mcp4461WiperIdx wiper) {
   }
   if (this->reg_[wiper_idx].wiper_lock_active) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_LOCKED)));
-    return false;
+    return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   ESP_LOGV(TAG, "Enabling wiper %" PRIu8, wiper_idx);
@@ -338,7 +338,7 @@ void Mcp4461Component::disable_wiper(Mcp4461WiperIdx wiper) {
   }
   if (this->reg_[wiper_idx].wiper_lock_active) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_LOCKED)));
-    return false;
+    return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   ESP_LOGV(TAG, "Disabling wiper %" PRIu8, wiper_idx);
@@ -354,7 +354,7 @@ bool Mcp4461Component::increase_wiper(Mcp4461WiperIdx wiper) {
   uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   if (!(this->reg_[wiper_idx].enabled)) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_DISABLED)));
-    return;
+    return false;
   }
   if (this->reg_[wiper_idx].wiper_lock_active) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_LOCKED)));
@@ -384,7 +384,7 @@ bool Mcp4461Component::decrease_wiper(Mcp4461WiperIdx wiper) {
   uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   if (!(this->reg_[wiper_idx].enabled)) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_DISABLED)));
-    return;
+    return false;
   }
   if (this->reg_[wiper_idx].wiper_lock_active) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_LOCKED)));
@@ -455,7 +455,7 @@ uint8_t Mcp4461Component::get_terminal_register(Mcp4461TerminalIdx terminal_conn
 
 void Mcp4461Component::update_terminal_register(Mcp4461TerminalIdx terminal_connector) {
   if (this->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
     return;
   }
   if ((static_cast<uint8_t>(terminal_connector) != 0 && static_cast<uint8_t>(terminal_connector) != 1)) {

From b0f19c41986e36be30634b2bd6efa49139c5b252 Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:02:03 +0100
Subject: [PATCH 04/15] Update mcp4461.cpp

---
 esphome/components/mcp4461/mcp4461.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/esphome/components/mcp4461/mcp4461.cpp b/esphome/components/mcp4461/mcp4461.cpp
index a0f19ce65c..1fc0bb2232 100644
--- a/esphome/components/mcp4461/mcp4461.cpp
+++ b/esphome/components/mcp4461/mcp4461.cpp
@@ -52,6 +52,8 @@ static const LogString *mcp4461_get_message_string_(int status) {
       return LOG_STR("Status register could not be read");
     case Mcp4461Component::MCP4461_STATUS_REGISTER_INVALID:
       return LOG_STR("Invalid status register value - bits 1,7 or 8 are 0");
+    case Mcp4461Component::MCP4461_STATUS_REGISTER_ERROR:
+      return LOG_STR("Parent component failed");
     case Mcp4461Component::MCP4461_VALUE_INVALID:
       return LOG_STR("Invalid value for wiper given");
     case Mcp4461Component::MCP4461_WRITE_PROTECTED:

From 2b8a11f6163996e3559a810bb19d8142ad0b8bf0 Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:02:33 +0100
Subject: [PATCH 05/15] Update mcp4461.cpp

---
 esphome/components/mcp4461/mcp4461.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/esphome/components/mcp4461/mcp4461.cpp b/esphome/components/mcp4461/mcp4461.cpp
index 1fc0bb2232..e1beb0f951 100644
--- a/esphome/components/mcp4461/mcp4461.cpp
+++ b/esphome/components/mcp4461/mcp4461.cpp
@@ -52,7 +52,7 @@ static const LogString *mcp4461_get_message_string_(int status) {
       return LOG_STR("Status register could not be read");
     case Mcp4461Component::MCP4461_STATUS_REGISTER_INVALID:
       return LOG_STR("Invalid status register value - bits 1,7 or 8 are 0");
-    case Mcp4461Component::MCP4461_STATUS_REGISTER_ERROR:
+    case Mcp4461Component::MCP4461_PARENT_FAILED:
       return LOG_STR("Parent component failed");
     case Mcp4461Component::MCP4461_VALUE_INVALID:
       return LOG_STR("Invalid value for wiper given");

From 40674f5ad278baac1875a9f725ac94790c5f696d Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:03:27 +0100
Subject: [PATCH 06/15] Update mcp4461.h

---
 esphome/components/mcp4461/mcp4461.h | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/esphome/components/mcp4461/mcp4461.h b/esphome/components/mcp4461/mcp4461.h
index fe3da5c632..015bd52dc4 100644
--- a/esphome/components/mcp4461/mcp4461.h
+++ b/esphome/components/mcp4461/mcp4461.h
@@ -91,6 +91,18 @@ class Mcp4461Component : public Component, public i2c::I2CDevice {
   bool set_eeprom_value(Mcp4461EepromLocation location, uint16_t value);
   void set_initial_value(Mcp4461WiperIdx wiper, float initial_value);
 
+  enum ErrorCode {
+    MCP4461_STATUS_OK = 0,           // CMD completed successfully
+    MCP4461_STATUS_I2C_ERROR,        // Unable to communicate with device
+    MCP4461_STATUS_REGISTER_INVALID, // Status register value was invalid
+    MCP4461_STATUS_REGISTER_ERROR,
+    MCP4461_PARENT_FAILED,           // Parent component failed
+    MCP4461_VALUE_INVALID,           // Invalid value given for wiper / eeprom
+    MCP4461_WRITE_PROTECTED,         // The value was read, but the CRC over the payload (valid and data) does not match
+    MCP4461_WIPER_DISABLED,          // The wiper is disabled - all actions for this wiper will be aborted/discarded
+    MCP4461_WIPER_LOCKED,            // The wiper is locked using WiperLock-technology - all actions for this wiper will be aborted/discarded
+  } error_code_{MCP4461_STATUS_OK};
+
  protected:
   friend class Mcp4461Wiper;
   void set_write_protection_status_();
@@ -111,17 +123,6 @@ class Mcp4461Component : public Component, public i2c::I2CDevice {
   bool wiper_1_disabled_{false};
   bool wiper_2_disabled_{false};
   bool wiper_3_disabled_{false};
-
-  enum ErrorCode {
-    MCP4461_STATUS_OK = 0,           // CMD completed successfully
-    MCP4461_STATUS_I2C_ERROR,        // Unable to communicate with device
-    MCP4461_STATUS_REGISTER_INVALID, // Status register value was invalid
-    MCP4461_PARENT_FAILED,           // Parent component failed
-    MCP4461_VALUE_INVALID,           // Invalid value given for wiper / eeprom
-    MCP4461_WRITE_PROTECTED,         // The value was read, but the CRC over the payload (valid and data) does not match
-    MCP4461_WIPER_DISABLED,          // The wiper is disabled - all actions for this wiper will be aborted/discarded
-    MCP4461_WIPER_LOCKED,            // The wiper is locked using WiperLock-technology - all actions for this wiper will be aborted/discarded
-  } error_code_{MCP4461_STATUS_OK};
 };
 }  // namespace mcp4461
 }  // namespace esphome

From 5c50640ebc6d9909d54c0664fda2c1694486cbd9 Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:06:09 +0100
Subject: [PATCH 07/15] Update mcp4461_output.cpp

---
 .../components/mcp4461/output/mcp4461_output.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/esphome/components/mcp4461/output/mcp4461_output.cpp b/esphome/components/mcp4461/output/mcp4461_output.cpp
index aceca5307c..62e8a78a25 100644
--- a/esphome/components/mcp4461/output/mcp4461_output.cpp
+++ b/esphome/components/mcp4461/output/mcp4461_output.cpp
@@ -11,7 +11,7 @@ static const char *const TAG = "mcp4461.output";
 
 void Mcp4461Wiper::write_state(float state) {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -33,7 +33,7 @@ uint16_t Mcp4461Wiper::get_wiper_level() { return this->parent_->get_wiper_level
 
 void Mcp4461Wiper::save_level() {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -49,7 +49,7 @@ void Mcp4461Wiper::save_level() {
 
 void Mcp4461Wiper::enable_wiper() {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -62,7 +62,7 @@ void Mcp4461Wiper::enable_wiper() {
 
 void Mcp4461Wiper::disable_wiper() {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -75,7 +75,7 @@ void Mcp4461Wiper::disable_wiper() {
 
 void Mcp4461Wiper::increase_wiper() {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -90,7 +90,7 @@ void Mcp4461Wiper::increase_wiper() {
 
 void Mcp4461Wiper::decrease_wiper() {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -105,7 +105,7 @@ void Mcp4461Wiper::decrease_wiper() {
 
 void Mcp4461Wiper::enable_terminal(char terminal) {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -118,7 +118,7 @@ void Mcp4461Wiper::enable_terminal(char terminal) {
 
 void Mcp4461Wiper::disable_terminal(char terminal) {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(LOG_PARENT_FAILED_STR));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);

From adf08f8aca8b64e6d568576dba026b2b1f205fef Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:07:00 +0100
Subject: [PATCH 08/15] Update mcp4461.cpp

---
 esphome/components/mcp4461/mcp4461.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/esphome/components/mcp4461/mcp4461.cpp b/esphome/components/mcp4461/mcp4461.cpp
index e1beb0f951..d9bc5ca6e5 100644
--- a/esphome/components/mcp4461/mcp4461.cpp
+++ b/esphome/components/mcp4461/mcp4461.cpp
@@ -64,7 +64,7 @@ static const LogString *mcp4461_get_message_string_(int status) {
       return LOG_STR("MCP4461 Wiper is disabled. All actions on this wiper are prohibited.");
     case Mcp4461Component::MCP4461_WIPER_LOCKED:
       return LOG_STR("MCP4461 Wiper is locked using WiperLock-technology. All actions on this wiper are prohibited.");
-    case Mcp4461Component:::MCP4461_STATUS_OK:
+    case Mcp4461Component::MCP4461_STATUS_OK:
       return LOG_STR("Status OK");
     default:
       return LOG_STR("Unknown");

From 4190e2901861cf34af3932f6e4b165de9ca16eaa Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:08:08 +0100
Subject: [PATCH 09/15] Update mcp4461.h

---
 esphome/components/mcp4461/mcp4461.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/esphome/components/mcp4461/mcp4461.h b/esphome/components/mcp4461/mcp4461.h
index 015bd52dc4..536130b5c4 100644
--- a/esphome/components/mcp4461/mcp4461.h
+++ b/esphome/components/mcp4461/mcp4461.h
@@ -99,6 +99,7 @@ class Mcp4461Component : public Component, public i2c::I2CDevice {
     MCP4461_PARENT_FAILED,           // Parent component failed
     MCP4461_VALUE_INVALID,           // Invalid value given for wiper / eeprom
     MCP4461_WRITE_PROTECTED,         // The value was read, but the CRC over the payload (valid and data) does not match
+    MCP4461_WIPER_ENABLED,           // The wiper is enabled, discard additional enabling actions
     MCP4461_WIPER_DISABLED,          // The wiper is disabled - all actions for this wiper will be aborted/discarded
     MCP4461_WIPER_LOCKED,            // The wiper is locked using WiperLock-technology - all actions for this wiper will be aborted/discarded
   } error_code_{MCP4461_STATUS_OK};

From b4e0aa00c874a2b315c63d20bb139a02290f0b5b Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:08:44 +0100
Subject: [PATCH 10/15] Update mcp4461.cpp

---
 esphome/components/mcp4461/mcp4461.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/esphome/components/mcp4461/mcp4461.cpp b/esphome/components/mcp4461/mcp4461.cpp
index d9bc5ca6e5..892cb5e91d 100644
--- a/esphome/components/mcp4461/mcp4461.cpp
+++ b/esphome/components/mcp4461/mcp4461.cpp
@@ -167,7 +167,7 @@ void Mcp4461Component::loop() {
 uint8_t Mcp4461Component::get_status_register() {
   if (this->is_failed()) {
     ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(this->error_code_)));
-    return;
+    return 0;
   }
   uint8_t reg = 0;
   reg |= static_cast<uint8_t>(Mcp4461Addresses::MCP4461_STATUS);

From 36ec387e23d8c5593e6aa3262e75578a24bfc714 Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:09:39 +0100
Subject: [PATCH 11/15] Update mcp4461.cpp

---
 esphome/components/mcp4461/mcp4461.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/esphome/components/mcp4461/mcp4461.cpp b/esphome/components/mcp4461/mcp4461.cpp
index 892cb5e91d..965fe56db0 100644
--- a/esphome/components/mcp4461/mcp4461.cpp
+++ b/esphome/components/mcp4461/mcp4461.cpp
@@ -227,11 +227,11 @@ uint16_t Mcp4461Component::get_wiper_level(Mcp4461WiperIdx wiper) {
     ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(this->error_code_)));
     return 0;
   }
+  uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   if (!(this->reg_[wiper_idx].enabled)) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_DISABLED)));
     return 0;
   }
-  uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   if (!(this->reg_[wiper_idx].enabled)) {
     ESP_LOGW(TAG, "reading from disabled volatile wiper %" PRIu8 ", returning 0", wiper_idx);
     return static_cast<uint16_t>(0);

From 376bdaf3f539cb251a20afcd02a96d0ece6f00a2 Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:13:33 +0100
Subject: [PATCH 12/15] Update mcp4461.h

---
 esphome/components/mcp4461/mcp4461.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/esphome/components/mcp4461/mcp4461.h b/esphome/components/mcp4461/mcp4461.h
index 536130b5c4..e9ac6b66ee 100644
--- a/esphome/components/mcp4461/mcp4461.h
+++ b/esphome/components/mcp4461/mcp4461.h
@@ -95,7 +95,7 @@ class Mcp4461Component : public Component, public i2c::I2CDevice {
     MCP4461_STATUS_OK = 0,           // CMD completed successfully
     MCP4461_STATUS_I2C_ERROR,        // Unable to communicate with device
     MCP4461_STATUS_REGISTER_INVALID, // Status register value was invalid
-    MCP4461_STATUS_REGISTER_ERROR,
+    MCP4461_STATUS_REGISTER_ERROR,   // Error fetching status register
     MCP4461_PARENT_FAILED,           // Parent component failed
     MCP4461_VALUE_INVALID,           // Invalid value given for wiper / eeprom
     MCP4461_WRITE_PROTECTED,         // The value was read, but the CRC over the payload (valid and data) does not match

From 01cc629193175e14b41099ff58b6c1807dfb9ac2 Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:14:51 +0100
Subject: [PATCH 13/15] Update mcp4461_output.cpp

---
 .../components/mcp4461/output/mcp4461_output.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/esphome/components/mcp4461/output/mcp4461_output.cpp b/esphome/components/mcp4461/output/mcp4461_output.cpp
index 62e8a78a25..932cf1a5ac 100644
--- a/esphome/components/mcp4461/output/mcp4461_output.cpp
+++ b/esphome/components/mcp4461/output/mcp4461_output.cpp
@@ -11,7 +11,7 @@ static const char *const TAG = "mcp4461.output";
 
 void Mcp4461Wiper::write_state(float state) {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(Mcp4461Component::Mcp4461Component::MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -33,7 +33,7 @@ uint16_t Mcp4461Wiper::get_wiper_level() { return this->parent_->get_wiper_level
 
 void Mcp4461Wiper::save_level() {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(Mcp4461Component::MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -49,7 +49,7 @@ void Mcp4461Wiper::save_level() {
 
 void Mcp4461Wiper::enable_wiper() {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(Mcp4461Component::MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -62,7 +62,7 @@ void Mcp4461Wiper::enable_wiper() {
 
 void Mcp4461Wiper::disable_wiper() {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(Mcp4461Component::MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -75,7 +75,7 @@ void Mcp4461Wiper::disable_wiper() {
 
 void Mcp4461Wiper::increase_wiper() {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(Mcp4461Component::MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -90,7 +90,7 @@ void Mcp4461Wiper::increase_wiper() {
 
 void Mcp4461Wiper::decrease_wiper() {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(Mcp4461Component::MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -105,7 +105,7 @@ void Mcp4461Wiper::decrease_wiper() {
 
 void Mcp4461Wiper::enable_terminal(char terminal) {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(Mcp4461Component::MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);
@@ -118,7 +118,7 @@ void Mcp4461Wiper::enable_terminal(char terminal) {
 
 void Mcp4461Wiper::disable_terminal(char terminal) {
   if (this->parent_->is_failed()) {
-    ESP_LOGE(TAG, "%s", LOG_STR_ARG(MCP4461_PARENT_FAILED));
+    ESP_LOGE(TAG, "%s", LOG_STR_ARG(Mcp4461Component::MCP4461_PARENT_FAILED));
     return;
   }
   uint8_t wiper_idx = static_cast<uint8_t>(this->wiper_);

From d2ba3eef3a1cb347499d6dda86d74e1da9e3f844 Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:15:28 +0100
Subject: [PATCH 14/15] Update mcp4461.cpp

---
 esphome/components/mcp4461/mcp4461.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/esphome/components/mcp4461/mcp4461.cpp b/esphome/components/mcp4461/mcp4461.cpp
index 965fe56db0..f508d63bc6 100644
--- a/esphome/components/mcp4461/mcp4461.cpp
+++ b/esphome/components/mcp4461/mcp4461.cpp
@@ -334,6 +334,7 @@ void Mcp4461Component::disable_wiper(Mcp4461WiperIdx wiper) {
     ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(this->error_code_)));
     return;
   }
+  uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   if (!(this->reg_[wiper_idx].enabled)) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_DISABLED)));
     return;
@@ -342,7 +343,6 @@ void Mcp4461Component::disable_wiper(Mcp4461WiperIdx wiper) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_LOCKED)));
     return;
   }
-  uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   ESP_LOGV(TAG, "Disabling wiper %" PRIu8, wiper_idx);
   this->reg_[wiper_idx].terminal_hw = false;
   this->update_ = true;

From ae6f128951546b37a8373e8a4beb2df88e215714 Mon Sep 17 00:00:00 2001
From: Oliver Kleinecke <okleinecke@web.de>
Date: Sun, 9 Feb 2025 12:17:51 +0100
Subject: [PATCH 15/15] Update mcp4461.cpp

---
 esphome/components/mcp4461/mcp4461.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/esphome/components/mcp4461/mcp4461.cpp b/esphome/components/mcp4461/mcp4461.cpp
index f508d63bc6..0dded2b625 100644
--- a/esphome/components/mcp4461/mcp4461.cpp
+++ b/esphome/components/mcp4461/mcp4461.cpp
@@ -263,11 +263,11 @@ void Mcp4461Component::update_wiper_level(Mcp4461WiperIdx wiper) {
     ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(this->error_code_)));
     return;
   }
+  uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   if (!(this->reg_[wiper_idx].enabled)) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_DISABLED)));
     return;
   }
-  uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   uint16_t data;
   data = this->get_wiper_level(wiper);
   ESP_LOGV(TAG, "Got value %" PRIu16 " from wiper %" PRIu8, data, wiper_idx);
@@ -315,6 +315,7 @@ void Mcp4461Component::enable_wiper(Mcp4461WiperIdx wiper) {
     ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(this->error_code_)));
     return;
   }
+  uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   if ((this->reg_[wiper_idx].enabled)) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_ENABLED)));
     return;
@@ -323,7 +324,6 @@ void Mcp4461Component::enable_wiper(Mcp4461WiperIdx wiper) {
     ESP_LOGW(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string_(MCP4461_WIPER_LOCKED)));
     return;
   }
-  uint8_t wiper_idx = static_cast<uint8_t>(wiper);
   ESP_LOGV(TAG, "Enabling wiper %" PRIu8, wiper_idx);
   this->reg_[wiper_idx].terminal_hw = true;
   this->update_ = true;