Hey all, I am new to HA development. I am exploring the U-tec REST API that was recently released. (They make smart locks, of which I have one.) API is my only option since my lock is only WiFi capable.
I threw together a quick python script to test the U-Tec API. It works fairly reliably, even though the docs are still a work in progress. I can get lock status and sensors, lock, and unlock the device. Aside from a slight delay, it all works well.
I want to explore adding a custom HA integration. I’ve been reading the docs a bit, but have some questions that I am hoping someone can point me to.
Are there existing functions or modules in HA that handle OAuth’s Authorization Code flow? I would need to fetch an authorization code, get the user to login to the U-tec account for scopes consent, etc. (Client Credentials flow doesn’t appear to be supported.) Then I would need to exchange the authorization code for a Bearer and Refresh tokens. I suppose I can use the secrets functionality to store some of this. Or is there a better way? Is there functionality in HA that monitors refresh token and access token expiration?
Is there any functionality in HA that would listen for 3rd party API events? Hopefully, it would function as a redirect_uri as well. I could use localhost uri if I am initiating all the status polling and commands. Event subscriptions would be nicer, I think. I do pay for HA cloud, so hopefully that would help.
Thanks in advance!
I can get all this going on my own in a Python script, but that feels like the wrong way to go about it.