From ce21dedcd53d30f41627ce56d638970e63b39805 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Wed, 29 May 2024 16:01:00 +0200 Subject: [PATCH] generic support for using device's name --- gateway/include/devices.h | 4 ++-- gateway/include/ha.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gateway/include/devices.h b/gateway/include/devices.h index bc90c58..bb686c5 100644 --- a/gateway/include/devices.h +++ b/gateway/include/devices.h @@ -59,7 +59,7 @@ struct PollinSwitch : Switch { unsigned char channel; PollinSwitch(const char* name, const char* group, const unsigned char channel, const char* area = nullptr) - : Switch(name, [group, channel]{ + : Switch(nullptr, [group, channel]{ // copy id from string into a new pointer, to avoid memory leaks string s = Protocol_1::buildId(group, channel); char* uId = new char[s.length() + 1]; @@ -83,7 +83,7 @@ struct EasyHomeSwitch : Switch { unsigned long off[8] = { 4483146, 4626810, 4661562, 4819642 }; EasyHomeSwitch(const char* name, const char* id, unsigned long on[4], unsigned long off[4], const char* area = nullptr) - : Switch(name, id) { + : Switch(nullptr, id) { memcpy(&this->on[4], on, 4 * sizeof(unsigned long)); memcpy(&this->off[4], off, 4 * sizeof(unsigned long)); mainDevice = &DeviceConfig::create(id).withName(name).withManufacturer("Intertek").withModel("Easy Home").withArea(area).withParent(gatewayDevice); diff --git a/gateway/include/ha.h b/gateway/include/ha.h index 6a56af9..e37bbaa 100644 --- a/gateway/include/ha.h +++ b/gateway/include/ha.h @@ -219,7 +219,6 @@ namespace Ha { void buildConfig(JsonDocument& jsonDoc) override { Command::buildConfig(jsonDoc); - jsonDoc["name"] = nullptr; // jsonDoc["retain"] = true; if (stateTopic[0]) jsonDoc["state_topic"] = stateTopic; }