update api docs

This commit is contained in:
2018-09-23 15:05:41 +02:00
parent 8ec41cadc6
commit 8b26e8044b

View File

@@ -2,37 +2,43 @@
This is the brain of the the almighty [Illumination Cat](https://www.thingiverse.com/thing:2974862). This is the brain of the the almighty [Illumination Cat](https://www.thingiverse.com/thing:2974862).
## API ## API
### WebSocket Two API architectures are supported: WebSocket and REST.
Endpoint: /pixel Both can be used with the same set of fields.
Everything is propagated to the mesh network automatically.
Fields: Fields:
|Field|Type|Description| | Field | Type | Description |
| --- |---| ---| | ------- | ------- | -----------------------------------------------|
| topic | String | Defines which functionality is executed, usually to set a value or activate a pattern | | topic | String | Name of the topic where the data is dispatched |
| payload | String | data to be set | | payload | Integer/String | Data |
### WebSocket
Endpoint: /pixel
Send a JSON String containing the mandatory fields.
Example: Example:
``` json ``` json
{ {
"topic": "pixels/color", "topic": "pixels/color",
"payload": "13505813" "payload": 13505813
} }
``` ```
#### Topics #### Topics
| Topic | Data | All functionality can be used by sending messages to these topics.
| ----- | ---- |
| pixels/color | | | topic | type | payload |
| pixels/color2 | | | ----- | ---- | ---- |
| pixels/pattern | | | pixels/colorWheel | Integer | Value from 0 to 255 to cycle through all colors |
| pixels/totalSteps | | | pixels/color | Integer | RGB color as integer. By calling this topic, all LEDs of the strip are set synchronously, stopping current running animation. |
| pixels/brightness | | | pixels/color2 | Integer |RGB color as integer. Sets the second color used in animations. Does not stop current running animation. |
| pixels/pattern | Integer | Value from 0 to 5 to set the current animation. Available animations: { NONE = 0, RAINBOW_CYCLE = 1, THEATER_CHASE = 2, COLOR_WIPE = 3, SCANNER = 4, FADE = 5 } |
| pixels/totalSteps | Integer | Number of steps of an animation. |
| pixels/brightness | Integer | Integer from 0 to 255 to set the overall brightness of the strip by bitshifting the current colors in memory. Use with caution as running the LEDs on full brightness requires a lot of power. |
### REST ### REST
#### Endpoints #### Endpoints
POST /pixel/state Content-Type: application/x-www-form-urlencoded
POST /config POST /pixel/api
### Mesh
## Features ## Features
- Enduser setup: initial setup where the cat opens an access point for configuration - Enduser setup: initial setup where the cat opens an access point for configuration
@@ -40,4 +46,3 @@ POST /config
- Web controls: colors and patterns can be changed through the web interface - Web controls: colors and patterns can be changed through the web interface
- OTA plugin: cats connected to an AP can be updated over-the-air via TCP flash method - OTA plugin: cats connected to an AP can be updated over-the-air via TCP flash method
- [0%] audio output - [0%] audio output
- [0%] OctoPrint plugin: connect to an OctoPrint instance and reflect print status via colors