Compare commits
6 Commits
cb5a762c2f
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f64ceeb477 | |||
| 4efb3ad581 | |||
| 60d179cf4a | |||
| f2da89b184 | |||
| b0903c7610 | |||
| 1a3bec9e85 |
+63
-9
@@ -165,7 +165,7 @@ class LedController:
|
|||||||
async def stop(self):
|
async def stop(self):
|
||||||
await self.sendCommand({"type": "off"})
|
await self.sendCommand({"type": "off"})
|
||||||
|
|
||||||
def get_state(self):
|
def getStatus(self):
|
||||||
if self.blinking and self.blinkDuration > 0:
|
if self.blinking and self.blinkDuration > 0:
|
||||||
elapsed = time.ticks_diff(time.ticks_ms(), self.blinkStart) / 1000
|
elapsed = time.ticks_diff(time.ticks_ms(), self.blinkStart) / 1000
|
||||||
remains = max(0.0, self.blinkDuration - elapsed)
|
remains = max(0.0, self.blinkDuration - elapsed)
|
||||||
@@ -258,7 +258,16 @@ async def setColor(request):
|
|||||||
await led.set_color((r, g, b), brightness)
|
await led.set_color((r, g, b), brightness)
|
||||||
status = await led.get_status()
|
status = await led.get_status()
|
||||||
|
|
||||||
return {'status': status}
|
state = led.getStatus()
|
||||||
|
return {'status': state["status"],
|
||||||
|
'color': state["color"],
|
||||||
|
'brightness': state["brightness"],
|
||||||
|
'isblinking': state["isblinking"],
|
||||||
|
'blinkParameters': {
|
||||||
|
'frequency': state["frequency"],
|
||||||
|
'duration': state["duration"],
|
||||||
|
'remains': state["remains"]}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@app.get('/api/color')
|
@app.get('/api/color')
|
||||||
@@ -270,7 +279,16 @@ async def getColor(request):
|
|||||||
@app.get('/api/status')
|
@app.get('/api/status')
|
||||||
async def getStatus(request):
|
async def getStatus(request):
|
||||||
status = await led.get_status()
|
status = await led.get_status()
|
||||||
return {'status': status}
|
state = led.getStatus()
|
||||||
|
return {'status': state["status"],
|
||||||
|
'color': state["color"],
|
||||||
|
'brightness': state["brightness"],
|
||||||
|
'isblinking': state["isblinking"],
|
||||||
|
'blinkParameters': {
|
||||||
|
'frequency': state["frequency"],
|
||||||
|
'duration': state["duration"],
|
||||||
|
'remains': state["remains"]}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@app.route('/api/status/<status>', methods=['GET', 'POST'])
|
@app.route('/api/status/<status>', methods=['GET', 'POST'])
|
||||||
@@ -281,7 +299,16 @@ async def setStatus(request, status):
|
|||||||
return {'error': 'unknown status'}, 404
|
return {'error': 'unknown status'}, 404
|
||||||
|
|
||||||
status = await led.get_status()
|
status = await led.get_status()
|
||||||
return {'status': status}
|
state = led.getStatus()
|
||||||
|
return {'status': state["status"],
|
||||||
|
'color': state["color"],
|
||||||
|
'brightness': state["brightness"],
|
||||||
|
'isblinking': state["isblinking"],
|
||||||
|
'blinkParameters': {
|
||||||
|
'frequency': state["frequency"],
|
||||||
|
'duration': state["duration"],
|
||||||
|
'remains': state["remains"]}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@app.post('/api/blink')
|
@app.post('/api/blink')
|
||||||
@@ -300,12 +327,21 @@ async def setBlink(request):
|
|||||||
|
|
||||||
await led.blink(freq, duration)
|
await led.blink(freq, duration)
|
||||||
|
|
||||||
return {'status': 'blinking', 'frequency': freq, 'duration': duration}
|
state = led.getStatus()
|
||||||
|
return {'status': state["status"],
|
||||||
|
'color': state["color"],
|
||||||
|
'brightness': state["brightness"],
|
||||||
|
'isblinking': state["isblinking"],
|
||||||
|
'blinkParameters': {
|
||||||
|
'frequency': state["frequency"],
|
||||||
|
'duration': state["duration"],
|
||||||
|
'remains': state["remains"]}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@app.get('/api/blink')
|
@app.get('/api/blink')
|
||||||
async def getBlink(request):
|
async def getBlinkStatus(request):
|
||||||
state = led.get_state()
|
state = led.getStatus()
|
||||||
return {
|
return {
|
||||||
'isblinking': state["isblinking"],
|
'isblinking': state["isblinking"],
|
||||||
'frequency': state["frequency"],
|
'frequency': state["frequency"],
|
||||||
@@ -319,7 +355,16 @@ async def blinkStop(request):
|
|||||||
await led.stop()
|
await led.stop()
|
||||||
await led.set_status(led.previousStatus)
|
await led.set_status(led.previousStatus)
|
||||||
status = await led.get_status()
|
status = await led.get_status()
|
||||||
return {'status': status}
|
state = led.getStatus()
|
||||||
|
return {'status': state["status"],
|
||||||
|
'color': state["color"],
|
||||||
|
'brightness': state["brightness"],
|
||||||
|
'isblinking': state["isblinking"],
|
||||||
|
'blinkParameters': {
|
||||||
|
'frequency': state["frequency"],
|
||||||
|
'duration': state["duration"],
|
||||||
|
'remains': state["remains"]}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@app.get('/api/debug')
|
@app.get('/api/debug')
|
||||||
@@ -352,7 +397,16 @@ async def mutedeckWebhook(request):
|
|||||||
else:
|
else:
|
||||||
await led.set_status('available')
|
await led.set_status('available')
|
||||||
|
|
||||||
return {'status': led.status}
|
state = led.getStatus()
|
||||||
|
return {'status': state["status"],
|
||||||
|
'color': state["color"],
|
||||||
|
'brightness': state["brightness"],
|
||||||
|
'isblinking': state["isblinking"],
|
||||||
|
'blinkParameters': {
|
||||||
|
'frequency': state["frequency"],
|
||||||
|
'duration': state["duration"],
|
||||||
|
'remains': state["remains"]}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@app.post('/shutdown')
|
@app.post('/shutdown')
|
||||||
|
|||||||
@@ -20,9 +20,13 @@ A cheap, simple to build, nice looking and portable DIY **Busy Light**.
|
|||||||
|
|
||||||
It comes with a with a simplistic but neat **Web UI** and a simple (but hopefully convenient) **Rest API**.
|
It comes with a with a simplistic but neat **Web UI** and a simple (but hopefully convenient) **Rest API**.
|
||||||
|
|
||||||
| Controlled by Stream Deck with REST API | Light roll |
|
| Controlled by Stream Deck with REST API | Light roll |
|
||||||
| --- | --- |
|
| ------------------------------------------------------------- | ------------------------------------------------- |
|
||||||
|  |  |
|
|  |  |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
# Web UI
|
# Web UI
|
||||||
|
|
||||||
@@ -39,10 +43,12 @@ You can try to reach the web UI @ <http://igox-busylight.local>.
|
|||||||
|
|
||||||
[BusyLight Buddy](https://code.igox.org/iGoX/busylight-buddy) is a free, open-source multiplatform companion app to control your BusyLight from your phone or computer — no browser needed.
|
[BusyLight Buddy](https://code.igox.org/iGoX/busylight-buddy) is a free, open-source multiplatform companion app to control your BusyLight from your phone or computer — no browser needed.
|
||||||
|
|
||||||
Available for **iOS**, **iPadOS**, **Android**, **macOS**, and **Windows**.
|
Available for **Android**, **macOS** and **Windows**.
|
||||||
|
|
||||||
It features quick status presets, a custom color picker with saveable presets, a brightness slider, and background polling to keep the UI in sync with the device.
|
It features quick status presets, a custom color picker with saveable presets, a brightness slider, and background polling to keep the UI in sync with the device.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
# Stream Deck plug-in
|
# Stream Deck plug-in
|
||||||
|
|
||||||
You can download the Stream Deck plugin to control your BusyLight:
|
You can download the Stream Deck plugin to control your BusyLight:
|
||||||
@@ -67,8 +73,8 @@ Or directly from **[busyLight-streamdeck-pluing](https://code.igox.org/iGoX/busy
|
|||||||
| /api/status/busy | POST / GET | n/a | Set the BusyLight in `busy` mode. Red color. Return a `status` object. |
|
| /api/status/busy | POST / GET | n/a | Set the BusyLight in `busy` mode. Red color. Return a `status` object. |
|
||||||
| /api/status/off | POST / GET | n/a | Shutdown the BusyLight. Return a `status` object. |
|
| /api/status/off | POST / GET | n/a | Shutdown the BusyLight. Return a `status` object. |
|
||||||
| /api/status | GET | n/a | Retreive the current BusyLight status. Return a `status` object. |
|
| /api/status | GET | n/a | Retreive the current BusyLight status. Return a `status` object. |
|
||||||
| /api/blink | POST | `blink` JSON object | Make the BusyLight blink. Preserves current color, status and brightness. Return a `status` object. |
|
| /api/blink | POST | `blinkParam` JSON object | Make the BusyLight blink. Preserves current color, status and brightness. Return a `status` object. |
|
||||||
| /api/blink | GET | n/a | Retrieve the current BusyLight blink status. Return a `blink` object. |
|
| /api/blink | GET | n/a | Retrieve the current BusyLight blink status. Return a `blinkStatus` object. |
|
||||||
| /api/blink/stop | POST | n/a | Stop the BusyLight blinking and restore previous state. Return a `status` object. |
|
| /api/blink/stop | POST | n/a | Stop the BusyLight blinking and restore previous state. Return a `status` object. |
|
||||||
| /api/debug | GET | n/a | Retreive the full BusyLight status. |
|
| /api/debug | GET | n/a | Retreive the full BusyLight status. |
|
||||||
|
|
||||||
@@ -100,7 +106,19 @@ Or directly from **[busyLight-streamdeck-pluing](https://code.igox.org/iGoX/busy
|
|||||||
|
|
||||||
`brightness`: LED brightness | float | [0.0 .. 1.0]
|
`brightness`: LED brightness | float | [0.0 .. 1.0]
|
||||||
|
|
||||||
### `blink` object
|
### `blinkParam` object
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"frequency": 2,
|
||||||
|
"duration": 5.0,
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
`frequency`: blink frequency | integer | Hz
|
||||||
|
`duration`: total blink duration | float | seconds | 0 = endless
|
||||||
|
|
||||||
|
### `blinkStatus` object
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -120,11 +138,37 @@ Or directly from **[busyLight-streamdeck-pluing](https://code.igox.org/iGoX/busy
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"status": "<STATUS>"
|
"status": "<STATUS>",
|
||||||
|
"color": {
|
||||||
|
"r": 255,
|
||||||
|
"g": 0,
|
||||||
|
"b": 110
|
||||||
|
},
|
||||||
|
"brightness": 0.1
|
||||||
|
"isBlinkning": false,
|
||||||
|
"blinkParameters": {
|
||||||
|
"frequency": 2,
|
||||||
|
"duration": 5.0,
|
||||||
|
"remains": 3.2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
`<STATUS>` : `on` | `off` | `available` | `away` | `busy` | `colored` | `blinking`
|
`<STATUS>` : `on` | `off` | `available` | `away` | `busy` | `colored`
|
||||||
|
|
||||||
|
`color`:
|
||||||
|
- `r`: RED color | integer | [0 .. 255]
|
||||||
|
- `g`: GREEN color | integer | [0 .. 255]
|
||||||
|
- `b`: BLUE color | integer | [0 .. 255]
|
||||||
|
|
||||||
|
`brightness`: LED brightness (optional) | float | [0.0 .. 1.0]
|
||||||
|
|
||||||
|
`isblinking`: whether the BusyLight is currently blinking | boolean
|
||||||
|
|
||||||
|
`blinkParameters`
|
||||||
|
- `frequency`: blink frequency | integer | Hz
|
||||||
|
- `duration`: total blink duration | float | seconds | 0 = endless
|
||||||
|
- `remains`: remaining blink time | float | seconds | 0 if endless
|
||||||
|
|
||||||
# MuteDeck integration
|
# MuteDeck integration
|
||||||
|
|
||||||
@@ -194,7 +238,7 @@ You can see a final assembly image [here](3D-files-to-print/README.md).
|
|||||||
|
|
||||||
## Microdot
|
## Microdot
|
||||||
|
|
||||||
<https://microdot.readthedocs.io/en/latest/index.html>
|
<https://microdot.readthedocs.io>
|
||||||
|
|
||||||
## JSColor
|
## JSColor
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Reference in New Issue
Block a user