Template Cover don't auto-set current_operation (#612)

Fixes https://github.com/esphome/issues/issues/408
This commit is contained in:
Otto Winter 2019-06-06 13:13:56 +02:00 committed by GitHub
parent 73eea154d5
commit 16ae46e958
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,19 +74,12 @@ void TemplateCover::control(const CoverCall &call) {
this->stop_prev_trigger_(); this->stop_prev_trigger_();
this->stop_trigger_->trigger(); this->stop_trigger_->trigger();
this->prev_command_trigger_ = this->stop_trigger_; this->prev_command_trigger_ = this->stop_trigger_;
this->current_operation = COVER_OPERATION_IDLE;
this->publish_state(); this->publish_state();
} }
if (call.get_position().has_value()) { if (call.get_position().has_value()) {
auto pos = *call.get_position(); auto pos = *call.get_position();
this->stop_prev_trigger_(); this->stop_prev_trigger_();
if (pos < this->position) {
this->current_operation = COVER_OPERATION_CLOSING;
} else if (pos > this->position) {
this->current_operation = COVER_OPERATION_OPENING;
}
if (pos == COVER_OPEN) { if (pos == COVER_OPEN) {
this->open_trigger_->trigger(); this->open_trigger_->trigger();
this->prev_command_trigger_ = this->open_trigger_; this->prev_command_trigger_ = this->open_trigger_;