From b6ee8f8035370025c5bafa7737d9d6f3cd446b65 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 9 Oct 2026 07:15:14 -1000 Subject: [PATCH] [power_supply] Use a numeric scheduler id for the power off timeout (#20367) --- esphome/components/power_supply/power_supply.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/components/power_supply/power_supply.cpp b/esphome/components/power_supply/power_supply.cpp index 7daee1663a..3abffc88e1 100644 --- a/esphome/components/power_supply/power_supply.cpp +++ b/esphome/components/power_supply/power_supply.cpp @@ -5,6 +5,8 @@ namespace esphome::power_supply { ESPHOME_LOG_TAG(TAG, "power_supply"); +static constexpr uint32_t POWER_OFF_TIMEOUT_ID = 0; + void PowerSupply::setup() { this->pin_->setup(); this->pin_->digital_write(false); @@ -31,7 +33,7 @@ bool PowerSupply::is_enabled() const { return this->active_requests_ != 0; } void PowerSupply::request_high_power() { if (this->active_requests_ == 0) { - this->cancel_timeout("power-supply-off"); + this->cancel_timeout(POWER_OFF_TIMEOUT_ID); ESP_LOGV(TAG, "Enabling"); this->pin_->digital_write(true); delay(this->enable_time_); @@ -46,7 +48,7 @@ void PowerSupply::unrequest_high_power() { } this->active_requests_--; if (this->active_requests_ == 0) { - this->set_timeout("power-supply-off", this->keep_on_time_, [this]() { + this->set_timeout(POWER_OFF_TIMEOUT_ID, this->keep_on_time_, [this]() { ESP_LOGV(TAG, "Disabling"); this->pin_->digital_write(false); });