Adding unique device names to HA dicovery (#1270)
* Adding unique device names to HA dicovery Multiple devices of the same model got the same name in Home Assistant, making the device list less informative when there are many of e.g. the same sensor. To over come this changed the function publishing discovery messages to add the second half of the device mac address to the device name so it becomes unique. Issue: #1269
This commit is contained in:
1 parent
8c7c1146f8
commit
0ff3e98d91
1 file changed
+2
-1
@@ -333,7 +333,8 @@ void createDiscovery(const char* sensor_type,
|
||||
}
|
||||
|
||||
if (device_name[0]) {
|
||||
device["name"] = device_name;
|
||||
// generate unique device name by adding the second half of the device_mac
|
||||
device["name"] = device_name + String("-") + String(device_mac + 6);
|
||||
}
|
||||
|
||||
device["via_device"] = String(gateway_name); //device name of the board
|
||||
|
||||
Reference in new issue
Block a user