Update discovery and make use of mac manufacturer information

This commit is contained in:
Simon Stürz 2021-06-06 00:07:34 +02:00
parent 9b01f61467
commit bae410388a

View File

@ -65,8 +65,19 @@ void IntegrationPluginWakeOnLan::discoverThings(ThingDiscoveryInfo *info)
if (myThings().filterByParam(wolThingMacParamTypeId, networkDevice.macAddress()).count() != 0)
continue;
QString title = networkDevice.address().toString() + " (" + networkDevice.hostName() + ")";
ThingDescriptor descriptor(wolThingClassId, title, networkDevice.macAddress());
QString title;
if (networkDevice.hostName().isEmpty()) {
title = networkDevice.address().toString();
} else {
title = networkDevice.address().toString() + " (" + networkDevice.hostName() + ")";
}
QString description;
if (networkDevice.macAddressManufacturer().isEmpty()) {
description = networkDevice.macAddress();
} else {
description = networkDevice.macAddress() + " (" + networkDevice.macAddressManufacturer() + ")";
}
ThingDescriptor descriptor(wolThingClassId, title, description);
ParamList params;
params.append(Param(wolThingMacParamTypeId, networkDevice.macAddress()));
descriptor.setParams(params);