1
0
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:
Jesse Hills
2023-11-28 09:57:40 +13:00
committed by GitHub
parent f63f722afb
commit 3b77f05cc9
2 changed files with 17 additions and 0 deletions

View File

@@ -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