Implement the finish() method and action. implement the is_stopped condition (#7255)

This commit is contained in:
NP v/d Spek
2024-08-14 05:42:43 +02:00
committed by GitHub
parent d6f130e35a
commit cf6ea7cb2c
9 changed files with 77 additions and 15 deletions
+10
View File
@@ -39,10 +39,20 @@ template<typename... Ts> class StopAction : public Action<Ts...>, public Parente
void play(Ts... x) override { this->parent_->stop(); }
};
template<typename... Ts> class FinishAction : public Action<Ts...>, public Parented<Speaker> {
public:
void play(Ts... x) override { this->parent_->finish(); }
};
template<typename... Ts> class IsPlayingCondition : public Condition<Ts...>, public Parented<Speaker> {
public:
bool check(Ts... x) override { return this->parent_->is_running(); }
};
template<typename... Ts> class IsStoppedCondition : public Condition<Ts...>, public Parented<Speaker> {
public:
bool check(Ts... x) override { return this->parent_->is_stopped(); }
};
} // namespace speaker
} // namespace esphome