Hello,
I’m coding my first custom component and I ended up with the following situation:
- I have a user step that collects username and password
async_setup_entry
instantiatesMyApi
using username and password and triggersapi.login()
MyApi
is then passed toMyCoordinator
so that data can be polled from the cloud API- Every 30 minutes the api fails due to a
HTTP 401
error and I need to repeat the login (this currently triggers the reauth flow)
My issue is with async_step_reauth
. I can see entry_data
contains username and password, but I don’t know how to trigger the login()
function on the instance of MyApi
I initially provided to the coordinator.
Is there a way to trigger a login on the coordinator during the reauth step? Or should I rather catch the HTTP 401
inside the coordinator.fetch_data()
and redo the login without even triggering the reauth flow?
Thank for any insight you may provide.