mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
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
@ -9,7 +9,6 @@ from directv import DIRECTV, DIRECTVError
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import ssdp
|
from homeassistant.components import ssdp
|
||||||
from homeassistant.components.ssdp import ATTR_SSDP_LOCATION, ATTR_UPNP_SERIAL
|
|
||||||
from homeassistant.config_entries import ConfigFlow
|
from homeassistant.config_entries import ConfigFlow
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||||
from homeassistant.core import HomeAssistant
|
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:
|
async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult:
|
||||||
"""Handle SSDP discovery."""
|
"""Handle SSDP discovery."""
|
||||||
host = urlparse(discovery_info[ATTR_SSDP_LOCATION]).hostname
|
host = urlparse(discovery_info.ssdp_location).hostname
|
||||||
receiver_id = None
|
receiver_id = None
|
||||||
|
|
||||||
if discovery_info.get(ATTR_UPNP_SERIAL):
|
if discovery_info.upnp.get(ssdp.ATTR_UPNP_SERIAL):
|
||||||
receiver_id = discovery_info[ATTR_UPNP_SERIAL][4:] # strips off RID-
|
receiver_id = discovery_info.upnp[ssdp.ATTR_UPNP_SERIAL][
|
||||||
|
4:
|
||||||
|
] # strips off RID-
|
||||||
|
|
||||||
self.context.update({"title_placeholders": {"name": host}})
|
self.context.update({"title_placeholders": {"name": host}})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user