Use dataclass properties in hyperion (#60792)

This commit is contained in:
epenet 2021-12-01 21:46:55 +01:00 committed by GitHub
parent 737dd6fc26
commit 0cf228d5a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -198,14 +198,14 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
try:
self._data[CONF_PORT] = int(
discovery_info.get("ports", {}).get(
discovery_info.upnp.get("ports", {}).get(
"jsonServer", const.DEFAULT_PORT_JSON
)
)
except ValueError:
self._data[CONF_PORT] = const.DEFAULT_PORT_JSON
if not (hyperion_id := discovery_info.get(ssdp.ATTR_UPNP_SERIAL)):
if not (hyperion_id := discovery_info.upnp.get(ssdp.ATTR_UPNP_SERIAL)):
return self.async_abort(reason="no_id")
# For discovery mechanisms, we set the unique_id as early as possible to