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.
Rest API
Jschuetz
Member
in Developers
Hey Guys,
is there an rest api to query and control all devices with external programs? I am not talking about the api for the homey apps.
is there an rest api to query and control all devices with external programs? I am not talking about the api for the homey apps.
Comments
you can look at homeyDash for reference how it does work, he is using the most optimal and up-to-date way for controlling homey with the REST API
so it won't be very good to start with.
if you want to build something on the REST API you can still "sniff" all the (usable) commands
I've seen ENOUGH, companies that do the exact opposite, have rest api documentation but either it is not working (ie: eneco toon) or change it from time to time (ie: Philips hue) and everybody needs to adapt change and fix theirs apps constantly
What would you rather have, documentation that is right and working.
Or change your app every 2 weeks/month because it changed.
Or (how athom is doing it now) you can get the commands since you Can get them, but you really know it can change, and you know what changed instantly by just comparing/looking at the command thats changed
Since it is not finished yet, it will change. And that's also the reason there is no documentation yet: it's not the final version.
A few examples:
Get data
GET http://<HomeyIP>/api/manager/geolocation/ (read location)
GET http://<HomeyIP>/api/manager/devices/device/ (read all devices)
GET http://<HomeyIP>/api/manager/devices/device/<device_id>/ (read device by id)
GET http://<HomeyIP>/api/manager/flow/flow/ (read all flows)
GET http://<HomeyIP>/api/manager/flow/flow/<flow_id>/ (read all flow by id)
Set data
PUT http://<HomeyIP>/api/manager/devices/device/<device_id>/state/
(update capability of a device via json body, e.g. {'target_temperature': 20} triggers an thermostat to temperature of 20°, {'onoff': 1} switches a plug / switch 'on', etc).
Bearer token
For requests outside homey you have to authenticate with your bearer token:
Update: A official Rest Api will come with the new API settings panel. (release date: not clear)
Great info. Do you also know how to trigger a flow, if I want to build my own dashboard to 'turn on the lights' or so?