From 04734bbfe76d37aa4664a88680a7886750d5461f Mon Sep 17 00:00:00 2001 From: Oliver Kleinecke Date: Wed, 5 Feb 2025 14:57:02 +0100 Subject: [PATCH] Update mcp4461_output.h --- esphome/components/mcp4461/output/mcp4461_output.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/esphome/components/mcp4461/output/mcp4461_output.h b/esphome/components/mcp4461/output/mcp4461_output.h index 39fb7c5264..acb6d17ab4 100644 --- a/esphome/components/mcp4461/output/mcp4461_output.h +++ b/esphome/components/mcp4461/output/mcp4461_output.h @@ -30,6 +30,14 @@ class Mcp4461Wiper : public output::FloatOutput { parent->disable_terminal(wiper, 'b'); if (!terminal_w && wiper_idx < 4) parent->disable_terminal(wiper, 'w'); + if (initial_value != 1.0 && initial_value >= 0.000 && initial_value <= 0.256) { + // Use the value + this->initial_value_ = initial_value; + ESP_LOGCONFIG(TAG, "Setting initial value %.3f", this->initial_value_); + this->_parent->set_wiper_level(wiper, this->initial_value_); + } else { + ESP_LOGCONFIG(TAG, "No (valid) initial value set, retaining previous wiper level."); + } } uint16_t get_wiper_level(); void save_level();