ESPHome  2024.11.0
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_invert_position_report(bool invert_position_report) { invert_position_report_ = invert_position_report; }
29  void set_restore_mode(TuyaCoverRestoreMode restore_mode) { restore_mode_ = restore_mode; }
30 
31  protected:
32  void control(const cover::CoverCall &call) override;
33  void set_direction_(bool inverted);
34  cover::CoverTraits get_traits() override;
35 
42  uint32_t min_value_;
43  uint32_t max_value_;
44  uint32_t value_range_;
47 };
48 
49 } // namespace tuya
50 } // namespace esphome
void set_min_value(uint32_t min_value)
Definition: tuya_cover.h:25
void set_invert_position_report(bool invert_position_report)
Definition: tuya_cover.h:28
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:39
void set_invert_position(bool invert_position)
Definition: tuya_cover.h:27
cover::CoverTraits get_traits() override
Definition: tuya_cover.cpp:132
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:37
void set_position_id(uint8_t position_id)
Definition: tuya_cover.h:22
optional< uint8_t > position_report_id_
Definition: tuya_cover.h:41
void set_restore_mode(TuyaCoverRestoreMode restore_mode)
Definition: tuya_cover.h:29
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:38
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
optional< uint8_t > position_id_
Definition: tuya_cover.h:40
void dump_config() override
Definition: tuya_cover.cpp:106