mirror of
https://github.com/esphome/esphome.git
synced 2026-02-08 00:31:58 +00:00
clamp
This commit is contained in:
@@ -65,7 +65,7 @@ void FanCall::validate_() {
|
|||||||
auto traits = this->parent_.get_traits();
|
auto traits = this->parent_.get_traits();
|
||||||
|
|
||||||
if (this->speed_.has_value()) {
|
if (this->speed_.has_value()) {
|
||||||
this->speed_ = clamp(*this->speed_, 1, traits.supported_speed_count());
|
this->speed_ = clamp(*this->speed_, 1, static_cast<int>(traits.supported_speed_count()));
|
||||||
|
|
||||||
// https://developers.home-assistant.io/docs/core/entity/fan/#preset-modes
|
// https://developers.home-assistant.io/docs/core/entity/fan/#preset-modes
|
||||||
// "Manually setting a speed must disable any set preset mode"
|
// "Manually setting a speed must disable any set preset mode"
|
||||||
|
|||||||
Reference in New Issue
Block a user