diff --git a/gateway/include/devices.h b/gateway/include/devices.h index 37ce2b2..d552cbb 100644 --- a/gateway/include/devices.h +++ b/gateway/include/devices.h @@ -55,6 +55,7 @@ namespace OilTank { } struct PollinSwitch : Switch { + constexpr static const char* man = "Pollin"; const char* group; unsigned char channel; @@ -66,7 +67,8 @@ struct PollinSwitch : Switch { strcpy(uId, s.c_str()); return uId; }()), 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(); deviceClass = "outlet"; p1Switches.insert({ string(id), this }); @@ -127,7 +129,7 @@ Command* commands[] = { new PollinSwitch{"00001", 1, "Meeting sensor", "Dining room"}, new PollinSwitch{"00001", 2, "Fire Tv", "Living 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"} };