ESPHome  2022.6.3
tuya_cover.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace tuya {
9 
14 };
15 
16 class TuyaCover : public cover::Cover, public Component {
17  public:
18  void setup() override;
19  void dump_config() override;
20  void set_control_id(uint8_t control_id) { this->control_id_ = control_id; }
21  void set_direction_id(uint8_t direction_id) { this->direction_id_ = direction_id; }
22  void set_position_id(uint8_t position_id) { this->position_id_ = position_id; }
23  void set_position_report_id(uint8_t position_report_id) { this->position_report_id_ = position_report_id; }
24  void set_tuya_parent(Tuya *parent) { this->parent_ = parent; }
25  void set_min_value(uint32_t min_value) { min_value_ = min_value; }
26  void set_max_value(uint32_t max_value) { max_value_ = max_value; }
27  void set_invert_position(bool invert_position) { invert_position_ = invert_position; }
28  void set_restore_mode(TuyaCoverRestoreMode restore_mode) { restore_mode_ = restore_mode; }
29 
30  protected:
31  void control(const cover::CoverCall &call) override;
32  void set_direction_(bool inverted);
33  cover::CoverTraits get_traits() override;
34 
41  uint32_t min_value_;
42  uint32_t max_value_;
43  uint32_t value_range_;
45 };
46 
47 } // namespace tuya
48 } // namespace esphome
void set_min_value(uint32_t min_value)
Definition: tuya_cover.h:25
void set_position_report_id(uint8_t position_report_id)
Definition: tuya_cover.h:23
Base class for all cover devices.
Definition: cover.h:111
optional< uint8_t > direction_id_
Definition: tuya_cover.h:38
void set_invert_position(bool invert_position)
Definition: tuya_cover.h:27
cover::CoverTraits get_traits() override
Definition: tuya_cover.cpp:125
void set_direction_id(uint8_t direction_id)
Definition: tuya_cover.h:21
void set_direction_(bool inverted)
Definition: tuya_cover.cpp:92
TuyaCoverRestoreMode restore_mode_
Definition: tuya_cover.h:36
void set_position_id(uint8_t position_id)
Definition: tuya_cover.h:22
optional< uint8_t > position_report_id_
Definition: tuya_cover.h:40
void set_restore_mode(TuyaCoverRestoreMode restore_mode)
Definition: tuya_cover.h:28
void set_control_id(uint8_t control_id)
Definition: tuya_cover.h:20
void setup() override
Definition: tuya_cover.cpp:15
void control(const cover::CoverCall &call) override
Definition: tuya_cover.cpp:59
void set_max_value(uint32_t max_value)
Definition: tuya_cover.h:26
void set_tuya_parent(Tuya *parent)
Definition: tuya_cover.h:24
optional< uint8_t > control_id_
Definition: tuya_cover.h:37
Definition: a4988.cpp:4
optional< uint8_t > position_id_
Definition: tuya_cover.h:39
void dump_config() override
Definition: tuya_cover.cpp:106