Use dataclass properties in directv discovery (#60692)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
ad66522bce
commit
160e6febc3
1 changed files with 5 additions and 4 deletions
|
@ -9,7 +9,6 @@ from directv import DIRECTV, DIRECTVError
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import ssdp
|
||||
from homeassistant.components.ssdp import ATTR_SSDP_LOCATION, ATTR_UPNP_SERIAL
|
||||
from homeassistant.config_entries import ConfigFlow
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -69,11 +68,13 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult:
|
||||
"""Handle SSDP discovery."""
|
||||
host = urlparse(discovery_info[ATTR_SSDP_LOCATION]).hostname
|
||||
host = urlparse(discovery_info.ssdp_location).hostname
|
||||
receiver_id = None
|
||||
|
||||
if discovery_info.get(ATTR_UPNP_SERIAL):
|
||||
receiver_id = discovery_info[ATTR_UPNP_SERIAL][4:] # strips off RID-
|
||||
if discovery_info.upnp.get(ssdp.ATTR_UPNP_SERIAL):
|
||||
receiver_id = discovery_info.upnp[ssdp.ATTR_UPNP_SERIAL][
|
||||
4:
|
||||
] # strips off RID-
|
||||
|
||||
self.context.update({"title_placeholders": {"name": host}})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue