From 454fb30759a7ffb2f3c1218344fd988164a1a1b4 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:29:25 +0200 Subject: [PATCH] Adjust type hints in enphase_envoy config_flow (#127106) --- homeassistant/components/enphase_envoy/config_flow.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/enphase_envoy/config_flow.py b/homeassistant/components/enphase_envoy/config_flow.py index c18401859de..dd3b9e2d3fa 100644 --- a/homeassistant/components/enphase_envoy/config_flow.py +++ b/homeassistant/components/enphase_envoy/config_flow.py @@ -5,7 +5,7 @@ from __future__ import annotations from collections.abc import Mapping import logging from types import MappingProxyType -from typing import Any +from typing import TYPE_CHECKING, Any from awesomeversion import AwesomeVersion from pyenphase import AUTH_TOKEN_MIN_VERSION, Envoy, EnvoyError @@ -311,6 +311,9 @@ class EnvoyOptionsFlowHandler(OptionsFlowWithConfigEntry): if user_input is not None: return self.async_create_entry(title="", data=user_input) + if TYPE_CHECKING: + assert self.config_entry.unique_id is not None + return self.async_show_form( step_id="init", data_schema=vol.Schema( @@ -326,6 +329,6 @@ class EnvoyOptionsFlowHandler(OptionsFlowWithConfigEntry): ), description_placeholders={ CONF_SERIAL: self.config_entry.unique_id, - CONF_HOST: self.config_entry.data.get("host"), + CONF_HOST: self.config_entry.data[CONF_HOST], }, )