@@ -68,6 +68,7 @@ async def validate_enpal_url(hass, url: str) -> bool:
6868 _LOGGER .warning ("[Enpal] URL not reachable: %s" , e )
6969 return False
7070
71+
7172async def validate_wallbox_api (hass ) -> bool :
7273 url = f"{ DEFAULT_WALLBOX_API_ENDPOINT } /status"
7374 try :
@@ -94,16 +95,20 @@ def get_default_config(options: dict[str, Any] | None = None) -> dict[str, Any]:
9495 "use_wallbox_addon" : src .get ("use_wallbox_addon" , DEFAULT_USE_WALLBOX_ADDON ),
9596 }
9697
98+
9799def get_form_schema (config : dict [str , Any ]) -> vol .Schema :
98- return vol .Schema ({
99- vol .Required ("url" , default = cast (Any , config ["url" ])): str ,
100- vol .Required ("interval" , default = cast (Any , config ["interval" ])): int ,
101- vol .Optional ("groups" , default = cast (Any , config ["groups" ])): cv .multi_select (DEFAULT_GROUPS ),
102- vol .Optional ("use_wallbox_addon" , default = cast (Any , config ["use_wallbox_addon" ])): bool ,
103- })
100+ return vol .Schema (
101+ {
102+ vol .Required ("url" , default = cast (Any , config ["url" ])): str ,
103+ vol .Required ("interval" , default = cast (Any , config ["interval" ])): int ,
104+ vol .Optional ("groups" , default = cast (Any , config ["groups" ])): cv .multi_select (DEFAULT_GROUPS ),
105+ vol .Optional ("use_wallbox_addon" , default = cast (Any , config ["use_wallbox_addon" ])): bool ,
106+ }
107+ )
108+
104109
105110async def process_user_input (hass , user_input : dict [str , Any ]) -> tuple [dict [str , Any ] | None , dict [str , str ]]:
106- errors = {}
111+ errors : dict [ str , str ] = {}
107112 url_input = user_input ["url" ]
108113 url_checked , error = sanitize_url (url_input )
109114
@@ -132,7 +137,7 @@ class EnpalConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
132137 async def async_step_user (self , user_input = None ):
133138 _LOGGER .info ("[Enpal] Config flow started" )
134139 config = get_default_config ()
135- errors = {}
140+ errors : dict [ str , str ] = {}
136141
137142 if user_input is not None :
138143 _LOGGER .debug ("[Enpal] User input: %s" , user_input )
@@ -159,12 +164,12 @@ def async_get_options_flow(config_entry):
159164
160165class EnpalOptionsFlowHandler (config_entries .OptionsFlow ):
161166 def __init__ (self , config_entry ):
162- self .config_entry = config_entry
167+ self ._config_entry = config_entry
163168
164169 async def async_step_init (self , user_input = None ):
165170 _LOGGER .info ("[Enpal] OptionsFlow started" )
166- config = get_default_config (dict (self .config_entry .options ))
167- errors = {}
171+ config = get_default_config (dict (self ._config_entry .options ))
172+ errors : dict [ str , str ] = {}
168173
169174 if user_input :
170175 _LOGGER .debug ("[Enpal] OptionsFlow input: %s" , user_input )
0 commit comments