add time based cover, has built in endstop (#665)

* add has built in endstop

* rewrite as proposed

* Update esphome/components/time_based/time_based_cover.h

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* lint

* Re trigger stop_operation if stop called

* allow se triggering open/close command if safe

* using COVER_OPEN/CLOSE constants
This commit is contained in:
Guillermo Ruffino
2019-08-29 11:07:41 -03:00
committed by Otto Winter
parent d27291b997
commit 83a92f03fc
3 changed files with 23 additions and 4 deletions
@@ -20,6 +20,7 @@ class TimeBasedCover : public cover::Cover, public Component {
void set_open_duration(uint32_t open_duration) { this->open_duration_ = open_duration; }
void set_close_duration(uint32_t close_duration) { this->close_duration_ = close_duration; }
cover::CoverTraits get_traits() override;
void set_has_built_in_endstop(bool value) { this->has_built_in_endstop_ = value; }
protected:
void control(const cover::CoverCall &call) override;
@@ -41,6 +42,7 @@ class TimeBasedCover : public cover::Cover, public Component {
uint32_t start_dir_time_{0};
uint32_t last_publish_time_{0};
float target_position_{0};
bool has_built_in_endstop_{false};
};
} // namespace time_based