@@ -87,13 +87,17 @@ async def async_setup(
87
87
brand = self ._config .get (CONF_BRAND , DEFAULT_BRAND ),
88
88
)
89
89
klass = authenticator_class or AuthenticatorAsync
90
- access_token_cache_file_path = self .async_configure_access_token_cache_file (
91
- conf [CONF_USERNAME ], conf .get (CONF_ACCESS_TOKEN_CACHE_FILE )
92
- )
90
+ username = conf .get (CONF_USERNAME )
91
+ access_token_cache_file_path : str | None = None
92
+ if username :
93
+ access_token_cache_file_path = self .async_configure_access_token_cache_file (
94
+ conf [CONF_USERNAME ], conf .get (CONF_ACCESS_TOKEN_CACHE_FILE )
95
+ )
96
+
93
97
self .authenticator = klass (
94
98
self .api ,
95
99
self ._config [CONF_LOGIN_METHOD ],
96
- self . _config [ CONF_USERNAME ] ,
100
+ username ,
97
101
self ._config .get (CONF_PASSWORD , "" ),
98
102
install_id = self ._config .get (CONF_INSTALL_ID ),
99
103
access_token_cache_file = access_token_cache_file_path ,
@@ -110,7 +114,9 @@ async def async_authenticate(self) -> Authentication:
110
114
# Call the locks api to verify we are actually
111
115
# authenticated because we can be authenticated
112
116
# by have no access
113
- await self .api .async_get_operable_locks (self .access_token )
117
+ await self .api .async_get_operable_locks (
118
+ await self .async_get_access_token ()
119
+ )
114
120
except AugustApiAIOHTTPError as ex :
115
121
if ex .auth_failed :
116
122
raise InvalidAuth from ex
0 commit comments