You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -153,7 +153,6 @@ Connect them like this and remember to set them in `include/constants.h` accordi
153
153
### Alternate Button Wiring
154
154
155
155
Thanks to [RBEGamer](https://github.com/RBEGamer) who is showing in this [issue](https://github.com/ph1p/ikea-led-obegraensad/issues/79) how to use the original button wiring. With this solution you won't need the "BUTTON one end" and "BUTTON other end" soldering from the table above.
156
-
157
156
# HTTP API Endpoints
158
157
159
158
## Get Information
@@ -164,15 +163,55 @@ Get current values and the (fixed) metadata, like number of rows and columns and
164
163
GET http://your-server/api/info
165
164
```
166
165
166
+
### Example `curl` Command:
167
+
168
+
```bash
169
+
curl http://your-server/api/info
170
+
```
171
+
172
+
### Response
173
+
174
+
```json
175
+
{
176
+
"rows": 16,
177
+
"cols": 16,
178
+
"status": "active",
179
+
"plugin": 3,
180
+
"rotation": 90,
181
+
"brightness": 255,
182
+
"scheduleActive": true,
183
+
"schedule": [
184
+
{
185
+
"pluginId": 2,
186
+
"duration": 60
187
+
},
188
+
{
189
+
"pluginId": 4,
190
+
"duration": 120
191
+
}
192
+
],
193
+
"plugins": [
194
+
{"id": 1, "name": "Plugin One"},
195
+
{"id": 2, "name": "Plugin Two"},
196
+
{"id": 3, "name": "Plugin Three"}
197
+
]
198
+
}
199
+
```
200
+
201
+
---
202
+
167
203
## Set Active Plugin by ID
168
204
169
205
To set an active plugin by ID, make an HTTP PATCH request to the following endpoint, passing the parameter as a query string:
170
206
171
207
```
172
208
PATCH http://your-server/api/plugin
173
209
```
174
-
```
175
-
e.g. curl -X PATCH "http://your-server/api/plugin?id=7"
e.g. curl -X PATCH "http://your-server/api/brightness?value=100"
196
-
```
256
+
197
257
### Parameters
198
258
199
259
-`value` (required): The brightness value (0..255).
200
260
201
261
### Response
202
262
203
-
- Success: `200 OK` with the message "Ok".
204
-
- Invalid Value: `404 Not Found` with the message "Invalid Brightness Value".
263
+
-**Success:**
264
+
265
+
```json
266
+
{
267
+
"status": "success",
268
+
"message": "Brightness set successfully"
269
+
}
270
+
```
271
+
272
+
-**Error (Invalid Brightness Value):**
205
273
206
-
## Get current display data
274
+
```json
275
+
{
276
+
"error": true,
277
+
"errormessage": "Invalid brightness value: 300 - must be between 0 and 255."
278
+
}
279
+
```
280
+
281
+
---
207
282
208
-
To get the current displayed data as an byte-array, each byte representing the brightness value.
209
-
Be aware that the global brightness value gets applied AFTER these values, so if you set the global brightness to 16, you will still get values of 255 this way.
283
+
## Get Current Display Data
284
+
285
+
To get the current displayed data as a byte-array, each byte representing the brightness value. Be aware that the global brightness value gets applied AFTER these values.
210
286
211
287
```
212
288
GET http://your-server/api/data
213
289
```
214
290
291
+
#### Example `curl` Command:
292
+
293
+
```bash
294
+
curl http://your-server/api/data
295
+
```
296
+
297
+
### Response (Raw Byte-Array Example)
298
+
299
+
```json
300
+
[255, 255, 255, 0, 128, 255, 255, 0, ...]
301
+
```
302
+
303
+
---
304
+
215
305
# Plugin Scheduler
216
306
217
-
It is possible to switch between plugins automatically.
307
+
It is possible to switch between plugins automatically.
218
308
You can define your schedule in the Web UI or just send an API call.
219
309
310
+
### Set Schedule
311
+
312
+
To define a schedule for switching between plugins automatically, make a POST request with your schedule data:
313
+
220
314
```bash
221
-
### set your plugins and duration in seconds
222
-
curl -X POST http://x.x.x.x/api/schedule -d 'schedule=[{"pluginId":10,"duration":2},{"pluginId":8,"duration": 5}'
315
+
curl -X POST http://your-server/api/schedule -d 'schedule=[{"pluginId":10,"duration":2},{"pluginId":8,"duration":5}]'
316
+
```
223
317
224
-
### clear the schedule
225
-
curl http://x.x.x.x/api/schedule/clear
318
+
#### Example Response
319
+
320
+
```json
321
+
{
322
+
"status": "success",
323
+
"message": "Schedule updated"
324
+
}
325
+
```
226
326
227
-
### start the schedule
228
-
curl http://x.x.x.x/api/schedule/start
327
+
### Clear Schedule
229
328
230
-
### stop the schedule
231
-
curl http://x.x.x.x/api/schedule/stop
329
+
To clear the existing schedule, make a GET request:
330
+
331
+
```bash
332
+
curl http://your-server/api/schedule/clear
232
333
```
233
334
234
-
# DDP (Distributed Display Protocol)
335
+
#### Example Response
336
+
337
+
```json
338
+
{
339
+
"status": "success",
340
+
"message": "Schedule cleared"
341
+
}
342
+
```
343
+
344
+
### Start Schedule
345
+
346
+
To start the current schedule, make a GET request:
235
347
236
-
You can set the panel to DDP using the button or via the web interface.
237
-
This Protocol uses **UDP** and listens on Port **4048**.
348
+
```bash
349
+
curl http://your-server/api/schedule/start
350
+
```
238
351
239
-
**Info**: The DDP Header is 10 Bytes!
352
+
#### Example Response
240
353
241
-
In the repository you will find an `ddp.py` as an example.
354
+
```json
355
+
{
356
+
"status": "success",
357
+
"message": "Schedule started"
358
+
}
359
+
```
242
360
243
-
Change the plugin to `DDP` and run following command with your IP:
The LED Display service provides HTTP API to display messages and graphs on a 16x16 LED display. This functionality can be accessed through HTTP calls to the service endpoint.
382
+
To retrieve the current display data as a byte-array, each byte representing the brightness value. The global brightness is applied after these values.
383
+
384
+
```
385
+
GET http://your-server/api/data
386
+
```
387
+
388
+
#### Example `curl` Command:
389
+
390
+
```bash
391
+
curl http://your-server/api/data
392
+
```
393
+
394
+
### Response (Raw Byte-Array Example)
395
+
396
+
```json
397
+
[255, 255, 255, 0, 128, 255, 255, 0, ...]
398
+
```
399
+
400
+
---
259
401
260
402
## Message Display
261
403
262
404
To display a message on the LED display, users can make an HTTP GET request to the following endpoint:
263
405
264
406
```
265
-
http://your-server/api/message
407
+
GET http://your-server/api/message
266
408
```
267
409
268
410
### Parameters
269
411
270
412
-`text` (optional): The text message to be displayed on the LED display.
271
-
-`graph` (optional): A comma-separated list of integers representing a graph. The values should be in the range of 0 to 15 and will be visualized as a graph on the LED display.
272
-
-`miny` (optional): scaling for lower end of the graph, defaults to 0
273
-
-`maxy` (optional): scaling for upper end of the graph, defaults to 15
274
-
-`repeat` (optional): The number of times the message should be repeated. If not provided, the default is 1. Set this value to -1 to repeat infinitely. While messages ar pending for display an indicator led in the upper left corner will flash.
275
-
-`id` (optional): A unique identifier for the message. This can be used for later removal or modification of the message.
276
-
-`delay` (optional): The number of ms of delay between every scroll move. Default is 50 ms.
413
+
-`graph` (optional): A comma-separated list of integers representing a graph (0-15).
414
+
-`miny` (optional): Scaling for the lower end of the graph, defaults to 0.
415
+
-`maxy` (optional): Scaling for the upper end of the graph, defaults to 15.
416
+
-`repeat` (optional): Number of times the message should be repeated. Default is 1. Set to `-1`for infinite.
417
+
-`id` (optional): A unique identifier for the message.
418
+
-`delay` (optional): Delay in ms between every scroll movement. Default is 50ms.
GET http://your-server/api/message?text=Hello&graph=8,5,2,1,0,0,1,4,7,10,13,14,15,15,14,11&repeat=3&id=1&delay=60
425
+
426
+
### Response
427
+
428
+
```json
429
+
{
430
+
"status": "success",
431
+
"message": "Message received"
432
+
}
282
433
```
283
434
284
-
This example will display the message "Hello" on the LED display with a corresponding graph, repeat it three times, and assign it the identifier 1, waits 60ms while scrolling.
435
+
---
285
436
286
-
###Message Removal
437
+
## Message Removal
287
438
288
439
To remove a message from the display, users can make an HTTP GET request to the following endpoint:
289
440
290
441
```
291
-
http://your-server/api/removemessage
442
+
GET http://your-server/api/removemessage
292
443
```
293
444
294
445
### Parameters
295
446
296
447
-`id` (required): The unique identifier of the message to be removed.
297
448
298
-
#### Example
449
+
#### Example `curl` Command:
450
+
451
+
```bash
452
+
curl "http://your-server/api/removemessage?id=1"
453
+
```
454
+
455
+
### Response
456
+
457
+
```json
458
+
{
459
+
"status": "success",
460
+
"message": "Message removed"
461
+
}
462
+
```
463
+
464
+
---
465
+
466
+
## Clear Storage
467
+
468
+
To clear the data storage:
299
469
300
470
```
301
-
GET http://your-server/api/removemessage?id=1
471
+
GET http://your-server/api/clearstorage
302
472
```
303
473
304
-
This example will remove the message with the identifier 1 from the LED display.
0 commit comments