ESPHome 2026.11.0b6
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 final : public cover::Cover, public Component {
11 SUB_BINARY_SENSOR(open_endstop)
12 SUB_BINARY_SENSOR(close_endstop)
13
14 public:
15 void setup() override;
16 void loop() override;
17 void dump_config() override;
18
19 Trigger<> *get_open_trigger() { return &this->open_trigger_; }
20 Trigger<> *get_close_trigger() { return &this->close_trigger_; }
21 Trigger<> *get_stop_trigger() { return &this->stop_trigger_; }
22 void set_open_duration(uint32_t open_duration) { this->open_duration_ = open_duration; }
23 void set_close_duration(uint32_t close_duration) { this->close_duration_ = close_duration; }
24 void set_max_duration(uint32_t max_duration) { this->max_duration_ = max_duration; }
25
26 cover::CoverTraits get_traits() override;
27
28 protected:
29 void control(const cover::CoverCall &call) override;
30 void stop_prev_trigger_();
31 bool is_open_() const { return this->open_endstop_binary_sensor_->state; }
32 bool is_closed_() const { return this->close_endstop_binary_sensor_->state; }
33 bool is_at_target_() const;
34
36
38
45
52};
53
54} // namespace esphome::endstop
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:84
Base class for all cover devices.
Definition cover.h:115
void start_direction_(cover::CoverOperation dir)
void control(const cover::CoverCall &call) override
cover::CoverOperation last_operation_
CoverOperation
Enum encoding the current operation of a cover.
Definition cover.h:84
@ COVER_OPERATION_OPENING
The cover is currently opening.
Definition cover.h:88
static void uint32_t