ESPHome  2024.11.0
he60r.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 namespace esphome {
9 namespace he60r {
10 
11 class HE60rCover : public cover::Cover, public Component, public uart::UARTDevice {
12  public:
13  void setup() override;
14  void loop() override;
15  void dump_config() override;
16  float get_setup_priority() const override { return setup_priority::DATA; };
17 
18  void set_open_duration(uint32_t duration) { this->open_duration_ = duration; }
19  void set_close_duration(uint32_t duration) { this->close_duration_ = duration; }
20 
21  cover::CoverTraits get_traits() override;
22 
23  protected:
24  void update_();
25  void control(const cover::CoverCall &call) override;
26  bool is_at_target_() const;
29  void recompute_position_();
31  void process_rx_(uint8_t data);
32 
33  unsigned open_duration_{0};
34  unsigned close_duration_{0};
35  unsigned toggles_needed_{0};
38  uint32_t last_recompute_time_{0};
39  uint32_t start_dir_time_{0};
40  float target_position_{0};
41  bool query_seen_{};
42  uint8_t counter_{};
43 };
44 
45 } // namespace he60r
46 } // namespace esphome
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
Base class for all cover devices.
Definition: cover.h:111
CoverOperation
Enum encoding the current operation of a cover.
Definition: cover.h:80
void set_open_duration(uint32_t duration)
Definition: he60r.h:18
void set_current_operation_(cover::CoverOperation operation)
Definition: he60r.cpp:67
float get_setup_priority() const override
Definition: he60r.h:16
cover::CoverOperation next_direction_
Definition: he60r.h:36
uint32_t start_dir_time_
Definition: he60r.h:39
void loop() override
Definition: he60r.cpp:152
void dump_config() override
Definition: he60r.cpp:40
unsigned close_duration_
Definition: he60r.h:34
unsigned open_duration_
Definition: he60r.h:33
uint32_t last_recompute_time_
Definition: he60r.h:38
cover::CoverOperation last_command_
Definition: he60r.h:37
bool is_at_target_() const
Check if the cover has reached or passed the target position.
Definition: he60r.cpp:190
unsigned toggles_needed_
Definition: he60r.h:35
void process_rx_(uint8_t data)
Definition: he60r.cpp:75
The cover is currently idle (not moving)
Definition: cover.h:82
void endstop_reached_(cover::CoverOperation operation)
Definition: he60r.cpp:50
cover::CoverTraits get_traits() override
Definition: he60r.cpp:31
void start_direction_(cover::CoverOperation dir)
Definition: he60r.cpp:207
void setup() override
Definition: he60r.cpp:16
void control(const cover::CoverCall &call) override
Definition: he60r.cpp:162
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_close_duration(uint32_t duration)
Definition: he60r.h:19