Skip to content

Commit

Permalink
Merge PR #194: Modbuscommander: Update network device discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins committed Dec 18, 2024
2 parents 842a968 + 29a9e17 commit 054aa47
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modbuscommander/integrationpluginmodbuscommander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 054aa47

Please sign in to comment.