binary sensor

This commit is contained in:
J. Nick Koston 2023-06-07 12:26:12 -05:00
parent 1ba53cbb6d
commit 6a4a203e77
No known key found for this signature in database
1 changed files with 14 additions and 1 deletions

View File

@ -53,7 +53,20 @@ namespace ratgdo {
traits.set_is_assumed_state(false);
return traits;
}
void RATGDOCover::control(const CoverCall& call) { }
void RATGDOCover::control(const CoverCall& call)
{
if (call.get_stop()) {
this->parent_->stopDoor();
}
if (call.get_position().has_value()) {
auto pos = *call.get_position();
if (pos == COVER_OPEN) {
this->parent_->openDoor();
} else if (pos == COVER_CLOSED) {
this->parent_->closeDoor();
}
}
}
} // namespace ratgdo
} // namespace esphome