From 93c536ea55c9b3cf7d7c7de6a523f934b9c2aeca Mon Sep 17 00:00:00 2001 From: lolodomo Date: Fri, 23 Aug 2024 21:59:52 +0200 Subject: [PATCH] [sonos] Ignore Sonos Boost at discovery (#17318) Fixes #17307 Signed-off-by: Laurent Garnier Signed-off-by: Ciprian Pascu --- .../org/openhab/binding/sonos/internal/SonosXMLParser.java | 5 ++++- .../openhab/binding/sonos/internal/SonosXMLParserTest.java | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/SonosXMLParser.java b/bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/SonosXMLParser.java index d1939f0987b..c5fecb88f1e 100644 --- a/bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/SonosXMLParser.java +++ b/bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/SonosXMLParser.java @@ -1016,7 +1016,7 @@ public class SonosXMLParser { } // Finally remove unexpected characters in a thing type ID id = id.replaceAll("[^a-zA-Z0-9_]", ""); - // ZP80 is translated to CONNECT and ZP100 to CONNECTAMP + // ZP80 is translated to CONNECT and ZP100 to CONNECTAMP; Boost is ignored switch (id) { case "ZP80": id = "CONNECT"; @@ -1024,6 +1024,9 @@ public class SonosXMLParser { case "ZP100": id = "CONNECTAMP"; break; + case "Boost": + id = ""; + break; default: break; } diff --git a/bundles/org.openhab.binding.sonos/src/test/java/org/openhab/binding/sonos/internal/SonosXMLParserTest.java b/bundles/org.openhab.binding.sonos/src/test/java/org/openhab/binding/sonos/internal/SonosXMLParserTest.java index 65857dd5a0a..884db2d2ae3 100644 --- a/bundles/org.openhab.binding.sonos/src/test/java/org/openhab/binding/sonos/internal/SonosXMLParserTest.java +++ b/bundles/org.openhab.binding.sonos/src/test/java/org/openhab/binding/sonos/internal/SonosXMLParserTest.java @@ -66,6 +66,11 @@ public class SonosXMLParserTest { assertEquals("OneSL", SonosXMLParser.buildThingTypeIdFromModelName("Sonos One SL (OpenHome)")); } + @Test + public void buildThingTypeIdFromBoost() { + assertEquals("", SonosXMLParser.buildThingTypeIdFromModelName("Sonos Boost")); + } + @Test public void getRadioTimeFromXML() throws IOException { InputStream resourceStream = getClass().getResourceAsStream("/OPML.xml");