ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
endstop_cover.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace esphome::endstop {
9
10class EndstopCover : public cover::Cover, public Component {
11 public:
12 void setup() override;
13 void loop() override;
14 void dump_config() override;
15
19 void set_open_endstop(binary_sensor::BinarySensor *open_endstop) { this->open_endstop_ = open_endstop; }
20 void set_close_endstop(binary_sensor::BinarySensor *close_endstop) { this->close_endstop_ = close_endstop; }
21 void set_open_duration(uint32_t open_duration) { this->open_duration_ = open_duration; }
22 void set_close_duration(uint32_t close_duration) { this->close_duration_ = close_duration; }
23 void set_max_duration(uint32_t max_duration) { this->max_duration_ = max_duration; }
24
26
27 protected:
28 void control(const cover::CoverCall &call) override;
29 void stop_prev_trigger_();
30 bool is_open_() const { return this->open_endstop_->state; }
31 bool is_closed_() const { return this->close_endstop_->state; }
32 bool is_at_target_() const;
33
35
37
46
53};
54
55} // namespace esphome::endstop
Base class for all binary_sensor-type classes.
bool state
The current state of this binary sensor. Also used as the backing storage for StatefulEntityBase.
Base class for all cover devices.
Definition cover.h:110
binary_sensor::BinarySensor * open_endstop_
cover::CoverTraits get_traits() override
void start_direction_(cover::CoverOperation dir)
void set_max_duration(uint32_t max_duration)
void set_close_endstop(binary_sensor::BinarySensor *close_endstop)
void set_open_endstop(binary_sensor::BinarySensor *open_endstop)
binary_sensor::BinarySensor * close_endstop_
void set_open_duration(uint32_t open_duration)
void set_close_duration(uint32_t close_duration)
void control(const cover::CoverCall &call) override
cover::CoverOperation last_operation_
CoverOperation
Enum encoding the current operation of a cover.
Definition cover.h:79
@ COVER_OPERATION_OPENING
The cover is currently opening.
Definition cover.h:83
static void uint32_t