BlinkStick.com API features for standalone server

Arvydas Juskevicius edited this page Apr 27, 2016 · 3 revisions

BlinkStick Client application can be configured to connect to standalone BlinkStick.com server.

Preparations

Download the latest release of BlinkStick Client application.

BlinkStickClient-Setup-2.0-rc9-x86.exe

Standalone server

Download standalone server release:

blinkstick-server-standalone-0.5.zip

Install https://nodejs.org/en/ and start server by running start.bat contained within the zip file.

Configure BlinkStick Client application to connect to your server

Make sure that BlinkStick Client application is turned off and open this file:

C:\Users[YOUR-USER-NAME]\AppData\Roaming\Agile Innovative\BlinkStick\data.json

Find ApiAccessAddress and replace the value with the local server address.

{
  "ApiAccessAddress": "http://localhost:3000/faye"
}

Start BlinkStick Client application and add BlinkStick.com notification. Supply any string as API key in the edit box. For the sake of this example we will use 1234 as API key. If there is more than one BlinkStick Client application connecting to the server, ensure that they all have unique API keys if you want to control them individually.

Standalone server API

Test server runs on port 3000 and all API requests are handled through

http://127.0.0.1:3000/update

Parameters

  • device - The API key of the device you want to control. If you do not supply this parameter all devices will be updated.
  • (!) status - accepted value is "off" to turn off BlinkStick
  • (!) color - color to send to the device as RGB value (rrggbb) or named color
  • (!) pattern - name of the pattern you want to play
  • firstLed - override index of first LED to control. Available values are [0..63]. Defaults to value specified in the notification.
  • lastLed - override index of last LED to control. Available values are [0..63]. Defaults to value specified in the notification.
  • channel - override channel to control. Applies only to BlinkStick Pro. Available values are [0..2]. Defaults to value specified in the notification.
  • repeat - number of times to repeat pattern. Set value to "loop" to loop indefinitely until another pattern is sent or specify a number larger then 0 to play pattern that many times.
  • duration - duration to repeat pattern in milliseconds. Applies only to patterns. Can use only one repeat or duration parameter.

(!) - at least one of the supplied parameters is required

Examples

Turn BlinkStick off:

curl "http://127.0.0.1:3000/update?device=1234&status=off"

Set BlinkStick red with default channel, and LED index parameters:

curl "http://127.0.0.1:3000/update?device=1234&color=ff0000"

Set BlinkStick blue and override LED indexes:

curl "http://127.0.0.1:3000/update?device=1234&color=ff0000&firstLed=4&lastLed=5"

Play pattern "police":

curl "http://127.0.0.1:3000/update?device=1234&pattern=police"

Play pattern "police" on all connected BlinkSticks:

curl "http://127.0.0.1:3000/update?pattern=police"

Play pattern "police" 5 times:

curl "http://127.0.0.1:3000/update?device=1234&pattern=police&repeat=5"

Play pattern "police" and keep playing until a color is sent or another pattern playback is requested:

curl "http://127.0.0.1:3000/update?device=1234&pattern=police&repeat=loop"

Play pattern "police" for LEDs 1..5:

curl "http://127.0.0.1:3000/update?device=1234&pattern=police&firstLed=1&lastLed=5"

Play pattern "police" for 5 seconds with default settings:

curl "http://127.0.0.1:3000/update?device=1234&pattern=police&duration=5000"