fix virtual function not being called

This commit is contained in:
Nicu Hodos 2023-07-08 14:52:46 +02:00
parent 65f7919ed9
commit acf009dbe8
2 changed files with 4 additions and 4 deletions

View File

@ -42,7 +42,7 @@ namespace Ha {
this->f = f;
}
void buildConfig(JsonDocument& jsonDoc) {
void buildConfig(JsonDocument& jsonDoc) override {
Component::buildConfig(jsonDoc);
jsonDoc["command_topic"] = commandTopic;
}
@ -76,7 +76,7 @@ namespace Ha {
Sensor(const char* name, const char* uniqueId, const char* topic) : Component(name, uniqueId, topic, "sensor") {
}
void buildConfig(JsonDocument& jsonDoc) {
void buildConfig(JsonDocument& jsonDoc) override {
Component::buildConfig(jsonDoc);
jsonDoc["device_class"] = deviceClass;
jsonDoc["unit_of_measurement"] = unitMeasure;

View File

@ -86,10 +86,10 @@ namespace Mqtt {
}
void publishConfig() {
for (Ha::Component cmp : sensors) {
for (Ha::Component& cmp : sensors) {
publishComponentConfig(cmp);
}
for (Ha::Component cmp : switches) {
for (Ha::Component& cmp : switches) {
publishComponentConfig(cmp);
}
ts.deleteTask(tPublishConfig);