ESPHome 2025.5.0
Loading...
Searching...
No Matches
automation.h
Go to the documentation of this file.
1#pragma once
2
3#include "micro_wake_word.h"
4#include "streaming_model.h"
5
6#ifdef USE_ESP_IDF
7namespace esphome {
8namespace micro_wake_word {
9
10template<typename... Ts> class StartAction : public Action<Ts...>, public Parented<MicroWakeWord> {
11 public:
12 void play(Ts... x) override { this->parent_->start(); }
13};
14
15template<typename... Ts> class StopAction : public Action<Ts...>, public Parented<MicroWakeWord> {
16 public:
17 void play(Ts... x) override { this->parent_->stop(); }
18};
19
20template<typename... Ts> class IsRunningCondition : public Condition<Ts...>, public Parented<MicroWakeWord> {
21 public:
22 bool check(Ts... x) override { return this->parent_->is_running(); }
23};
24
25template<typename... Ts> class EnableModelAction : public Action<Ts...> {
26 public:
27 explicit EnableModelAction(WakeWordModel *wake_word_model) : wake_word_model_(wake_word_model) {}
28 void play(Ts... x) override { this->wake_word_model_->enable(); }
29
30 protected:
32};
33
34template<typename... Ts> class DisableModelAction : public Action<Ts...> {
35 public:
36 explicit DisableModelAction(WakeWordModel *wake_word_model) : wake_word_model_(wake_word_model) {}
37 void play(Ts... x) override { this->wake_word_model_->disable(); }
38
39 protected:
41};
42
43template<typename... Ts> class ModelIsEnabledCondition : public Condition<Ts...> {
44 public:
45 explicit ModelIsEnabledCondition(WakeWordModel *wake_word_model) : wake_word_model_(wake_word_model) {}
46 bool check(Ts... x) override { return this->wake_word_model_->is_enabled(); }
47
48 protected:
50};
51
52} // namespace micro_wake_word
53} // namespace esphome
54#endif
Base class for all automation conditions.
Definition automation.h:75
Helper class to easily give an object a parent of type T.
Definition helpers.h:538
DisableModelAction(WakeWordModel *wake_word_model)
Definition automation.h:36
EnableModelAction(WakeWordModel *wake_word_model)
Definition automation.h:27
ModelIsEnabledCondition(WakeWordModel *wake_word_model)
Definition automation.h:45
void play(Ts... x) override
Definition automation.h:17
bool is_enabled() const
Return true if the model is enabled.
void enable() override
Enable the model and save to flash. The next performing_streaming_inference call will load it.
void disable() override
Disable the model and save to flash. The next performing_streaming_inference call will unload it.
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t x
Definition tt21100.cpp:5