From 29a9e17b53e63cf3f8238d116c714ff1623b42b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Mon, 16 Dec 2024 15:45:09 +0100 Subject: [PATCH] Modbuscommander: Update network device discovery --- modbuscommander/integrationpluginmodbuscommander.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modbuscommander/integrationpluginmodbuscommander.cpp b/modbuscommander/integrationpluginmodbuscommander.cpp index 12b5597..c7b7c5b 100644 --- a/modbuscommander/integrationpluginmodbuscommander.cpp +++ b/modbuscommander/integrationpluginmodbuscommander.cpp @@ -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);