diff --git a/homeassistant/components/modern_forms/config_flow.py b/homeassistant/components/modern_forms/config_flow.py index 6a1059a0387..f8f3e2f1dc1 100644 --- a/homeassistant/components/modern_forms/config_flow.py +++ b/homeassistant/components/modern_forms/config_flow.py @@ -30,14 +30,14 @@ class ModernFormsFlowHandler(ConfigFlow, domain=DOMAIN): self, discovery_info: zeroconf.ZeroconfServiceInfo ) -> FlowResult: """Handle zeroconf discovery.""" - 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}, } )