mirror of
https://github.com/esphome/esphome.git
synced 2025-09-07 22:02:22 +01:00
Add 'voice_assistant.connected' condition (#5845)
This commit is contained in:
@@ -222,6 +222,11 @@ template<typename... Ts> class IsRunningCondition : public Condition<Ts...>, pub
|
||||
bool check(Ts... x) override { return this->parent_->is_running() || this->parent_->is_continuous(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class ConnectedCondition : public Condition<Ts...>, public Parented<VoiceAssistant> {
|
||||
public:
|
||||
bool check(Ts... x) override { return this->parent_->get_api_connection() != nullptr; }
|
||||
};
|
||||
|
||||
extern VoiceAssistant *global_voice_assistant; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
} // namespace voice_assistant
|
||||
|
Reference in New Issue
Block a user