Connecting to the Homey API?

Hi All,

I see some great alternatives here with HomeyDash and some other alternatives, but I want to be able to fully customize and maintain the dashboard (reinvent the wheel). I’m a web and windows developer myself, with some knowledge of Unity as well and that one lets me deploy to Android and a lot of other platforms.

So I’m actually thinking about creating a whole new dashboard build upon the Unity engine and made cross platform with that so I could publish it to any kind of tablet.

This would allow me to create all kind of neat looking controls, but my main issue is the communication to Homey. There seems to be a web API (https://api.developer.homey.app/) but it is not open to the public.

HomeyDash seems to be using Homey Ink credentials and methods, but that would add another layer of dependency. It must be possible to talk directly to the Homey API?

I thought about having the dashboard app fill a queue of Homey commands and run a HomeyScript within Homey processing the queue, but that is also causing performance and overhead.

I’m requesting the web API key, but it seems only for companies. Anyone ever tried something similar already? Do they change that API a lot after every release? If it’s not a stable API I’m rethinking putting a lot of time and effort into this :slight_smile:

Homeydash’s dependancy on homey.ink is for authentication only, once there’s a token it no longer uses homey.ink.
Whatever you’ll build will have to authenticate against Athoms infrastructure, might as well piggyback on something existing (as you will not be getting an API key). Never looked into it but maybe can do it transparant to the user.

The Web API is very stable and hasn’t really changed a lot over the years. However, Athom just doesn’t seem to be interested in making it available to the public.

Curious where you guys got that information from, if you contact Athom support with a (valid) request for API keys, they will give it out (and have done so a few times already for community members).

There is just no easy way yet to get the keys.
They have been busy with it, combining it with the app store, but I guess it is really low on the priority list.

Except for Homeydash (although perhaps Athom’s stance towards this (valid) product has changed since the last time it was asked).

It seems you can access the API for local development:

While the Web API is not yet available, you can use these API Credentials to test your project locally.

Key Value
Client ID 5a8d4ca6eb9f7a2c9d6ccf6d
Client Secret e3ace394af9f615857ceaa61b053f966ddcfb12a
Callback URL http://localhost , http://localhost/oauth2/callback
Scopes homey

So I should be able to run a proxy service locally on the LAN and expose that over the internet if that works. Think I will try that while waiting response if they would allow me a API key.

They also indicate “is not yet available”, don’t know how long that phrase is there already, but raises hope that it would be available some day.

And a wear os app (abandoned unfortunately, but still available), and there was an mobile app made by I believe a Russian? First with a work around, later officially

Those were the public ones, but i think there have been more keys given out.

I requested the key, but got a response that because of Covid-19 it could take a whiiiiile before a receive any answer.

While the dashboard would be installed on the local network anyway it should be able to connect to the localhost API already. Perhaps I don’t even need the proxy or a public key for this. I was thinking about running the application logic on Azure Cloud, but if I integrate it all within the app itself it could simply work.

Isn’t it a bit weird that all homey’s seem have the same client id and secret key locally? So I could create an app that would work as soon as I plug it in to anyones LAN and have full Homey access with it?

You still need to login (oauth) to their account to be able to manage their Homey.

Athom in COVID-19 times: “Let’s build a Homey Cloud service and design an entirely new device to go with it!”

Also Athom in COVID-19 times: “No sorry, generating a few API keys is going to take a while…”

Well this sucks :slight_smile:

Thank you for contacting Athom support.
Sadly we are not allowed to share any API keys.

Great how nice and open Homey is for developers… not…

You can’t even seem to authenticate locally. Others all seem to be using homey.ink to get a unlimited token from there ( [Unsupported] Homey v2 REST API - Developers - Homey Community Forum (athom.com)).

Why would you local homey not simply provide a REST API to authenticate to? For now this seems like the best cumbersome way to do it:

Getting a bearer token - Homey (solweb.no)

1 Like

Correct, Athom thinks that authenticating through the cloud is more secure than local authentication.

Cool, i’ve been prototyping a bit today and migrated the great work from Getting a bearer token - Homey to a C# class that I could use within Unity.

It only needs the cloudid, e-mail address and password (clientid and secret are static for everyone I believe), but could then resolve the token all by itself, working completely against the athom cloud, so it will work when you are not at the local network. I even doubt this solution will raise the Naamloos question as it seems to be hacking around that :slight_smile:. Don’t know for sure yet as I did press allow a couple of times during testing, but the code seems to be working around it with the _csrf cookie.

Been very rewarding as I already have a Unity Andoid project published to my mobile now with two spheres in it that now actually control two different lights :slight_smile:.

So that was about the hard part for me, getting commands to my Homey and that now works better than I expected without using Homey.Ink or anything else. I can also use the obtained key in Postman and test all of the commands documented at HomeyAPIV2 - Homey Web API from there.

So now the actual fun part begins :smiley:. Thanks for all the help and especially to Andreas Akre Solberg from his solution in HomeyScript that had all the hard work getting to the bearer token.

2 Likes

Another question…, where is the documentation about the latest API? I found this URL with APIV1 and APIV2 described:

HomeyAPIV2 - Homey Web API (athombv.github.io)

So I thought the V2 version would be the latest and greatest. But I also ran into this URL:

Home - Homey Apps SDK v3

With a SDK V3. Downside with that one is that it does not seem to have a managerdevices. Al I correct that the HomeyAPIV2 is indeed the most recent?

I am getting really excited about this project, all dashboards I’ve seen so far are still “flat” dashboards with buttons and menu’s. By creating this in a game engine I can show my house in 3D, move around it and click actual rooms and lights and have them “visualize” the change in 3D, so a light would actually show up as on lighting up a room.

The weather can be visualized as actual clouds or sun above the house, it’s extremely fun so far. Hope the Homey API will stay accessible like this.

You are mixing up the apps SDK and webAPI
Are you going to build an Homey App or webApp?

Your startpoints are int he upper right corner

But be aware the webAPI is only on request. But you can start with local development.

Thanks for your quick and helpfull reply! I can use all of the web API’s already getting the bearer token, they are all responding correctly but then I found the v3 SDK and got a bit confused :slight_smile:

I’m building a whole new Homey dashboard in a game engine (Unity) so I can deploy a 3D dashboard of my house to a Andoid or iOS tablet. I don’t think it’s either of the build options, but I need to be able to communicate with Homey.

I’ll stick with the V2 API, I don’t really get why it would be only on request as it is working just fine. It also indicates that it is not yet available to the public, but that does not seem correct as well. Just hope it will stay this way as I’m about to put a lot of time in my 3D dashboard :smiley:

You’re using an unapproved, “hacky”, authentication method.

Will they stop allowing it? Because they don’t have any alternatives as far as I’m aware of and this is great for enthousiasts like me that want a 3D dashboard instead of a static 2D dashboard with buttons. The “open” aspect of Homey was one of the main reasons I’ve bought it.