41 void play(
const Ts &...
x)
override {
42 auto ssid = this->ssid_.value(
x...);
43 auto password = this->password_.value(
x...);
48 char ssid_buf[SSID_BUFFER_SIZE];
66 if (this->save_.value(
x...)) {
74 this->
set_timeout(
"wifi-connect-timeout", this->connection_timeout_.value(
x...), [
this,
x...]() {
76 global_wifi_component->disable();
77 global_wifi_component->save_wifi_sta(old_sta_.get_ssid(), old_sta_.get_password());
78 global_wifi_component->enable();
80 this->set_timeout(
"wifi-fallback-timeout", this->connection_timeout_.value(x...), [this]() {
81 this->connecting_ = false;
82 this->error_trigger_.trigger();
87 Trigger<> *get_connect_trigger() {
return &this->connect_trigger_; }
91 if (!this->connecting_)
95 this->cancel_timeout(
"wifi-connect-timeout");
96 this->cancel_timeout(
"wifi-fallback-timeout");
97 this->connecting_ =
false;
98 char ssid_buf[SSID_BUFFER_SIZE];
101 this->connect_trigger_.trigger();
104 this->error_trigger_.trigger();
110 bool connecting_{
false};
virtual void play(const Ts &...x)=0
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_timeout(const std voi set_timeout)(const char *name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
Base class for all automation conditions.
void trigger(const Ts &...x)
Inform the parent automation that the event has triggered.
bool check(const Ts &...x) override
StringRef get_ssid() const
void set_ssid(const std::string &ssid)
StringRef get_password() const
void set_password(const std::string &password)
void set_sta(const WiFiAP &ap)
void save_wifi_sta(const std::string &ssid, const std::string &password)
ESPDEPRECATED("Use wifi_ssid_to() instead. Removed in 2026.9.0", "2026.3.0") std const char * wifi_ssid_to(std::span< char, SSID_BUFFER_SIZE > buffer)
Write SSID to buffer without heap allocation.
bool is_ap_active() const
bool check(const Ts &...x) override
void play(const Ts &...x) override
void play(const Ts &...x) override
bool check(const Ts &...x) override
WiFiComponent * global_wifi_component