This commit is contained in:
J. Nick Koston 2023-06-05 18:36:08 -05:00
parent bd2585ceaf
commit c6e07d90ed
No known key found for this signature in database
1 changed files with 21 additions and 0 deletions

View File

@ -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 ratgdo
} // namespace esphome } // namespace esphome