From 08b67e7aead8079e80ed526e80f41bc772256fa9 Mon Sep 17 00:00:00 2001 From: WeekendWarrior1 Date: Wed, 14 Jul 2021 12:43:30 +1000 Subject: [PATCH] catch 0.0 in float set_level pre-adjustment (#2013) --- esphome/components/output/float_output.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/esphome/components/output/float_output.cpp b/esphome/components/output/float_output.cpp index f44383db36..99ba798cb9 100644 --- a/esphome/components/output/float_output.cpp +++ b/esphome/components/output/float_output.cpp @@ -31,6 +31,10 @@ void FloatOutput::set_level(float state) { #endif if (this->is_inverted()) state = 1.0f - state; + if (state == 0.0f) { // regardless of min_power_, 0.0 means off + this->write_state(state); + return; + } float adjusted_value = (state * (this->max_power_ - this->min_power_)) + this->min_power_; this->write_state(adjusted_value); }