Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.

Commit 74cd2ec

Browse files
rytilahtiballoob
authored andcommitted
be more strict on songpal filtering (#240)
* be more strict on songpal filtering, skip devices containing bravia in the friendlyname * rework filtering to be based on the available services * use videoScreen instead of appControl, looks like SRS-ZR5 offers appControl
1 parent 9215698 commit 74cd2ec

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

netdisco/discoverables/songpal.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,24 @@ def get_entries(self):
1313
devs = self.find_by_st(
1414
"urn:schemas-sony-com:service:ScalarWebAPI:1")
1515

16-
# At least some Bravia televisions use this API for communication.
17-
# Based on some examples they always seem to lack modelNumber,
18-
# so we use it here to keep them undiscovered for now.
19-
non_bravias = []
16+
# At least some Bravia televisions use the same API for communication,
17+
# but are handled by another platforms, so we filter them out here.
18+
supported = []
2019
for dev in devs:
2120
if 'device' in dev.description:
2221
device = dev.description['device']
23-
if 'modelNumber' in device:
24-
non_bravias.append(dev)
22+
scalarweb_info = device.get("X_ScalarWebAPI_DeviceInfo", None)
2523

26-
return non_bravias
24+
if scalarweb_info:
25+
services = scalarweb_info["X_ScalarWebAPI_ServiceList"]
26+
service_types = services["X_ScalarWebAPI_ServiceType"]
27+
# Sony Bravias offer videoScreen service, soundbars do not
28+
if 'videoScreen' in service_types:
29+
continue
30+
31+
supported.append(dev)
32+
33+
return supported
2734

2835
def info_from_entry(self, entry):
2936
"""Get information for a device.."""

0 commit comments

Comments
 (0)