1818 {
1919 vol .Required ("email" ): str ,
2020 vol .Required ("password" ): str ,
21- vol .Required ("update_interval_seconds" ): int ,
21+ vol .Required ("update_interval_seconds" , default = 30 ): int ,
2222 }
2323)
2424
@@ -35,18 +35,24 @@ async def async_step_user(
3535 errors : dict [str , str ] = {}
3636 if user_input is not None :
3737 try :
38- client = await KiddeClient .from_login (** user_input )
38+ client = await KiddeClient .from_login (
39+ user_input ["email" ], user_input ["password" ]
40+ )
3941 except KiddeClientAuthError :
4042 errors ["base" ] = "invalid_auth"
4143 except Exception as e : # pylint: disable=broad-except
4244 _LOGGER .exception (f"{ type (e ).__name__ } : { e } " )
4345 errors ["base" ] = "unknown"
44- update_interval = user_input ["update_interval_seconds" ]
45- if isinstance (update_interval , int ) and update_interval >= 5 :
46- title = f"Kidde ({ user_input ['email' ]} )"
47- data = {"cookies" : client .cookies , "update_interval" : update_interval }
48- return self .async_create_entry (title = title , data = data )
49- errors ["base" ] = "invalid_update_interval"
46+ else :
47+ update_interval = user_input ["update_interval_seconds" ]
48+ if isinstance (update_interval , int ) and update_interval >= 5 :
49+ title = f"Kidde ({ user_input ['email' ]} )"
50+ data = {
51+ "cookies" : client .cookies ,
52+ "update_interval" : update_interval ,
53+ }
54+ return self .async_create_entry (title = title , data = data )
55+ errors ["base" ] = "invalid_update_interval"
5056
5157 return self .async_show_form (
5258 step_id = "user" , data_schema = STEP_USER_DATA_SCHEMA , errors = errors
0 commit comments