Use dataclass properties in wled discovery (#60573)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-11-30 08:42:30 +01:00 committed by GitHub
parent e0b315041b
commit 9374ce87ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,14 +44,14 @@ class WLEDFlowHandler(ConfigFlow, domain=DOMAIN):
"""Handle zeroconf discovery."""
# Hostname is format: wled-livingroom.local.
host = discovery_info[zeroconf.ATTR_HOSTNAME].rstrip(".")
host = discovery_info.hostname.rstrip(".")
name, _ = host.rsplit(".")
self.context.update(
{
CONF_HOST: discovery_info[zeroconf.ATTR_HOST],
CONF_HOST: discovery_info.host,
CONF_NAME: name,
CONF_MAC: discovery_info[zeroconf.ATTR_PROPERTIES].get(CONF_MAC),
CONF_MAC: discovery_info.properties.get(CONF_MAC),
"title_placeholders": {"name": name},
}
)