generic support for using device's name

This commit is contained in:
Nicu Hodos 2024-05-29 16:01:00 +02:00
parent c03c3d03fd
commit ce21dedcd5
2 changed files with 2 additions and 3 deletions

View File

@ -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);

View File

@ -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;
}