ESPHome 2025.5.0
Loading...
Searching...
No Matches
feedback_cover.h
Go to the documentation of this file.
1#pragma once
2
5
6#ifdef USE_BINARY_SENSOR
8#endif
10
11namespace esphome {
12namespace feedback {
13
14class FeedbackCover : public cover::Cover, public Component {
15 public:
16 void setup() override;
17 void loop() override;
18 void dump_config() override;
19 float get_setup_priority() const override { return setup_priority::DATA; };
20
21 Trigger<> *get_open_trigger() const { return this->open_trigger_; }
22 Trigger<> *get_close_trigger() const { return this->close_trigger_; }
23 Trigger<> *get_stop_trigger() const { return this->stop_trigger_; }
24
25#ifdef USE_BINARY_SENSOR
32#endif
35 void set_has_built_in_endstop(bool value) { this->has_built_in_endstop_ = value; }
36 void set_assumed_state(bool value) { this->assumed_state_ = value; }
37 void set_max_duration(uint32_t max_duration) { this->max_duration_ = max_duration; }
38 void set_obstacle_rollback(float obstacle_rollback) { this->obstacle_rollback_ = obstacle_rollback; }
39 void set_update_interval(uint32_t interval) { this->update_interval_ = interval; }
40 void set_infer_endstop(bool infer_endstop) { this->infer_endstop_ = infer_endstop; }
41 void set_direction_change_waittime(uint32_t waittime) { this->direction_change_waittime_ = waittime; }
42 void set_acceleration_wait_time(uint32_t waittime) { this->acceleration_wait_time_ = waittime; }
43
45
46 protected:
47 void control(const cover::CoverCall &call) override;
48 void stop_prev_trigger_();
49 bool is_at_target_() const;
52 void endstop_reached_(bool open_endstop);
54 void set_current_operation_(cover::CoverOperation operation, bool is_triggered);
55
56#ifdef USE_BINARY_SENSOR
63
64#endif
68
69 uint32_t open_duration_{0};
70 uint32_t close_duration_{0};
71 uint32_t max_duration_{UINT32_MAX};
75 bool assumed_state_{false};
76 bool infer_endstop_{false};
78
83 uint32_t start_dir_time_{0};
84 uint32_t last_publish_time_{0};
86 uint32_t update_interval_{1000};
87};
88
89} // namespace feedback
90} // namespace esphome
Base class for all binary_sensor-type classes.
Base class for all cover devices.
Definition cover.h:111
cover::CoverTraits get_traits() override
cover::CoverOperation current_trigger_operation_
binary_sensor::BinarySensor * open_endstop_
float get_setup_priority() const override
void start_direction_(cover::CoverOperation dir)
void set_has_built_in_endstop(bool value)
void set_open_obstacle_sensor(binary_sensor::BinarySensor *open_obstacle)
void set_open_sensor(binary_sensor::BinarySensor *open_feedback)
void set_current_operation_(cover::CoverOperation operation, bool is_triggered)
binary_sensor::BinarySensor * close_endstop_
void set_close_endstop(binary_sensor::BinarySensor *close_endstop)
optional< uint32_t > direction_change_waittime_
binary_sensor::BinarySensor * close_obstacle_
void set_close_obstacle_sensor(binary_sensor::BinarySensor *close_obstacle)
void control(const cover::CoverCall &call) override
binary_sensor::BinarySensor * open_feedback_
void set_max_duration(uint32_t max_duration)
void set_open_duration(uint32_t duration)
void set_direction_change_waittime(uint32_t waittime)
void endstop_reached_(bool open_endstop)
void set_open_endstop(binary_sensor::BinarySensor *open_endstop)
cover::CoverOperation last_operation_
binary_sensor::BinarySensor * open_obstacle_
void set_close_duration(uint32_t duration)
binary_sensor::BinarySensor * close_feedback_
void set_infer_endstop(bool infer_endstop)
void update_operation_(cover::CoverOperation dir)
void set_update_interval(uint32_t interval)
void set_acceleration_wait_time(uint32_t waittime)
void set_obstacle_rollback(float obstacle_rollback)
void set_close_sensor(binary_sensor::BinarySensor *close_feedback)
uint8_t duration
Definition msa3xx.h:0
CoverOperation
Enum encoding the current operation of a cover.
Definition cover.h:80
@ COVER_OPERATION_OPENING
The cover is currently opening.
Definition cover.h:84
@ COVER_OPERATION_IDLE
The cover is currently idle (not moving)
Definition cover.h:82
const float DATA
For components that import data from directly connected sensors like DHT.
Definition component.cpp:19
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7