build a default name for Pollin switches
This commit is contained in:
parent
7e44a0710a
commit
e246158502
@ -55,6 +55,7 @@ namespace OilTank {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct PollinSwitch : Switch {
|
struct PollinSwitch : Switch {
|
||||||
|
constexpr static const char* man = "Pollin";
|
||||||
const char* group;
|
const char* group;
|
||||||
unsigned char channel;
|
unsigned char channel;
|
||||||
|
|
||||||
@ -66,7 +67,8 @@ struct PollinSwitch : Switch {
|
|||||||
strcpy(uId, s.c_str());
|
strcpy(uId, s.c_str());
|
||||||
return uId;
|
return uId;
|
||||||
}()), group(group), channel(channel) {
|
}()), group(group), channel(channel) {
|
||||||
mainDevice = &DeviceConfig::create(id).withName(name).withManufacturer("Pollin").withArea(area).withParent(gatewayDevice);
|
if (!name) name = (new string{string(man).append(" ").append(id)})->c_str();
|
||||||
|
mainDevice = &DeviceConfig::create(id).withName(name).withManufacturer(man).withArea(area).withParent(gatewayDevice);
|
||||||
withStateTopic();
|
withStateTopic();
|
||||||
deviceClass = "outlet";
|
deviceClass = "outlet";
|
||||||
p1Switches.insert({ string(id), this });
|
p1Switches.insert({ string(id), this });
|
||||||
@ -127,7 +129,7 @@ Command* commands[] = {
|
|||||||
new PollinSwitch{"00001", 1, "Meeting sensor", "Dining room"},
|
new PollinSwitch{"00001", 1, "Meeting sensor", "Dining room"},
|
||||||
new PollinSwitch{"00001", 2, "Fire Tv", "Living room"},
|
new PollinSwitch{"00001", 2, "Fire Tv", "Living room"},
|
||||||
new PollinSwitch{"00001", 3, "Diningroom player", "Dining room"},
|
new PollinSwitch{"00001", 3, "Diningroom player", "Dining room"},
|
||||||
new PollinSwitch{"00001", 4, "Bedroom player", "Bedroom"},
|
new PollinSwitch{"00001", 4},
|
||||||
new PollinSwitch{"11111", 4, "Train", "Playroom"}
|
new PollinSwitch{"11111", 4, "Train", "Playroom"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user