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.

Rest API

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.

Comments

  • casedacaseda Member
    edited January 2017
    There is an REST API available, there is no public documentation yet though, as it is still bound to change a little

    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
  • Why is there no public documentation??? Thats very important to build own mobile apps or homebridge, Alexa support for the community! Atom would only benefit from a good rest api documentation. Cause every software benefit from this. It's like sonos. I bought 5 sonos speakers cause the community is very good for the speakers and i can use so many third party tools for it.
  • and that is the exact reason why there is no public documentation about the REST API.. the chance of it changing is still there.
    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
  • caseda said:
    and that is the exact reason why there is no public documentation about the REST API.. the chance of it changing is still there.
    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
    This is just another stupid excuse !!! 
  • @Jschuetz no, it's called smart.

    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
  • And? Where is the problem? With a changelog everyone could check the changes. Better than as to sniff all commands. And normally the rest api should not change every 2 weeks.  
  • I agree that the REST API should not change every 2 weeks. That is, when it's finished!
    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.
  • Jschuetz said:
    And? Where is the problem? With a changelog everyone could check the changes. Better than as to sniff all commands. And normally the rest api should not change every 2 weeks.  
    As long as you are sniffing a rest api then this rest api is not meant to be used other then by the company who build it anyway and therefore they don't need to give documentation. It is a choice they made and it is their right to do so ( its their product). 
  • CodeKingCodeKing Member
    edited February 2017
    By the way, the REST API isn't hard to understand, just use some of those endpoints.

    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:
    1. go to my.athom.com
    2. login with your credentials
    3. the bearer code is attached to the link of your homey (bearer_token=....)



  • CodeKing said:
    By the way, the REST API isn't hard to understand, just use some of those endpoints.

    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:
    1. go to my.athom.com
    2. login with your credentials
    3. the bearer code is attached to the link of your homey (bearer_token=....)



    Is it possible to authentificate with a http post method?
  • Just like a lot of other programming interfaces REST offers several ways to version your service. So documentation could and should be available. The software not "being ready" is not an excuse especially, software is never finished. Do you think google, or Office 365 or Azure  rest api's are ever " finished"? Now you have software that "isn't ready" which you can use, but you have to guess how. 


  • SommoSommo Member
    What they told to us.. its an alpha..its a beta  :s
  • JschuetzJschuetz Member
    edited March 2017
    quatic said:
    Just like a lot of other programming interfaces REST offers several ways to version your service. So documentation could and should be available. The software not "being ready" is not an excuse especially, software is never finished. Do you think google, or Office 365 or Azure  rest api's are ever " finished"? Now you have software that "isn't ready" which you can use, but you have to guess how. 


    Very good example. Homey benefits from all manufacturers with Open API. Without this homey would only be a white Ball. 

    Update: A official Rest Api will come with the new API settings panel. (release date: not clear)
  • CodeKing said:
    By the way, the REST API isn't hard to understand, just use some of those endpoints.

    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:
    1. go to my.athom.com
    2. login with your credentials
    3. the bearer code is attached to the link of your homey (bearer_token=....)




    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?

Sign In or Register to comment.