From c6e07d90ed446a0864b718c1cfb8f529319481f3 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 5 Jun 2023 18:36:08 -0500 Subject: [PATCH] fix --- components/ratgdo/ratgdo.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index ab2054c..0e9384a 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -530,7 +530,28 @@ namespace ratgdo { } } + // Lock functions + void RATGDOComponent::lock(){ + if(this->lockStates[this->store_.lockState] == "locked"){ + ESP_LOGD(TAG, ("already locked"); + }else{ + toggleLock(); + } + } + void RATGDOComponent::unlock(){ + if(this->lockStates[this->store_.lockState] == "unlocked"){ + ESP_LOGD(TAG, ("already unlocked"); + }else{ + toggleLock(); + } + } + + void RATGDOComponent::toggleLock(){ + getRollingCode("lock"); + transmit(this->txRollingCode); + this->pref_.save(&this->rollingCodeCounter); + } } // namespace ratgdo } // namespace esphome