Modbuscommander: Update network device discovery

modbuscommander-networkdevice-interface
Simon Stürz 2024-12-16 15:45:09 +01:00
parent 36f9f3c512
commit 29a9e17b53
1 changed files with 8 additions and 3 deletions

View File

@ -130,10 +130,15 @@ void IntegrationPluginModbusCommander::discoverThings(ThingDiscoveryInfo *info)
}
QString description;
if (networkDeviceInfo.macAddressManufacturer().isEmpty()) {
description = networkDeviceInfo.macAddress();
MacAddressInfo macInfo = networkDeviceInfo.macAddressInfos().constFirst();
description = networkDeviceInfo.address().toString();
if (!macInfo.vendorName().isEmpty())
description += " - " + networkDeviceInfo.macAddressInfos().constFirst().vendorName();
if (networkDeviceInfo.hostName().isEmpty()) {
title = macInfo.macAddress().toString();
} else {
description = networkDeviceInfo.macAddress() + " (" + networkDeviceInfo.macAddressManufacturer() + ")";
title = networkDeviceInfo.hostName() + " (" + macInfo.macAddress().toString() + ")";
}
ThingDescriptor descriptor(modbusTCPClientThingClassId, title, description);