Custom API
Draw your own text and shapes on the LED Ticker from a script, a home server or a web service.
In the web app this is the Web data ticker. There are three ways to send it something:
- The Ticker fetches it from your web address every so often (GET). This works from anywhere.
- You send it to the Ticker with an HTTP POST, on the same network.
- You draw on the panel live over a WebSocket, on the same network.
An alert takes over the whole panel for a few seconds.
The Ticker's address
On your network each Ticker is ticker-code.local, where code is its six-letter ticker code in
lowercase: a Ticker with the code FJNJNW is ticker-fjnjnw.local. The code is under Device → Status in the web
app, and the panel shows it for 10 seconds after you plug it in. Its IP address works too. Some computers and phones can't look
up .local names: use the IP address there.
The Ticker refuses a POST or WebSocket started by a web page on another site, so a script, Home Assistant or a command-line tool is the way to send it. Nothing sent this way shows while Night Mode is on.
Items
Everything is a list of items in JSON. Each item is text or one shape. x and y count from the top
left of the 64 × 32 panel.
Text
| Key | Type | Required | Values | Default |
|---|---|---|---|---|
| text | String | Yes | Up to 16 characters | None |
| size | Integer | No | 0 to 6 (below) | 2 |
| color | String | No | 000000 to ffffff (hex RGB) | ffffff |
| x | Integer | No | 0 to 63 | 0 |
| y | Integer | No | 0 to 31: the bottom of the letters | 7 (0 over WebSocket) |
| align | String | No | L, C or R: x is the left, middle or right of the text | L |
| size | Letters |
|---|---|
| 0 | 3 pixels tall |
| 1 | 5 pixels tall |
| 2 | 7 pixels tall |
| 3 | 10 pixels tall |
| 4 | 14 pixels tall |
| 5 | 20 pixels tall |
| 6 | 30 pixels tall |
Line
| Key | Type | Required | Values | Default |
|---|---|---|---|---|
| shape | String | Yes | line | None |
| x1 | Integer | Yes | 0 to 63 | 0 |
| y1 | Integer | Yes | 0 to 31 | 0 |
| x2 | Integer | Yes | 0 to 63 | 0 |
| y2 | Integer | Yes | 0 to 31 | 0 |
| color | String | No | 000000 to ffffff (hex RGB) | ffffff |
Rectangle
| Key | Type | Required | Values | Default |
|---|---|---|---|---|
| shape | String | Yes | rect | None |
| filled | Boolean | No | true or false | false |
| x | Integer | Yes | 0 to 63 | 0 |
| y | Integer | Yes | 0 to 31 | 0 |
| w | Integer | Yes | 0 to 63 | 0 |
| h | Integer | Yes | 0 to 31 | 0 |
| color | String | No | 000000 to ffffff (hex RGB) | ffffff |
Circle
| Key | Type | Required | Values | Default |
|---|---|---|---|---|
| shape | String | Yes | circle | None |
| filled | Boolean | No | true or false | false |
| x | Integer | Yes | 0 to 63 | 0 |
| y | Integer | Yes | 0 to 31 | 0 |
| r | Integer | Yes | The radius, 1 or more | 0 |
| color | String | No | 000000 to ffffff (hex RGB) | ffffff |
Diamond
| Key | Type | Required | Values | Default |
|---|---|---|---|---|
| shape | String | Yes | diamond | None |
| filled | Boolean | No | true or false | false |
| x | Integer | Yes | 0 to 63 | 0 |
| y | Integer | Yes | 0 to 31 | 0 |
| w | Integer | Yes | 0 to 63 | 0 |
| h | Integer | Yes | 0 to 31 | 0 |
| color | String | No | 000000 to ffffff (hex RGB) | ffffff |
Pixels
A row (or column) of up to 8 pixels, each its own color.
| Key | Type | Required | Values | Default |
|---|---|---|---|---|
| shape | String | Yes | pixel | None |
| hex | String | Yes | Up to 16 characters: 2 per pixel | None |
| x | Integer | Yes | 0 to 63 | 0 |
| y | Integer | Yes | 0 to 31 | 0 |
| align | String | Over WebSocket | H (a row) or V (a column) | H; over WebSocket, always send it |
Each pixel's color is one byte in two hex characters, RRRGGGBB: 3 bits of red, 3 of green and 2 of blue. Put
"align" after "shape" in the item.
| Color | RGB | Binary | Hex |
|---|---|---|---|
| White | 255, 255, 255 | 11111111 | ff |
| Red | 255, 0, 0 | 11100000 | e0 |
| Green | 0, 255, 0 | 00011100 | 1c |
| Blue | 0, 0, 255 | 00000011 | 03 |
| Yellow | 255, 255, 0 | 11111100 | fc |
| Cyan | 0, 255, 255 | 00011111 | 1f |
| Magenta | 255, 0, 255 | 11100011 | e3 |
A row of 8 pixels, white and black in turn: "ff00ff00ff00ff00".
The panel has 256 colors, so every color is rounded to the nearest of them in the same way.
Lists and pages
A GET, a POST and an alert all take a list of up to 256 items. An example:
[
{
"text":"Size 1",
"color":"FF0000",
"size":1,
"x":31,
"y":4,
"align":"C"
},
{
"text":"Size 2",
"color":"00FF00",
"size":2,
"x":1,
"y":15,
"align":"L"
},
{
"text":"Size 3",
"color":"0000FF",
"size":3,
"x":62,
"y":15,
"align":"R"
},
{
"text":"Size 4",
"color":"00FF00",
"size":4,
"x":1,
"y":30,
"align":"L"
}
]
On the panel:
A list of lists makes pages. The Ticker shows each page in turn, each for the web app's Seconds per ticker:
[
[
{
"text":"Size 1",
"color":"FF0000",
"size":1,
"x":31,
"y":4,
"align":"C"
},
{
"text":"Size 2",
"color":"00FF00",
"size":2,
"x":1,
"y":15,
"align":"L"
}
],
[
{
"text":"Size 3",
"color":"0000FF",
"size":3,
"x":62,
"y":15,
"align":"R"
},
{
"text":"Size 4",
"color":"00FF00",
"size":4,
"x":1,
"y":30,
"align":"L"
}
]
]
If Web data has a smaller part of the panel in your layout, x and y count from that part's top left.
Items that start outside it are left out, and text is cut to fit.
GET: the Ticker fetches your list
In the web app, open Web data and fill in:
| Setting | What it is |
|---|---|
| Secure connection (HTTPS) | On for an https address |
| Host | The server, such as example.com, or example.com:8080 for another port |
| Path | The rest of the address, such as /ticker.json?city=minneapolis |
| Authorization | Optional: sent as the request's Authorization header, such as Bearer abc123 |
| Refresh rate | How often to fetch it, from every 5 seconds to once a day |
The answer must be the list in JSON, within 30 seconds. One redirect (302) is followed. The Ticker fetches only while Web data is in your layout, and after a failure it tries again later, waiting longer each time, up to 30 minutes.
POST: you send your list
Send the list as the body of a POST to http://ticker-code.local/api. It replaces what Web data shows, and
shows whenever Web data is on the panel in your layout. It answers OK.
curl -X POST http://ticker-fjnjnw.local/api -d '[{"text":"Hello","x":32,"y":15,"align":"C"}]'
WebSocket: draw live
Connect to ws://ticker-code.local/api. The first message takes over the whole panel; then:
- Each message is one item (not a list), drawn as soon as it arrives.
clearclears the panel.exitgoes back to the normal display, as does a minute with no message. Send any message, even an empty one, to keep it.- Text sizes and colors are as above, but text without a
yis at the top (0), and a pixel row needs"align":"H".
Alert
An alert takes over the whole panel for a few seconds, then the Ticker goes back to what it was showing. Send a list as the body
of a POST to http://ticker-code.local/alert. It needs at least one text item; only the first page is shown.
| In the address | Values | Default |
|---|---|---|
| length | Seconds: 1 to 300 | 3 |
| brightness | 1 to 10 | The current brightness |
curl -X POST "http://ticker-fjnjnw.local/alert?length=5&brightness=10" -d '[{"text":"Doorbell","size":3,"x":32,"y":20,"align":"C"}]'
It answers OK, or 409 while another alert is showing or Night Mode is on, or 400 for a list with no text.