@eins78/pixelstatus
v1.1.1
Published
openpixelcontrol client for status displays
Downloads
11
Maintainers
Readme
pixelstatus
[WORK IN PROGRESS]
Build color-coded status screens with LED pixels, Raspberry Pi and fadecandy.
Configure section colors using expectations on a HTTP response.
Provides a daemon with task runner, REST API and Web UI.
Demo
OpenGL Simulator:
git clone https://github.com/eins78/pixelstatus
cd pixelstatus
npm install
npm run demo
Configuration
Overview
SECTION a section of continuos PIXELS on a strip
has one:- TASK something to do (HTTP request, shell command)
has one:- COMPARISON rule(s) to compare against result of a TASK (expect)
has one:- REACTION a state to set on the SECTION
- COMPARISON rule(s) to compare against result of a TASK (expect)
- TASK something to do (HTTP request, shell command)
STATE what to with the PIXELS of a SECTION (set them to a color)
JSON object
See the "Full" (JSON
, YAML
)
and "Minimal" (JSON
, YAML
)
example configuration files and consult this description should questions arise.
The "Full" example has two sections, the first is the most minimal, the other is the most verbose config for a section.
colors
: Object. Keys are names of colors to be used in rest of config, values are validCSS
color strings (names, hex, hsl, …).sections
: Array of Objects with keys:id
: unique short name of section (word-characters allowed)description
: optional description of the sectionstart
: the first pixel which belongs to the section, it will go to the end or one pixel before the next section- a key for one of the runners, like:
command
: run a shell commandrequest
: make a HTTP request
expect
: hash of expectations on (at least one of) the following values (see below for possible expectations):status
: exit status ofcommand
, or http status ofrequest
output
:stdout
ofcommand
, orres
ofrequest
error
:stderr
ofcommand
, orerr
ofrequest
ok
: ifassert
was true, set section to this colorfail
: ifassert
was false, set section to this color
Tasks
request
Make a HTTP request powered by the request module.
See API there, short synopsis below.
Setting it to an URL string makes a
GET
request to this URL.{ "request": "http://example.com" }
Setting it to an hash enables all the bells and whistles:
{ "request": { "method": "GET", "url": "https://example.com", "qs": { "query": "foobar" }, "auth": { "user": "username", "pass": "password", "sendImmediately": false }, "headers": { "User-Agent": "pixelstatus" } } }
Comparisons
The is only one option at the moment:
expect
Can be in one of the following forms
- simple value (number, string): must be exactly equal to compared value
- hash of "comparators" from the
ruler
module and the value to compare.
CLI
./draft.coffee examples/config.json -vv
config
First argument must be the path to a config file.
It can be a JSON
-file as described above, or (structurally equivalent) YAML
.
loglevel
Set console log level by appending one or more -v
's.
-v
is 'info', -vv
is 'verbose', -vvv
is 'debug'.
Credits
The whole project uses lots of great free/open modules and projects:
- https://github.com/scanlime/fadecandy
- http://openpixelcontrol.org
- https://lodash.com
- also see
package.json
for all the npm packages that are used
It is written in CoffeScript.