Giter Club home page Giter Club logo

pixoo-rest's Introduction

Pixoo REST

A RESTful API to easily interact with the Wi-Fi enabled Divoom Pixoo devices.

Table of Contents

Introduction

The main purpose of this app is to provide an easy-to-use Swagger UI to interact with your Pixoo device.

Making it easier to ...

  • โœ๏ธ draw pixels, lines, rectangles, and text
  • ๐Ÿ–ผ๏ธ quickly upload images
  • ๐ŸŽž๏ธ play animations using GIFs
  • โš™๏ธ set the device's channel, brightness, etc.

... from your own applications or home-automation tasks.

Pixoo REST makes use of the great Pixoo Python library by SomethingWithComputers; which offers various helpful features like automatic image conversion. ๐Ÿ‘

However, it is also possible to simply pass through raw JSON-data to the Pixoo's built-in HTTP-API via this Swagger UI.
(The Swagger UI will provide handy example payloads (for easy editing) in this case.)

Disclaimer

This REST API is by no means a by-the-books reference on how proper REST APIs should be implemented; but simply a "convenience wrapper" for the aforementioned Pixoo library.

The actual HTTP API of the Pixoo device leaves a lot to be desired.
First and foremost proper/official documentation. ๐Ÿ˜‰
Most of the pass-through payload objects got discovered via reverse engineering, try-and-error, or this website: doc.divoom-gz.com.

โš ๏ธ Use at your own risk.

Changelog

A (more or less) detailed changelog can be found here: ๐Ÿ“–

Getting started

Clone

Clone this repo ...

git clone https://github.com/4ch1m/pixoo-rest.git

... and change directory:

cd pixoo-rest

Init

Update/initialize the pixoo submodule:

git submodule update --init

Configure

Create an .env-file alongside the app.py-file / docker-compose.yml-file and put your individual settings in it; like so:

# MANDATORY: the hostname of your Pixoo device; defaults to "Pixoo64" if omitted
PIXOO_HOST=192.168.178.11

# OPTIONAL: enable debug mode for the Pixoo-library; defaults to "false" if omitted
PIXOO_DEBUG=true

# OPTIONAL: the screen size of your Pixoo device (which gets passed to the Pixoo-library); defaults to "64" if omitted
PIXOO_SCREEN_SIZE=64

# OPTIONAL: enable (Flask) debug mode for the REST-app; defaults to "false" if omitted
PIXOO_REST_DEBUG=true

# OPTIONAL: the hostname to listen on; defaults to "127.0.0.1" if omitted
PIXOO_REST_HOST=0.0.0.0

# OPTIONAL: the port being used; defaults to "5000" if omitted
PIXOO_REST_PORT=5000

Running

The app can now be run ...

  • ๐Ÿ directly; using your existing (venv-)Python installation

or

  • ๐Ÿ“ฆ fully packaged inside a dedicated (Docker-)container

Direct

Create a virtual environment and activate it (optional; but recommended):

python3 -m venv venv
. venv/bin/activate

Install all dependencies:

pip install -r requirements.txt

Finally, run the app:

python app.py

Containerized

Simply execute ...

docker compose up

... to automatically build the container and run it.

Usage

Open http://localhost:5000 in a web browser and make some requests using the Swagger UI:

Screenshot

NOTE:
For every executed request you'll get a handy curl command-line (ideal for reuse in home-automation scripts).

Examples

A few example (shell-)scripts can be found here: ๐Ÿงฐ

License

Please read the LICENSE file.

pixoo-rest's People

Contributors

4ch1m avatar

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.