Skip to content
Jason Coon edited this page May 24, 2015 · 6 revisions

JSON API Availability

The JSON API currently supports sending commands and receiving responses via Serial.

Commands

All input commands available via IR are also available via the API:

{ "command":"Update" }
{ "command":"Up" }
{ "command":"Down" }
{ "command":"Left" }
{ "command":"Right" }
{ "command":"Select" }
{ "command":"CycleBrightness" }
{ "command":"PlayMode" }
{ "command":"Palette" }
{ "command":"CycleOverlay" }
{ "command":"ShowClock" }
{ "command":"HideOverlay" }
{ "command":"Power" }
{ "command":"Back" }
{ "command":"BrightnessUp" }
{ "command":"BrightnessDown" }
{ "command":"Menu" }
{ "command":"ShowCurrentMessage" }
{ "command":"AudioScaleUp" }
{ "command":"AudioScaleDown" }
{ "command":"ToggleSettingsMenuVisibility" }
{ "command":"ShowPatternName" }
{ "command":"FreezeDisplay" }

Scrolling Text Messages

Scrolling text messages can be shown with the message command:

{
  "message": {
    "text": "Serial API is alive!",
    "red": 255,
    "green": 255,
    "blue": 255,
    "top": 20,
    "left": 4,
    "font": "gohufont11b",
    "speed": 28,
    "mode": "bounceReverse"
  }
}

Weather

The temperature can be set with the temperature command:

{ "temperature":99 }

The weather type (animation) can be set with the weatherType command:

{ "weatherType":0 }

Weather types:

0 sunny
1 cloudy
2 hail
3 lightning
4 partly cloudy
5 partly cloud with rain
6 raining
7 snow
8 snow and rain
9 stormy

Palettes

The current palette can be set with the palette command:

{ "palette":"PALETTE NAME" }

Available palettes can be listed with the ListPalettes command:

{ "command":"ListPalettes" }

The response will contain the palette count and names:

{
  "count": 10,
  "results": [
    "Rainbow",
    "Ocean",
    "Cloud",
    "Forest",
    "Party",
    "Grey",
    "Heat",
    "Lava",
    "Ice",
    "Random"
  ]
}

Audio Patterns

Specific audio patterns can be shown by name with the audiopatterncommand:

{ "audiopattern":"PATTERN NAME" }

Or by index:

{ "audiopattern":4 }

Available patterns can be listed with the ListAudioPatterns command:

{ "command":"ListAudioPatterns" }

The response will contain the audio pattern count and numbers:

{
  "count": 5,
  "results": [
    "0",
    "1",
    "2",
    "3",
    "4"
  ]
}

Patterns

Specific patterns can be shown by name with the pattern command:

{ "pattern":"PATTERN NAME" }

Or by index:

{ "pattern":4 }

Available patterns can be listed with the ListPatterns command:

{ "command":"ListPatterns" }

The response will contain the pattern count and names:

{
  "count": 5,
  "results": [
    "FlowField",
    "Spin",
    "Noise",
    "Wave",
    "Attract"
  ]
}

Animations

Specific animation files can be shown by name with the pattern command:

{ "animation":"ANIMATION FILE NAME" }

Or by index:

{ "animation":4 }

Available animation files can be listed with the ListAnimations command:

{ "command":"ListAnimations" }

The response will contain the animation file count and names:

{
  "count": 5,
  "results": [
    "LINES.GIF",
    "PACMAN.GIF",
    "PIXELM~1.GIF",
    "PIXELM~2.GIF",
    "PIXELM~3.GIF"
  ]
}

Brightness

Brightness can be set with the brightness command:

{ "brightness":255 }

Background Brightness

Background brightness can be set with the backgroundBrightness command:

{ "backgroundBrightness":255 }