SSDP matching improvements (#28285)
* SSDP matching improvements - support multiple match groups per domain - require matches on all, not any item in a group - support matching on all UPnP device description data * Manifest structure fixes
This commit is contained in:
1 parent
a8dff2f2d0
commit
1679ec3245
10 files changed
+113
-92
No files matched your search
@@ -6,11 +6,11 @@
|
||||
"requirements": [
|
||||
"pydeconz==64"
|
||||
],
|
||||
"ssdp": {
|
||||
"manufacturer": [
|
||||
"Royal Philips Electronics"
|
||||
]
|
||||
},
|
||||
"ssdp": [
|
||||
{
|
||||
"manufacturer": "Royal Philips Electronics"
|
||||
}
|
||||
],
|
||||
"dependencies": [],
|
||||
"codeowners": [
|
||||
"@kane610"
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
"requirements": [
|
||||
"pyheos==0.6.0"
|
||||
],
|
||||
"ssdp": {
|
||||
"st": [
|
||||
"urn:schemas-denon-com:device:ACT-Denon:1"
|
||||
]
|
||||
},
|
||||
"ssdp": [
|
||||
{
|
||||
"st": "urn:schemas-denon-com:device:ACT-Denon:1"
|
||||
}
|
||||
],
|
||||
"dependencies": [],
|
||||
"codeowners": [
|
||||
"@andrewsayre"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,11 @@
|
||||
"requirements": [
|
||||
"aiohue==1.9.2"
|
||||
],
|
||||
"ssdp": {
|
||||
"manufacturer": [
|
||||
"Royal Philips Electronics"
|
||||
]
|
||||
},
|
||||
"ssdp": [
|
||||
{
|
||||
"manufacturer": "Royal Philips Electronics"
|
||||
}
|
||||
],
|
||||
"homekit": {
|
||||
"models": [
|
||||
"BSB002"
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"pysonos==0.0.24"
|
||||
],
|
||||
"dependencies": [],
|
||||
"ssdp": {
|
||||
"st": [
|
||||
"urn:schemas-upnp-org:device:ZonePlayer:1"
|
||||
]
|
||||
},
|
||||
"ssdp": [
|
||||
{
|
||||
"st": "urn:schemas-upnp-org:device:ZonePlayer:1"
|
||||
}
|
||||
],
|
||||
"codeowners": []
|
||||
}
|
||||
@@ -104,28 +104,27 @@ class Scanner:
|
||||
|
||||
async def _process_entry(self, entry):
|
||||
"""Process a single entry."""
|
||||
domains = set(SSDP["st"].get(entry.st, []))
|
||||
|
||||
xml_location = entry.location
|
||||
info = {"st": entry.st}
|
||||
|
||||
if not xml_location:
|
||||
if domains:
|
||||
return (entry, info_from_entry(entry, None), domains)
|
||||
return None
|
||||
if entry.location:
|
||||
|
||||
# Multiple entries usually share same location. Make sure
|
||||
# we fetch it only once.
|
||||
info_req = self._description_cache.get(xml_location)
|
||||
# Multiple entries usually share same location. Make sure
|
||||
# we fetch it only once.
|
||||
info_req = self._description_cache.get(entry.location)
|
||||
|
||||
if info_req is None:
|
||||
info_req = self._description_cache[
|
||||
xml_location
|
||||
] = self.hass.async_create_task(self._fetch_description(xml_location))
|
||||
if info_req is None:
|
||||
info_req = self._description_cache[
|
||||
entry.location
|
||||
] = self.hass.async_create_task(self._fetch_description(entry.location))
|
||||
|
||||
info = await info_req
|
||||
info.update(await info_req)
|
||||
|
||||
domains.update(SSDP["manufacturer"].get(info.get("manufacturer"), []))
|
||||
domains.update(SSDP["device_type"].get(info.get("deviceType"), []))
|
||||
domains = set()
|
||||
for domain, matchers in SSDP.items():
|
||||
for matcher in matchers:
|
||||
if all(info.get(k) == v for (k, v) in matcher.items()):
|
||||
domains.add(domain)
|
||||
|
||||
if domains:
|
||||
return (entry, info_from_entry(entry, info), domains)
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
"requirements": [
|
||||
"pywemo==0.4.34"
|
||||
],
|
||||
"ssdp": {
|
||||
"manufacturer": [
|
||||
"Belkin International Inc."
|
||||
]
|
||||
},
|
||||
"ssdp": [
|
||||
{
|
||||
"manufacturer": "Belkin International Inc."
|
||||
}
|
||||
],
|
||||
"homekit": {
|
||||
"models": [
|
||||
"Wemo"
|
||||
|
||||
Reference in new issue
Block a user