ESPHome 2025.12.0-dev
Loading...
Searching...
No Matches
template_select.h
Go to the documentation of this file.
1#pragma once
2
8
9namespace esphome {
10namespace template_ {
11
12class TemplateSelect final : public select::Select, public PollingComponent {
13 public:
14 template<typename F> void set_template(F &&f) { this->f_.set(std::forward<F>(f)); }
15
16 void setup() override;
17 void update() override;
18 void dump_config() override;
19 float get_setup_priority() const override { return setup_priority::HARDWARE; }
20
22 void set_optimistic(bool optimistic) { this->optimistic_ = optimistic; }
23 void set_initial_option_index(size_t initial_option_index) { this->initial_option_index_ = initial_option_index; }
24 void set_restore_value(bool restore_value) { this->restore_value_ = restore_value; }
25
26 protected:
27 void control(size_t index) override;
28 bool optimistic_ = false;
30 bool restore_value_ = false;
33
35};
36
37} // namespace template_
38} // namespace esphome
This class simplifies creating components that periodically check a state.
Definition component.h:437
Lightweight wrapper for template platform lambdas (stateless function pointers only).
void set(optional< T >(*f)(Args...))
Set the lambda function pointer.
Base-class for all selects.
Definition select.h:31
Trigger< std::string > * get_set_trigger() const
void set_restore_value(bool restore_value)
Trigger< std::string > * set_trigger_
void control(size_t index) override
float get_setup_priority() const override
void set_initial_option_index(size_t initial_option_index)
TemplateLambda< std::string > f_
void set_optimistic(bool optimistic)
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition component.cpp:58
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7