From acf009dbe820aa811d1ee5e06a4aed906ffd0230 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Sat, 8 Jul 2023 14:52:46 +0200 Subject: [PATCH] fix virtual function not being called --- include/ha.h | 4 ++-- include/mqtt.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ha.h b/include/ha.h index e4345bb..3fd5cfb 100644 --- a/include/ha.h +++ b/include/ha.h @@ -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; diff --git a/include/mqtt.h b/include/mqtt.h index 8848560..900506c 100644 --- a/include/mqtt.h +++ b/include/mqtt.h @@ -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);