From 00a417a953b9c6ca5a6fcccd4d8a72e9c19614d7 Mon Sep 17 00:00:00 2001 From: "bernhard.trinnes" Date: Fri, 20 Mar 2020 07:38:12 +0100 Subject: [PATCH] added speaker grouping --- bluos/README.md | 26 ++++++++++++++++++++++++++ bluos/integrationpluginbluos.cpp | 16 +++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/bluos/README.md b/bluos/README.md index e69de29b..68f37ec0 100644 --- a/bluos/README.md +++ b/bluos/README.md @@ -0,0 +1,26 @@ +# BluOS + +This integration allows to control audio devices based on BluOS. BluOS is an operating system that can be found in products from Blusound, NAD Electronics, DALI Loudspeakers and others. + +## Supported Things + +* BluOS Player + * Auto discovery setup + * Auto rediscovery on IP address change + * Multimedia control + * Volume + * Browsing Presets + * Browsing various music services + * Grouping speakers + * No internet or cloud connection required + +## Requirements + +* The BluOS device must be in the same local area network as nymea. +* TCP sockets on port 80 must not be blocked by the router. +* Blusound App to setup the speaker. +* The package "nymea-plugin-bluos" must be installed + +## More + +https://www.bluesound.com/ diff --git a/bluos/integrationpluginbluos.cpp b/bluos/integrationpluginbluos.cpp index 043a6948..d8669c81 100644 --- a/bluos/integrationpluginbluos.cpp +++ b/bluos/integrationpluginbluos.cpp @@ -229,9 +229,19 @@ void IntegrationPluginBluOS::browseThing(BrowseResult *result) m_asyncBrowseResults.insert(requestId, result); connect(result, &BrowseResult::aborted, this, [this, requestId]{m_asyncBrowseResults.remove(requestId);}); } else if (result->itemId() == "grouping") { - //TODO avahi discovery - // m_asyncBrowseResults.insert(requestId, result); - //connect(result, &BrowseResult::aborted, this, [this, requestId]{m_asyncBrowseResults.remove(requestId);}); + foreach (const ZeroConfServiceEntry avahiEntry, m_serviceBrowser->serviceEntries()) { + qCDebug(dcBluOS()) << "Zeroconf entry:" << avahiEntry; + + QString playerId = avahiEntry.hostName().split(".").first(); + if (thing->paramValue(bluosPlayerThingSerialNumberParamTypeId).toString() == playerId) { + continue; + } + MediaBrowserItem groupingItem("grouping&"+avahiEntry.hostAddress().toString()+"&"+avahiEntry.port(), avahiEntry.name(), true, false); + groupingItem.setDescription(avahiEntry.hostAddress().toString()); + groupingItem.setMediaIcon(MediaBrowserItem::MediaBrowserIconNetwork); + groupingItem.setIcon(BrowserItem::BrowserIconMusic); + result->addItem(groupingItem); + } } else if (result->itemId().isEmpty()) { MediaBrowserItem presetItem("presets", "Presets", true, false); presetItem.setIcon(BrowserItem::BrowserIcon::BrowserIconFavorites);