Include all SSDP data in discovery info (#28197)
* Include all SSDP data in discovery info * Use UPnP device description as discovery info, inject some SSDP attrs * Clean up attribute names * Adapt existing SSDP flows to changed attribute names * Prefix all SSDP UPnP attribute name constants with ATTR_UPNP, tweak a bit
This commit is contained in:
parent
0cb468d7b0
commit
d236a19139
12 changed files with 128 additions and 125 deletions
|
@ -1,10 +1,13 @@
|
|||
"""Tests for the Heos config flow module."""
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from pyheos import HeosError
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
from homeassistant.components import ssdp
|
||||
from homeassistant.components.heos.config_flow import HeosFlowHandler
|
||||
from homeassistant.components.heos.const import DATA_DISCOVERED_HOSTS, DOMAIN
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||
from homeassistant.const import CONF_HOST
|
||||
|
||||
|
||||
async def test_flow_aborts_already_setup(hass, config_entry):
|
||||
|
@ -79,8 +82,9 @@ async def test_discovery_shows_create_form(hass, controller, discovery_data):
|
|||
assert len(hass.config_entries.flow.async_progress()) == 1
|
||||
assert hass.data[DATA_DISCOVERED_HOSTS] == {"Office (127.0.0.1)": "127.0.0.1"}
|
||||
|
||||
discovery_data[CONF_HOST] = "127.0.0.2"
|
||||
discovery_data[CONF_NAME] = "Bedroom"
|
||||
port = urlparse(discovery_data[ssdp.ATTR_SSDP_LOCATION]).port
|
||||
discovery_data[ssdp.ATTR_SSDP_LOCATION] = f"http://127.0.0.2:{port}/"
|
||||
discovery_data[ssdp.ATTR_UPNP_FRIENDLY_NAME] = "Bedroom"
|
||||
await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": "ssdp"}, data=discovery_data
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue