Merge PR #194: Modbuscommander: Update network device discovery
commit
68ec226fc0
|
|
@ -130,10 +130,15 @@ void IntegrationPluginModbusCommander::discoverThings(ThingDiscoveryInfo *info)
|
||||||
}
|
}
|
||||||
|
|
||||||
QString description;
|
QString description;
|
||||||
if (networkDeviceInfo.macAddressManufacturer().isEmpty()) {
|
MacAddressInfo macInfo = networkDeviceInfo.macAddressInfos().constFirst();
|
||||||
description = networkDeviceInfo.macAddress();
|
description = networkDeviceInfo.address().toString();
|
||||||
|
if (!macInfo.vendorName().isEmpty())
|
||||||
|
description += " - " + networkDeviceInfo.macAddressInfos().constFirst().vendorName();
|
||||||
|
|
||||||
|
if (networkDeviceInfo.hostName().isEmpty()) {
|
||||||
|
title = macInfo.macAddress().toString();
|
||||||
} else {
|
} else {
|
||||||
description = networkDeviceInfo.macAddress() + " (" + networkDeviceInfo.macAddressManufacturer() + ")";
|
title = networkDeviceInfo.hostName() + " (" + macInfo.macAddress().toString() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
ThingDescriptor descriptor(modbusTCPClientThingClassId, title, description);
|
ThingDescriptor descriptor(modbusTCPClientThingClassId, title, description);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue