generic support for using device's name
This commit is contained in:
parent
c03c3d03fd
commit
ce21dedcd5
@ -59,7 +59,7 @@ struct PollinSwitch : Switch {
|
|||||||
unsigned char channel;
|
unsigned char channel;
|
||||||
|
|
||||||
PollinSwitch(const char* name, const char* group, const unsigned char channel, const char* area = nullptr)
|
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
|
// copy id from string into a new pointer, to avoid memory leaks
|
||||||
string s = Protocol_1::buildId(group, channel);
|
string s = Protocol_1::buildId(group, channel);
|
||||||
char* uId = new char[s.length() + 1];
|
char* uId = new char[s.length() + 1];
|
||||||
@ -83,7 +83,7 @@ struct EasyHomeSwitch : Switch {
|
|||||||
unsigned long off[8] = { 4483146, 4626810, 4661562, 4819642 };
|
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)
|
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->on[4], on, 4 * sizeof(unsigned long));
|
||||||
memcpy(&this->off[4], off, 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);
|
mainDevice = &DeviceConfig::create(id).withName(name).withManufacturer("Intertek").withModel("Easy Home").withArea(area).withParent(gatewayDevice);
|
||||||
|
|||||||
@ -219,7 +219,6 @@ namespace Ha {
|
|||||||
|
|
||||||
void buildConfig(JsonDocument& jsonDoc) override {
|
void buildConfig(JsonDocument& jsonDoc) override {
|
||||||
Command::buildConfig(jsonDoc);
|
Command::buildConfig(jsonDoc);
|
||||||
jsonDoc["name"] = nullptr;
|
|
||||||
// jsonDoc["retain"] = true;
|
// jsonDoc["retain"] = true;
|
||||||
if (stateTopic[0]) jsonDoc["state_topic"] = stateTopic;
|
if (stateTopic[0]) jsonDoc["state_topic"] = stateTopic;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user