Using unofficial APIs in integrations?

What is the common standard when using an unsupported API in an integration? I’m hoping I can submit it to the main project if all goes well (it’s the equivalent of comed_hourly_pricing but for a New Zealand Power company).

The API I have was reverse-engineered from the app by sniffing it’s traffic. It’s OAuth using a secret key/token for the app, and then a simple API call that returns result.

I’ve emailed them asking if that API, or any at all, is supported publicly and they said no.

Cheers :slight_smile:

There are several integrations out there doing the same thing. I have made a few myself. One thing that you might want to consider is being able to override the secret that you are using in your library by adding something to a HA yaml config that way if the secret changes you won’t need to update the library

Thanks :slight_smile:

I have indeed added a config to use a secret, which defaults to the one the app uses.

For integrations in HA core, is it required to split out the API call to a pypi library?

In this case it’s just 2 REST API calls, one for OAuth and one for the actual data. (WIP implementation is on Github here)

I am not 100% if it is a requirement, but it is highly suggested, if someone else wants to use the library in another project they can. Helps the open source community more than it all being in the HA code.