This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
API
Web API guidance for a total noob
Slirip
Member
Hi!
A total noob need some guidance..
I am trying to build a WebApp, I would like to control/monitor specific lights and trigger flows.
I have linked this to my HTML page:
<script type="text/javascript" src="https://cdn.athom.com/athom-api/2.0.109/athom-api.min.js"></script>
From the Athom Developer docs.
async getDevice(opts) → {HomeyAPI.ManagerDevices.Device}
I can´t understand how to implement this to my JavaScript code, if somebody could give an example code snippet or something so that i could get a starting point.
Thanks!
A total noob need some guidance..
I am trying to build a WebApp, I would like to control/monitor specific lights and trigger flows.
I have linked this to my HTML page:
<script type="text/javascript" src="https://cdn.athom.com/athom-api/2.0.109/athom-api.min.js"></script>
From the Athom Developer docs.
async getDevice(opts) → {HomeyAPI.ManagerDevices.Device}
I can´t understand how to implement this to my JavaScript code, if somebody could give an example code snippet or something so that i could get a starting point.
Thanks!
Tagged:
Comments
From there on you need to do the authorization, and then you can do the device calls.
I only want to convert a simple dashboard which I created before (and was integrated with Home Assistant), to my Homey. It will only show the status of some devices and serve as alarm panel. I think the optimal way should be the Web API (and not use the REST api) but don't know how to authorise my account to AthomCloudApi.
I know I could use homeydash for this project, but I really want to keep my own dashboard.
1. Is my assumption of using WEB Api correct?
2. Do I even need to authorise to AthomCloudAPI in order to receive device statuses and start flows?
3. An example of how to do this in code would be really (really!) helpful. Is authorisation possible without the redirect to the homey login-screen (so not like homeydash)? I don't want to run this in any webserver outside my home.
I think I will manage after that...
Thanks in advance !!
I asked if it maybe was better to add that information to the wiki, but it was apparently clear enough because of the 'beta' label...
Answers on your questions:
1. Didn't get the code working, but I guess you are right after the authorization of you homey
2. Yes, authorization is needed.
3. Even in your network that is needed. But if you know something about web development, there is a workaround. With the development tools open, you should check the request that go to you homey. The important part is the bearer code. You can replay the request if that code is added.
I'll try to find out the "rest endpoints" but this shouldn't be the way to implement things...
Include the js in your head as Slirip did in his original post
From this point on you can use homeyAPI to call the web api functions
So your app -> Athom -> Homey
Is there any documentation ready? Wich url do i need to request??
Plans are to create an dash on my webhost. likely homeydash..