Skip to content

NEEOInc/neeo-sdk-examples

Repository files navigation

NEEO SDK Examples Build Status

You can find the SDK documentation at https://github.com/NEEOInc/neeo-sdk.

To find out more about NEEO, the Brain and "The Thinking Remote" checkout https://neeo.com/.

Prerequisite

Getting started

  1. Checkout this repository locally.
  2. Open a terminal in the folder of the repository you checked out.
  3. Run npm install to install needed dependencies.

Working with NEEO Brain Recipes

One way to use the SDK is to trigger Recipes and fetch information about the Recipes.

For example:

  • Find the nearest Brain
  • Get a list of recipes
  • Find out which recipes are currently powered on

You can run this example via npm run example:recipe, the sample code is located in scripts/recipe/listAllRecipes.js.

Another way is to enable action forwarding to track what is happening on the Brain (power on and power off of recipes and more). You can run that example via npm run example:forwardaction, the sample code is located in scripts/forwardaction/.

Adding custom devices to the NEEO Brain

Another way to use the SDK is to add support for custom devices.

Example SDK Drivers

The source implementation of the example drivers are located in lib/.

Running the example SDK Drivers

To start a server with the example SDK Drivers using the CLI, and register the devices to the first Brain found on the network, run the command:

npm start

To connect to a specific Brain you can configure options for the CLI in the package.json file. For example to connect to a Brain with the ip of 10.0.0.42 change the line with brainHost to include the ip:

  "brainHost": "10.0.0.42",

Creating custom devices

There's 2 main parts:

1. the adapter definition: the adapter defines what the custom device can do. We use a factory to simplify the creation of a device, set the handlers and register it with a running Brain. This also exports your driver (allowing other tools like the CLI to run your driver)

2. the controller implementation: the controller needs to implement all the capabilities defined by the adapter. It then handles the events and interacts with the NEEO Brain when a device is added to the Brain.

You can find all the example devices in the lib directory. You can also find some of the drivers implemented by the community on NPM.

Publishing NEEO Drivers

If you implement a driver and share it with others we currently recommend publishing it to NPM as a module. Using the "neeo-driver-" prefix for the name will make it easy for others to find it.

The neeo-driver-example directory shows what a minimal self contained driver might look like.