#include bool IoTComponent::begin(uint8_t card_id, ExpansionCard *card, PubSubClient *mqtt, char *base_topic) { this->card_id = card_id; this->mqtt = mqtt; this->base_topic = base_topic; return true; } void IoTComponent::setMqttClient(PubSubClient *mqtt) { this->mqtt = mqtt; } void IoTComponent::publishRelative(const char *topic, const char *payload) { char absolute_topic[100]; sprintf(absolute_topic, "%s/%02d/%s", base_topic, card_id, topic); mqtt->publish(absolute_topic, payload); } void IoTComponent::subscribeRelative(const char *topic) { Serial.println("Subscribe relative"); char absolute_topic[50]; sprintf(absolute_topic, "%s/%02d/%s", base_topic, card_id, topic); mqtt->subscribe(absolute_topic); } void IoTComponent::loop() { // Placeholder, Do nothing }