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
parent aacb9e44e8
commit 533f81d625
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E

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_;