Skip to content
OBEGRÄNSAD LED

HTTP API

The web server runs on port 80 and is part of builds with ENABLE_SERVER. All endpoints are under /api. Replace <device-ip> with the address of your device.

There is no authentication. Only use the device in a network you trust.

Conventions

  • Parameters are query parameters unless an endpoint expects a body.
  • CORS allows every origin (Access-Control-Allow-Origin: *).
  • Most write endpoints answer with:
{ "status": "success", "message": "Plugin set successfully" }
  • Errors use an HTTP status code 400, 404, 422 or 500 and this body:
{ "error": true, "message": "Could not set plugin to id 99" }

Overview

MethodPathDescription
GET/api/infoDevice state, plugins and schedule.
GET/api/dataCurrent frame as 256 bytes.
PATCH/api/pluginSet the active plugin.
PATCH/api/brightnessSet the base brightness.
PATCH/api/powerTurn the display on or off.
PUT/api/brightness-scheduleConfigure scheduled brightness.
GET/api/messageShow a message.
GET/api/removemessageRemove a message.
POST/api/scheduleSet and start the plugin schedule.
GET/api/schedule/startStart the plugin schedule.
GET/api/schedule/stopStop the plugin schedule.
GET/api/schedule/clearDelete the plugin schedule.
GET/api/configRead the configuration.
POST/api/configChange the configuration.
POST/api/config/resetReset the configuration.
GET/api/storage/clearErase all stored data.

Device info

GET /api/info

curl "http://<device-ip>/api/info"
{
  "rows": 16,
  "cols": 16,
  "status": 0,
  "plugin": 34,
  "rotation": 0,
  "power": true,
  "baseBrightness": 255,
  "brightness": 255,
  "brightnessSchedule": {
    "enabled": false,
    "startTime": "22:00",
    "endTime": "07:00",
    "brightness": 20,
    "active": false
  },
  "mqttConnected": true,
  "scheduleActive": false,
  "rssi": -58,
  "uptime": 3600,
  "freeHeap": 180000,
  "ipAddress": "192.168.1.50",
  "macAddress": "AA:BB:CC:A1:B2:C3",
  "resetReason": "poweron",
  "schedule": [{ "pluginId": 34, "duration": 60 }],
  "plugins": [{ "id": 1, "name": "Draw" }]
}
FieldDescription
status0 normal, 2 firmware update, 3 loading. 1 (binary stream) is reserved and not used.
pluginID of the active plugin, -1 if none.
rotation0–3, in steps of 90° clockwise.
powerfalse while the display is turned off.
baseBrightnessSaved brightness, 0–255.
brightnessBrightness shown right now. Differs from baseBrightness while scheduled brightness is active.
brightnessScheduleSee Brightness. active is true inside the window.
mqttConnectedOnly in builds with ENABLE_MQTT.
scheduleActivetrue while the plugin schedule runs.
schedulePlugin schedule, duration in seconds.
uptimeSeconds since boot.
resetReasonOn ESP32: poweron, external, software, panic, int_wdt, task_wdt, wdt, deepsleep, brownout, sdio or unknown. On ESP8266 the text of the SDK.
pluginsAll plugins with ID and name.

Current frame

GET /api/data returns the frame buffer as application/octet-stream: 256 bytes, one brightness value (0–255) per pixel, row by row.

curl -s "http://<device-ip>/api/data" | xxd | head

Set the active plugin

PATCH /api/plugin?id=<id>

curl -X PATCH "http://<device-ip>/api/plugin?id=34"

An unknown ID returns 422 with Could not set plugin to id <id>. See Plugins for the IDs, or read them from GET /api/info.

Set brightness

PATCH /api/brightness?value=<0-255>

curl -X PATCH "http://<device-ip>/api/brightness?value=100"

Values outside 0–255 return 422. A missing value counts as 0. The value is saved on ESP32.

Power

PATCH /api/power?state=<on|off|toggle>

curl -X PATCH "http://<device-ip>/api/power?state=off"

The response message is Display on or Display off. Any other state returns 422 with state must be on, off or toggle. See Brightness and power.

Brightness schedule

PUT /api/brightness-schedule with a JSON body. All four fields are required.

curl -X PUT "http://<device-ip>/api/brightness-schedule" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"startTime":"22:00","endTime":"07:00","brightness":20}'

On success the response contains the new state:

{
  "baseBrightness": 255,
  "brightness": 20,
  "brightnessSchedule": {
    "enabled": true,
    "startTime": "22:00",
    "endTime": "07:00",
    "brightness": 20,
    "active": true
  }
}
StatusMessage
400Invalid JSON payload
422Invalid scheduled brightness configuration
422Start and end times must differ

Messages

GET /api/message with the query parameters from Messages. graph is a comma-separated list, for example 1,4,9,4.

curl "http://<device-ip>/api/message?text=Hello&repeat=2&id=1"

GET /api/removemessage?id=<id> removes a message.

StatusMessage
422maxy must be >= miny and the range must fit an int
422graph must be a comma-separated list of integers

See Messages for how messages are shown.

Plugin schedule

POST /api/schedule with the form field schedule, a JSON array of pluginId and duration in seconds. The schedule starts immediately.

curl -X POST "http://<device-ip>/api/schedule" \
  --data-urlencode 'schedule=[{"pluginId":34,"duration":60},{"pluginId":37,"duration":30}]'

An invalid schedule returns 400 with Schedule cannot be set.

EndpointSuccessError
GET /api/schedule/startSchedule started404 No schedule found
GET /api/schedule/stopSchedule stopped404 No schedule found
GET /api/schedule/clearSchedule cleared

See Plugin scheduler.

Configuration

GET /api/config, POST /api/config and POST /api/config/reset. See Configuration.

Clear storage

GET /api/storage/clear erases the saved display state: brightness, rotation, default plugin, plugin schedule, scheduled brightness and the saved drawing. The configuration and the Wi-Fi credentials are not affected. Use POST /api/config/reset for the configuration.

curl "http://<device-ip>/api/storage/clear"

Firmware update

/update serves the OTA update page. See OTA updates.