[sonos] Ignore Sonos Boost at discovery (#17318)

Fixes #17307

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
lolodomo 2024-08-23 21:59:52 +02:00 committed by Ciprian Pascu
parent a59d7f78e3
commit 93c536ea55
2 changed files with 9 additions and 1 deletions

View File

@ -1016,7 +1016,7 @@ public class SonosXMLParser {
} }
// Finally remove unexpected characters in a thing type ID // Finally remove unexpected characters in a thing type ID
id = id.replaceAll("[^a-zA-Z0-9_]", ""); 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) { switch (id) {
case "ZP80": case "ZP80":
id = "CONNECT"; id = "CONNECT";
@ -1024,6 +1024,9 @@ public class SonosXMLParser {
case "ZP100": case "ZP100":
id = "CONNECTAMP"; id = "CONNECTAMP";
break; break;
case "Boost":
id = "";
break;
default: default:
break; break;
} }

View File

@ -66,6 +66,11 @@ public class SonosXMLParserTest {
assertEquals("OneSL", SonosXMLParser.buildThingTypeIdFromModelName("Sonos One SL (OpenHome)")); assertEquals("OneSL", SonosXMLParser.buildThingTypeIdFromModelName("Sonos One SL (OpenHome)"));
} }
@Test
public void buildThingTypeIdFromBoost() {
assertEquals("", SonosXMLParser.buildThingTypeIdFromModelName("Sonos Boost"));
}
@Test @Test
public void getRadioTimeFromXML() throws IOException { public void getRadioTimeFromXML() throws IOException {
InputStream resourceStream = getClass().getResourceAsStream("/OPML.xml"); InputStream resourceStream = getClass().getResourceAsStream("/OPML.xml");