18
18
{
19
19
vol .Required ("email" ): str ,
20
20
vol .Required ("password" ): str ,
21
- vol .Required ("update_interval_seconds" ): int ,
21
+ vol .Required ("update_interval_seconds" , default = 30 ): int ,
22
22
}
23
23
)
24
24
@@ -35,18 +35,24 @@ async def async_step_user(
35
35
errors : dict [str , str ] = {}
36
36
if user_input is not None :
37
37
try :
38
- client = await KiddeClient .from_login (** user_input )
38
+ client = await KiddeClient .from_login (
39
+ user_input ["email" ], user_input ["password" ]
40
+ )
39
41
except KiddeClientAuthError :
40
42
errors ["base" ] = "invalid_auth"
41
43
except Exception as e : # pylint: disable=broad-except
42
44
_LOGGER .exception (f"{ type (e ).__name__ } : { e } " )
43
45
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"
50
56
51
57
return self .async_show_form (
52
58
step_id = "user" , data_schema = STEP_USER_DATA_SCHEMA , errors = errors
0 commit comments