diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index ce36b2d..145f368 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -639,5 +639,11 @@ namespace ratgdo { this->pref_.save(&this->rollingCodeCounter); } + void RATGDOComponent::register_child(RATGDOComponent* obj) + { + this->children_.push_back(obj); + obj->set_parent(this); + } + } // namespace ratgdo } // namespace esphome diff --git a/components/ratgdo/ratgdo.h b/components/ratgdo/ratgdo.h index 283619a..8776dc0 100644 --- a/components/ratgdo/ratgdo.h +++ b/components/ratgdo/ratgdo.h @@ -160,9 +160,12 @@ namespace ratgdo { void statusUpdateLoop(); void readRollingCode(uint8_t& door, uint8_t& light, uint8_t& lock, uint8_t& motion, uint8_t& obstruction); void sendCommand(Commands command); + /** Register a child component. */ + void register_child(RATGDOComponent* obj); protected: ESPPreferenceObject pref_; + std::vector children_; RATGDOStore store_ {}; InternalGPIOPin* output_gdo_pin_;