mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix Netgear orbi port in ssdp discovery (#57432)
This commit is contained in:
parent
20d08fa470
commit
d84722c3c2
@ -17,7 +17,14 @@ from homeassistant.const import (
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import FlowResult
|
||||
|
||||
from .const import CONF_CONSIDER_HOME, DEFAULT_CONSIDER_HOME, DEFAULT_NAME, DOMAIN
|
||||
from .const import (
|
||||
CONF_CONSIDER_HOME,
|
||||
DEFAULT_CONSIDER_HOME,
|
||||
DEFAULT_NAME,
|
||||
DOMAIN,
|
||||
MODELS_V2,
|
||||
ORBI_PORT,
|
||||
)
|
||||
from .errors import CannotLoginException
|
||||
from .router import get_api
|
||||
|
||||
@ -133,8 +140,10 @@ class NetgearFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
await self.async_set_unique_id(discovery_info[ssdp.ATTR_UPNP_SERIAL])
|
||||
self._abort_if_unique_id_configured(updates=updated_data)
|
||||
|
||||
if device_url.port:
|
||||
updated_data[CONF_PORT] = device_url.port
|
||||
updated_data[CONF_PORT] = DEFAULT_PORT
|
||||
for model in MODELS_V2:
|
||||
if discovery_info.get(ssdp.ATTR_UPNP_MODEL_NUMBER, "").startswith(model):
|
||||
updated_data[CONF_PORT] = ORBI_PORT
|
||||
|
||||
self.placeholders.update(updated_data)
|
||||
self.discovered = True
|
||||
|
@ -29,6 +29,7 @@ MODELS_V2 = [
|
||||
"SXR",
|
||||
"SXS",
|
||||
]
|
||||
ORBI_PORT = 80
|
||||
|
||||
# Icons
|
||||
DEVICE_ICONS = {
|
||||
|
@ -7,7 +7,7 @@ import pytest
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
from homeassistant.components import ssdp
|
||||
from homeassistant.components.netgear.const import CONF_CONSIDER_HOME, DOMAIN
|
||||
from homeassistant.components.netgear.const import CONF_CONSIDER_HOME, DOMAIN, ORBI_PORT
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_SSDP, SOURCE_USER
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
@ -247,7 +247,7 @@ async def test_ssdp(hass, service):
|
||||
assert result["result"].unique_id == SERIAL
|
||||
assert result["title"] == TITLE
|
||||
assert result["data"].get(CONF_HOST) == HOST
|
||||
assert result["data"].get(CONF_PORT) == PORT
|
||||
assert result["data"].get(CONF_PORT) == ORBI_PORT
|
||||
assert result["data"].get(CONF_SSL) == SSL
|
||||
assert result["data"].get(CONF_USERNAME) == DEFAULT_USER
|
||||
assert result["data"][CONF_PASSWORD] == PASSWORD
|
||||
|
Loading…
x
Reference in New Issue
Block a user