ESPHome  2024.5.4
template_cover.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace template_ {
9 
14 };
15 
16 class TemplateCover : public cover::Cover, public Component {
17  public:
18  TemplateCover();
19 
20  void set_state_lambda(std::function<optional<float>()> &&f);
21  Trigger<> *get_open_trigger() const;
23  Trigger<> *get_stop_trigger() const;
27  void set_optimistic(bool optimistic);
28  void set_assumed_state(bool assumed_state);
29  void set_tilt_lambda(std::function<optional<float>()> &&tilt_f);
30  void set_has_stop(bool has_stop);
31  void set_has_position(bool has_position);
32  void set_has_tilt(bool has_tilt);
33  void set_has_toggle(bool has_toggle);
34  void set_restore_mode(TemplateCoverRestoreMode restore_mode) { restore_mode_ = restore_mode; }
35 
36  void setup() override;
37  void loop() override;
38  void dump_config() override;
39 
40  float get_setup_priority() const override;
41 
42  protected:
43  void control(const cover::CoverCall &call) override;
44  cover::CoverTraits get_traits() override;
45  void stop_prev_trigger_();
46 
50  bool assumed_state_{false};
51  bool optimistic_{false};
54  bool has_stop_{false};
55  bool has_toggle_{false};
60  bool has_position_{false};
62  bool has_tilt_{false};
63 };
64 
65 } // namespace template_
66 } // namespace esphome
float get_setup_priority() const override
void set_has_toggle(bool has_toggle)
Base class for all cover devices.
Definition: cover.h:111
void set_has_position(bool has_position)
Trigger< float > * position_trigger_
cover::CoverTraits get_traits() override
void set_tilt_lambda(std::function< optional< float >()> &&tilt_f)
void set_optimistic(bool optimistic)
void control(const cover::CoverCall &call) override
void set_restore_mode(TemplateCoverRestoreMode restore_mode)
void set_state_lambda(std::function< optional< float >()> &&f)
TemplateCoverRestoreMode restore_mode_
Trigger< float > * get_position_trigger() const
void set_assumed_state(bool assumed_state)
optional< std::function< optional< float >)> > state_f_
optional< std::function< optional< float >)> > tilt_f_
Trigger< float > * get_tilt_trigger() const
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7