1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-17 15:26:01 +00:00

[output] Add set_min_power & set_max_power actions for FloatOutput (#8934)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Djordje Mandic
2025-07-29 07:22:44 +02:00
committed by GitHub
parent 4ff3137c0d
commit 6d30269565
3 changed files with 68 additions and 0 deletions

View File

@@ -40,5 +40,29 @@ template<typename... Ts> class SetLevelAction : public Action<Ts...> {
FloatOutput *output_;
};
template<typename... Ts> class SetMinPowerAction : public Action<Ts...> {
public:
SetMinPowerAction(FloatOutput *output) : output_(output) {}
TEMPLATABLE_VALUE(float, min_power)
void play(Ts... x) override { this->output_->set_min_power(this->min_power_.value(x...)); }
protected:
FloatOutput *output_;
};
template<typename... Ts> class SetMaxPowerAction : public Action<Ts...> {
public:
SetMaxPowerAction(FloatOutput *output) : output_(output) {}
TEMPLATABLE_VALUE(float, max_power)
void play(Ts... x) override { this->output_->set_max_power(this->max_power_.value(x...)); }
protected:
FloatOutput *output_;
};
} // namespace output
} // namespace esphome