ESPHome  2024.10.2
template_select.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 namespace esphome {
9 namespace template_ {
10 
12  public:
13  void set_template(std::function<optional<std::string>()> &&f) { this->f_ = f; }
14 
15  void setup() override;
16  void update() override;
17  void dump_config() override;
18  float get_setup_priority() const override { return setup_priority::HARDWARE; }
19 
21  void set_optimistic(bool optimistic) { this->optimistic_ = optimistic; }
22  void set_initial_option(const std::string &initial_option) { this->initial_option_ = initial_option; }
23  void set_restore_value(bool restore_value) { this->restore_value_ = restore_value; }
24 
25  protected:
26  void control(const std::string &value) override;
27  bool optimistic_ = false;
28  std::string initial_option_;
29  bool restore_value_ = false;
32 
34 };
35 
36 } // namespace template_
37 } // namespace esphome
This class simplifies creating components that periodically check a state.
Definition: component.h:283
optional< std::function< optional< std::string >)> > f_
void set_initial_option(const std::string &initial_option)
void control(const std::string &value) override
void set_restore_value(bool restore_value)
void set_template(std::function< optional< std::string >()> &&f)
Trigger< std::string > * get_set_trigger() const
void set_optimistic(bool optimistic)
float get_setup_priority() const override
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition: component.cpp:18
Base-class for all selects.
Definition: select.h:31
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Trigger< std::string > * set_trigger_