From 6a4a203e778f4af7b004212a924b9ccf78dbaf5c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 7 Jun 2023 12:26:12 -0500 Subject: [PATCH] binary sensor --- components/ratgdo/cover/ratgdo_cover.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/components/ratgdo/cover/ratgdo_cover.cpp b/components/ratgdo/cover/ratgdo_cover.cpp index 1e11b49..0480209 100644 --- a/components/ratgdo/cover/ratgdo_cover.cpp +++ b/components/ratgdo/cover/ratgdo_cover.cpp @@ -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