From bae410388a3d90029f1e17d3275c41b67a344af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Sun, 6 Jun 2021 00:07:34 +0200 Subject: [PATCH] Update discovery and make use of mac manufacturer information --- wakeonlan/integrationpluginwakeonlan.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/wakeonlan/integrationpluginwakeonlan.cpp b/wakeonlan/integrationpluginwakeonlan.cpp index f454bf40..0f2fb10e 100644 --- a/wakeonlan/integrationpluginwakeonlan.cpp +++ b/wakeonlan/integrationpluginwakeonlan.cpp @@ -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);