Giter Club home page Giter Club logo

pixel-server's Introduction

Build Status Coverage Status

Server for send signals to arduino pixel_meter or AnyBar.

pixel

Usage

  • Start server, it will default listen at *:8246
  • Send POST request to /status like this:
http -f POST http://localhost:8080/status value=50 message='first string\\second string' blink=2
  • Or configure your Kapacitor to /kapacitor like this:
data
    |alert()
        .post('http://localhost:8246/kapacitor')

Configure server

Command-line parameters

pixel-server \
--web-host="" \
--web-port=8246 \
--serial-port=COM3 \
--serial-speed=9600
--anybar-port=1738
--brightness=100

Environment variables

PIXEL_SERVER_SERIAL_PORT=COM3 \
PIXEL_SERVER_SERIAL_SPEED=9600 \
PIXEL_SERVER_WEB_HOST= \
PIXEL_SERVER_WEB_PORT=8246 \
PIXEL_SERVER_ANYBAR_PORT=1738 \
PIXEL_SERVER_BRIGHTNESS=100 \
pixel-server

Command-line parameters has priority over environment variables.

Request parameters for /status

  • value - value of signal, required,
    0 to 100 (red to green),
    -1 for off led
  • message - message for 16x2 display, lines should be splitted with \ symbol, default no message
  • blink - blink state, default 0,
    0 for not blinking,
    1 for blink 3 times and back to previous state,
    2 for persistent blinking
  • brightness - led brightness, 0 to 100, default 100

Examples:

http -f POST http://localhost:8246/status value=50

Behaviour

If status changes from red to green, will be used smooth color change. If status changes from green to red, color will changed with blinking with last color.

pixel-server's People

Contributors

popstas avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

pixel-server's Issues

Add config file or config with command line arguments or envvars

Now config stored in source:

const (
    SerialPort  = "COM3"
    SerialSpeed = 9600
    WebHost     = ""
    WebPort     = 8080
)

Need to add arguments like this:

pixel-server -host=localhost -web-port=8080 -serial-port=COM3

or this:

PIXEL_SERVER_HOST=localhost \
PIXEL_SERVER_WEB_PORT=8080 \
PIXEL_SERVER_SERIAL_PORT=COM3 \
pixel-server 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.