
API Examples to get started.
Hi All,
I want to share the API basics so you guys can start hacking your NEEO with other tech.
Be warned that things might change over time, and anything that doesn't start with API is officially not supported.
What do you need:
- The IP address of the brain. (use this in place of <Brain_IP>) can be found in the about screen of the NEEO app.
- A browser
- REST tool / or something to format JSON in a readable fashion.
As a rest tool, I sometimes use the chrome plugin "Advanced rest client". I mostly just use a browser for the HTTP GET API commands. You could also use curl of course.
# Get the brain configuration:
GET http://<Brain_IP>:3000/v1/projects/home/ example: http://192.168.1.20:3000/v1/projects/home/
# Get all rooms and it's child configurations.
The following request will return all rooms, the unique room key <KEY> and all child configurations
GET http://<Brain_IP>:3000/v1/projects/home/rooms/
#Get a specific room and it's child configurations.
GET http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/ example: http://192.168.1.20:3000/v1/projects/home/rooms/6251100181549845340/
#Get all devices from a specific room and it's child configurations.
GET http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/devices/ example: http://192.168.1.20:3000/v1/projects/home/rooms/6251100181549845340/devices/
#Get a specific device and it's child configurations.
GET http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/devices/<Device_KEY>/ example: http://192.168.1.20:3000/v1/projects/home/rooms/6251100181549845340/devices/6251100181549845341/
#Get all macros from a specific device.
GET http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/devices/<Device_KEY>/macros example: http://192.168.1.20:3000/v1/projects/home/rooms/6251100181549845340/devices/6251100181549845340/macros
#Trigger a Macro (Push a button).
GET http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/devices/<Device_KEY>/macros/<Macro_KEY>/trigger example: http://192.168.1.20:3000/v1/projects/home/rooms/6251100181549845340/devices/6251100181549845340/macros/6251100181549845340/trigger
From now on i'll fast forward as the above examples should be clear how to obtain the key's and how the structure works.
#trigger a recipe.
GET http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/devices/<Device_KEY>/macros/<Macro_KEY>/trigger
#power off a Scenario.
GET http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/scenarios/<Scenario_KEY>/poweroff
#Start favourite Channel 3.
GET http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/devices/<Device_KEY>/favorites/3/trigger
#Set a slider to value 24. (include application/json as contenttype)
PUT http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/devices/<Device_KEY>/sliders/<Slider_KEY>/ content: {"value":24}
#Set a switch state.
PUT http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/devices/<Device_KEY>/switches/<Switch_KEY>/on PUT http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/devices/<Device_KEY>/switches/<Switch_KEY>/off
#Get system info.
GET http://<Brain_IP>:3000/v1/systeminfo/
# Blink NEEO Brain LED
http://<Brain_IP>:3000/v1/systeminfo/identbrain
# Recipes
GET http://<Brain_IP>:3000/v1/api/Recipes
# Is recipe Active?
GET http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/recipes/<Recipe_KEY>/isactive
-
Is there any actual documentation for the API? Examples are nice, but clear documentation indicating the entrypoint/name with input and output is an absolute must in my opinion. Just some examples and see what you get back is a bad way of coding, and leads to wrong long-term assumptions in my experience.
And clearly the NodeJS SDK is also just using an API, documenting this would be very desirable, so people can write drivers in other languages, since in the end it's just a REST API.
-
Niels de Klerk I found some interesting url hehe, but I found
twooneproblem
striggering it in the last step.If someone is interested, here is the result of my research :)
#get the active scenariokeys
GET http://brain-ip:3000/v1/projects/home/activescenariokeys
#Sonos start menu (you can find here the directory-key for each element
GET http://brain-ip:3000/v1/projects/home/rooms/room-key/devices/device-key/getdirectoryrootitems
#My sonos favorites
POST http://brain-ip:3000/v1/projects/home/rooms/room-key/devices/device-key/directories/directory-key/browse
#procecures per device (you can get here procedure-key)
In orde to use it into the tigger url must look for the one that is named "ADD_TO_QUEUE_PROCEDURE"
GET http://brain-ip:3000/v1/projects/home/rooms/room-key/devices/device-key/procedures
#trigger an action (a favorite or from start menu) -> where I found the problems hehe
POST http://brain-ip:3000/v1/projects/home/rooms/room-key/devices/device-key/procedures/procedure-key/trigger
Ican’t find a way to get the “procedure-key”, I found a way to get the procedure key, but the tigger url returned the answer is "directoryId can't be blank”.I try a lot of combinations to pass the “directoryId” that can be found in sonos favorites or sonos start menu, but I can’t make this to work 🙄
-
Having read the docs, it seems there is only a way to send a specific command to the NEEO brain based on the device/activity i want to control.
What would be very cool, is if the device added an extra set of api controls that were generic.
What i mean by that is....
Right now i have to send, PAUSE, of the DirecTV box, in the LIVINGROOM.
instead what if I could just send => 'PAUSE'
then the NEEO brain knew i was using direcTV so then it sends the pause command to the directv (same could be said for a set of generic controls, up/down/left/right/select/menu/play/pause.
any thoughts?
-
Hi,
is it possible to get a line break into a text label of Neeo?
If you add three text labels to your shortcut screen its full. So i want to sum up the information into one label and seperate it by line breaks.
module.exports.getAlbum = function(deviceid) { return "this is a nice Album"; };
How do i break this text into seperate lines?
-
Hi there, thank you for your short description of the API.
I have quite problems from the beginning. If I try to get info with Postman
GET
{{brainip}}:3000/v1/projects/home/
I get an error There was an error connecting to 192.168.55.177:3000/v1/projects/home/
the same with curl, no response. On the other hand if I paste 192.168.55.177:3000/v1/projects/home/ in a browser, I get a correct JSON response. Can anyone help me what I am doing wrong or how to setup Postman for testing correctly
-
Niels de Klerk Fonzo I've just publish a simple API wrapper module if this is of any use to you: https://www.npmjs.com/package/neeo-api
It doesn't do everything, but it does allow you to set/delete the forward actions endpoints.
-
I don't know if anyone is still here, but I started using the API yesterday - its fantastic!
I can trigger a recipe using
GET http://<Brain_IP>:3000/v1/projects/home/rooms/<Room_KEY>/recipes/<Recipe_KEY>/execute
But I would like the remote to bring up the device specific screen as well.
eg. If I press "watch tv" on the remote, it starts up the TV and then brings up the TV channel list on the remote.
Is this possible with the API? (or maybe it cannot be done as the API only controls the brain not the remote?)