Compare commits
16 commits
igox/blink
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77d4ea3019 | ||
|
|
370eb78ba7 | ||
|
|
df196c4f6e | ||
|
|
3a6e753fd4 | ||
|
|
62c8ba4ad4 | ||
|
|
c4aa9d9871 | ||
|
|
cef62a3c4d | ||
|
|
995082abdf | ||
|
|
8a3124294e | ||
|
|
91e1a6bfe4 | ||
|
|
9c27320ed8 | ||
|
|
081ea28b82 | ||
|
|
a8855f8e4e | ||
|
|
67de2231bd | ||
|
|
b1bbabe90e | ||
|
|
3650a5213e |
144
ESP32/main.py
|
|
@ -1,6 +1,5 @@
|
|||
from microdot import Microdot, send_file
|
||||
import machine, sys, neopixel, time
|
||||
import asyncio
|
||||
|
||||
app = Microdot()
|
||||
|
||||
|
|
@ -9,65 +8,46 @@ nbPixels = 12*2
|
|||
pinPixelStrip = 16 # ESP32 D1 Mini
|
||||
neoPixelStrip = neopixel.NeoPixel(machine.Pin(pinPixelStrip), nbPixels)
|
||||
|
||||
# Define BusyLight status
|
||||
statusDef = {
|
||||
'off': {'name': 'off', 'code': 0, 'color': (0, 0, 0)}, # OFF
|
||||
'on': {'name': 'on', 'code': 1, 'color': (255, 255, 255)}, # White
|
||||
'busy': {'name': 'busy', 'code': 2, 'color': (255, 0, 0)}, # Red
|
||||
'available': {'name': 'available', 'code': 3, 'color': (0, 255, 0)}, # Green
|
||||
'away': {'name': 'away', 'code': 4, 'color': (246, 190, 0)}, # Yellow
|
||||
'blinking': {'name': 'blinking', 'code': 5}, # No defined color
|
||||
'colored': {'name': 'colored', 'code': 6} # No defined color
|
||||
}
|
||||
# Define status colors
|
||||
statusColors = {
|
||||
'BUSY': (255,0,0), # red
|
||||
'AVAILABLE': (0,255,0), # green
|
||||
'AWAY': (246,190,0), # cyan
|
||||
'OFF': (0, 0, 0), # off
|
||||
'ON': (255, 255, 255) # white
|
||||
}
|
||||
|
||||
# Store BusyLight default global status
|
||||
blColor = statusDef.get('off').get('color')
|
||||
blPreviousColor = statusDef.get('off').get('color')
|
||||
blStatus = statusDef.get('off')
|
||||
blPreviousStatus = statusDef.get('off')
|
||||
blColor = statusColors.get('OFF')
|
||||
blStatus = 'off'
|
||||
blPreviousStatus='off'
|
||||
blBrightness = 0.1 # Adjust the brightness (0.0 - 1.0)
|
||||
blBlinkingTask = None
|
||||
|
||||
def __setDimmedColor(color):
|
||||
def __setColor(color):
|
||||
r, g , b = color
|
||||
r = int(r * blBrightness)
|
||||
g = int(g * blBrightness)
|
||||
b = int(b * blBrightness)
|
||||
return (r, g, b)
|
||||
|
||||
def __setBusyLightColorAndBrigthness(color, brightness):
|
||||
def __setBusyLightColor(color, brightness):
|
||||
global blBrightness
|
||||
blBrightness = brightness
|
||||
|
||||
global blColor
|
||||
blColor = color
|
||||
dimmedColor = __setDimmedColor(color)
|
||||
|
||||
neoPixelStrip.fill(dimmedColor)
|
||||
neoPixelStrip.fill(__setColor(color))
|
||||
neoPixelStrip.write()
|
||||
|
||||
def __setBusyLightColored(color, brightness):
|
||||
__setBusyLightColorAndBrigthness(color, brightness)
|
||||
global blStatus
|
||||
blStatus = statusDef.get('colored')
|
||||
blStatus = 'colored'
|
||||
|
||||
def __setBusyLightStatus(status = statusDef.get('off')):
|
||||
if status == statusDef.get('colored'):
|
||||
lColor = blColor
|
||||
else:
|
||||
lColor = status.get('color')
|
||||
__setBusyLightColorAndBrigthness(lColor, blBrightness)
|
||||
def __setBusyLightStatus(status):
|
||||
status = status.upper()
|
||||
color = statusColors.get(status)
|
||||
__setBusyLightColor(color, blBrightness)
|
||||
|
||||
global blStatus
|
||||
blStatus = status
|
||||
|
||||
def __setBusyLightBlinking(time_ms=500):
|
||||
return 0
|
||||
|
||||
def __setBusyLightStill():
|
||||
return 0
|
||||
|
||||
|
||||
blStatus = status.lower()
|
||||
|
||||
# Microdot APP routes
|
||||
|
||||
|
|
@ -100,8 +80,16 @@ async def setBrightness(request):
|
|||
else:
|
||||
return {'error': 'wrong brigthness type (float)'}, 400
|
||||
|
||||
# Save blStatus
|
||||
global blStatus
|
||||
status = blStatus
|
||||
|
||||
# Apply new brightness to current color
|
||||
__setBusyLightColorAndBrigthness(blColor, brightness)
|
||||
color = blColor
|
||||
__setBusyLightColor(color, brightness)
|
||||
|
||||
# Restore global status
|
||||
blStatus = status
|
||||
|
||||
global blBrightness
|
||||
blBrightness = brightness
|
||||
|
|
@ -133,71 +121,32 @@ async def setColor(request):
|
|||
|
||||
brightness = request.json.get("brightness")
|
||||
|
||||
if not bool(brightness is None):
|
||||
if not brightness is None:
|
||||
if type(brightness) is float \
|
||||
or type(brightness) is int:
|
||||
if brightness < 0 or brightness > 1:
|
||||
return {'error': 'brightness out of bound (0.0 - 1.0)'}, 400
|
||||
else:
|
||||
return {'error': 'wrong brightness type (float)'}, 400
|
||||
__setBusyLightColored(color, brightness)
|
||||
__setBusyLightColor(color, brightness)
|
||||
|
||||
__setBusyLightColored(color, blBrightness)
|
||||
__setBusyLightColor(color, blBrightness)
|
||||
|
||||
return {'status': blStatus}
|
||||
|
||||
@app.post('/api/blink')
|
||||
async def setBlink(request):
|
||||
time_ms = request.json.get("time_ms")
|
||||
blinking = request.json.get("blinking")
|
||||
|
||||
if not bool(time_ms is None):
|
||||
if type(time_ms) is int:
|
||||
if time_ms < 100 or time_ms > 5000:
|
||||
return {'error': 'parameter "time_ms" out of bound (100 - 5000)'}, 400
|
||||
else:
|
||||
return {'error': 'wrong parameter "time_ms" type (int)'}, 400
|
||||
|
||||
if bool(blinking is None):
|
||||
return {'error': 'missing blinking parameter'}, 400
|
||||
else:
|
||||
if type(blinking) is bool:
|
||||
if blinking:
|
||||
if time_ms is None:
|
||||
__setBusyLightBlinking()
|
||||
else:
|
||||
__setBusyLightBlinking(time_ms)
|
||||
else:
|
||||
__setBusyLightStill()
|
||||
else:
|
||||
return {'error': 'wrong blinking type (bool)'}, 400
|
||||
|
||||
return {'status': 'to be implemented'}
|
||||
|
||||
|
||||
@app.route('/api/status/<status>', methods=['GET', 'POST'])
|
||||
async def setStatus(request, status):
|
||||
lStatus = status.lower()
|
||||
if lStatus == 'on':
|
||||
status = statusDef.get('on')
|
||||
__setBusyLightStatus(status)
|
||||
|
||||
__setBusyLightStatus('ON')
|
||||
elif lStatus == 'off':
|
||||
status = statusDef.get('off')
|
||||
__setBusyLightStatus(status)
|
||||
|
||||
__setBusyLightStatus('OFF')
|
||||
elif lStatus == 'available':
|
||||
status = statusDef.get('available')
|
||||
__setBusyLightStatus(status)
|
||||
|
||||
__setBusyLightStatus('AVAILABLE')
|
||||
elif lStatus == 'away':
|
||||
status = statusDef.get('away')
|
||||
__setBusyLightStatus(status)
|
||||
|
||||
__setBusyLightStatus('AWAY')
|
||||
elif lStatus == 'busy':
|
||||
status = statusDef.get('busy')
|
||||
__setBusyLightStatus(status)
|
||||
|
||||
__setBusyLightStatus('BUSY')
|
||||
else:
|
||||
return {'error': 'unknown /api/status/' + lStatus + ' route'}, 404
|
||||
|
||||
|
|
@ -234,11 +183,11 @@ async def mutedeckWebhook(request):
|
|||
isVideoOn = False
|
||||
|
||||
if isMuted:
|
||||
__setBusyLightStatus(statusDef.get('away'))
|
||||
__setBusyLightStatus('away')
|
||||
else:
|
||||
__setBusyLightStatus(statusDef.get('busy'))
|
||||
__setBusyLightStatus('busy')
|
||||
else:
|
||||
__setBusyLightStatus(statusDef.get('available'))
|
||||
__setBusyLightStatus('available')
|
||||
|
||||
return {'status': blStatus}
|
||||
|
||||
|
|
@ -250,17 +199,18 @@ async def shutdown(request):
|
|||
|
||||
# Startup effect
|
||||
def startUpSeq():
|
||||
print('Start seq is started')
|
||||
__setBusyLightStatus(statusDef.get('off'))
|
||||
print('Start seq begins')
|
||||
__setBusyLightStatus('OFF')
|
||||
time.sleep_ms(100)
|
||||
__setBusyLightStatus(statusDef.get('busy'))
|
||||
__setBusyLightStatus('BUSY')
|
||||
time.sleep_ms(200)
|
||||
__setBusyLightStatus(statusDef.get('away'))
|
||||
__setBusyLightStatus('AWAY')
|
||||
time.sleep_ms(300)
|
||||
__setBusyLightStatus(statusDef.get('available'))
|
||||
__setBusyLightStatus('AVAILABLE')
|
||||
time.sleep_ms(500)
|
||||
__setBusyLightStatus(statusDef.get('off'))
|
||||
__setBusyLightStatus('OFF')
|
||||
print('Start seq is ended')
|
||||
__setBusyLightColor(statusColors.get('OFF'), 0.1)
|
||||
|
||||
startUpSeq()
|
||||
|
||||
|
|
|
|||
|
|
@ -4,38 +4,194 @@
|
|||
<title>BusyLight</title>
|
||||
<script src="static/libs/busylight-api.js"></script>
|
||||
<script src="static/libs/jscolor.min.js"></script>
|
||||
<style>
|
||||
/* General Reset */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
background: linear-gradient(135deg, #1a1a2e, #16213e);
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Glassmorphism Container */
|
||||
section {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
padding: 30px;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
||||
width: 90%;
|
||||
max-width: 500px;
|
||||
animation: fadeIn 0.5s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(-20px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 28px;
|
||||
margin-bottom: 30px;
|
||||
color: #ffffff;
|
||||
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
/* Radio Buttons */
|
||||
div {
|
||||
margin: 20px 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 15px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 12px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
div:hover {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
margin-right: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input[type="radio"] {
|
||||
appearance: none;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
border-radius: 50%;
|
||||
border: 3px solid #ffffff;
|
||||
transition: all 0.3s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input[type="radio"]:checked {
|
||||
background: #4CAF50;
|
||||
border-color: #4CAF50;
|
||||
box-shadow: 0 0 10px rgba(76, 175, 80, 0.7);
|
||||
}
|
||||
|
||||
/* Color Picker Button */
|
||||
#colorPicker {
|
||||
background: linear-gradient(135deg, #007bff, #0056b3);
|
||||
border: none;
|
||||
padding: 15px 30px;
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
border-radius: 12px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
|
||||
}
|
||||
|
||||
#colorPicker:hover {
|
||||
background: linear-gradient(135deg, #0056b3, #003d80);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
|
||||
}
|
||||
|
||||
/* Brightness Slider */
|
||||
input[type="range"] {
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
-webkit-appearance: none;
|
||||
background: linear-gradient(135deg, #4CAF50, #45a049);
|
||||
height: 10px;
|
||||
border-radius: 5px;
|
||||
outline: none;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
input[type="range"]::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
background: #ffffff;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
input[type="range"]:hover::-webkit-slider-thumb {
|
||||
transform: scale(1.1);
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 600px) {
|
||||
section {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
input[type="radio"] {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
#colorPicker {
|
||||
padding: 12px 24px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
input[type="range"]::-webkit-slider-thumb {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="initForm()">
|
||||
<h1>Status</h1>
|
||||
<section>
|
||||
|
||||
<h1>BusyLight Status</h1>
|
||||
<div>
|
||||
<input type="radio" name="status" id="off" value="off" onclick="putStatus(this.value)" />
|
||||
<label for="off">OFF</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="radio" name="status" id="busy" value="busy" onclick="putStatus(this.value)" />
|
||||
<label for="busy">Busy</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="radio" name="status" id="available" value="available" onclick="putStatus(this.value)" />
|
||||
<label for="available">Available</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="radio" name="status" id="away" value="away" onclick="putStatus(this.value)" />
|
||||
<label for="away">Away</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="radio" name="status" id="colored" value="colored" onclick="openColorPicker()" />
|
||||
<label for="colored">Colored: </label>
|
||||
<label for="colored">Colored</label>
|
||||
<button id="colorPicker">Pick color</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="range" id="brightness" name="brightness" min="0" max="100" step="1" onchange="putBrightness(this.value)"/>
|
||||
<label for="brightness">Brightness</label>
|
||||
|
|
@ -48,7 +204,6 @@
|
|||
alphaChannel: false
|
||||
};
|
||||
|
||||
//var colorPicker = new JSColor("colorPicker", "{preset:'default', onChange: 'putColor(this)'}")
|
||||
var colorPickerOpts = {};
|
||||
colorPickerOpts["preset"] = "rgb";
|
||||
colorPickerOpts["format"] = "rgb";
|
||||
|
|
@ -102,7 +257,6 @@
|
|||
statusRadio.checked = true;
|
||||
}
|
||||
|
||||
|
||||
async function putStatus(status) {
|
||||
var s = await setStatus(status);
|
||||
setColorPickerColor(status);
|
||||
|
|
@ -131,6 +285,5 @@
|
|||
var b = await setBrightness(brightness);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
19
README.md
|
|
@ -16,28 +16,33 @@
|
|||
|
||||
**Let people know if they can bother you with light signals!**
|
||||
|
||||
A simple to build, nice looking, portable DIY **Busy Light**.
|
||||
A cheap, simple to build, nice looking and portable DIY **Busy Light**.
|
||||
|
||||
It comes with a with a rudimentary (and ugly) **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 |
|
||||
|-------------------------------------------------|---------------------------------------|
|
||||
|  |  |
|
||||
|
||||

|
||||
|
||||
# Web UI
|
||||
A very simplistic (and ugly) UI is available on port `80`. \
|
||||
A very simplistic but neat UI is available on port `80` (thanks @nicolaeser). \
|
||||
Default hostname is `igox-busylight`.
|
||||
|
||||
You can try to reach the web UI @ `http://igox-busylight.local`.
|
||||
You can try to reach the web UI @ [http://igox-busylight.local](http://igox-busylight.local).
|
||||
|
||||
| What an ugly UI ! :smile: |
|
||||
| What an neat UI ! :smile: |
|
||||
|---------------------------|
|
||||
|  |
|
||||
|
||||
# Stream Deck plug-in
|
||||
You can download a Stream Deck plugin to control your BusyLight [here](streamdeck-plugin/README.md).
|
||||
You can download a Stream Deck plugin to control your BusyLight:
|
||||
|
||||
I will (hopefully) publish it to the [Elgato Market Place](https://marketplace.elgato.com/stream-deck/plugins) soon.
|
||||
[](https://marketplace.elgato.com/product/igox-busylight-7448a0be-6dd6-4711-ba0d-86c52b9075b9)
|
||||
|
||||
|
||||
Or directly from [here](streamdeck-plugin/README.md).
|
||||
|
||||
# BusyLight API
|
||||
## End points
|
||||
|
|
|
|||
BIN
img/busylight-showoff.mp4
Normal file
BIN
img/elgato-marketplace.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
img/web-ui.png
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 126 KiB |
|
|
@ -1,4 +1,59 @@
|
|||
# Release notes
|
||||
# BusyLight Stream Deck plugin - Release notes
|
||||
|
||||
## Version 0.3.1.0 (2024-01-06)
|
||||
|
||||
### Download
|
||||
|
||||
[org.igox.busylight.v0.3.1.0.streamDeckPlugin](download/org.igox.busylight.v0.3.1.0.streamDeckPlugin)
|
||||
|
||||
### Features
|
||||
|
||||
- None added
|
||||
|
||||
### Enhancements
|
||||
|
||||
- Add colored button for "Set color" action.
|
||||
- Add colored button for "Set brightness" action.
|
||||
- Update plugin and plugin category icons
|
||||
|
||||
### Fixes
|
||||
|
||||
- None.
|
||||
|
||||
### Bugs & known limitations
|
||||
|
||||
- None known at publication time.
|
||||
|
||||
### Screenshot
|
||||
|
||||

|
||||
|
||||
## Version 0.3.0.0 (2024-01-06)
|
||||
|
||||
### Download
|
||||
|
||||
[org.igox.busylight.v0.3.0.0.streamDeckPlugin](download/org.igox.busylight.v0.3.0.0.streamDeckPlugin)
|
||||
|
||||
### Features
|
||||
|
||||
- None added
|
||||
|
||||
### Enhancements
|
||||
|
||||
- Rework icons to comply with plugin guidelines for Elgato Marketplace
|
||||
- Combine the 3 "status" actions into a single action and having the status be selected with a dropdown
|
||||
|
||||
### Fixes
|
||||
|
||||
- None.
|
||||
|
||||
### Bugs & known limitations
|
||||
|
||||
- None known at publication time.
|
||||
|
||||
### Screenshot
|
||||
|
||||

|
||||
|
||||
## Version 0.2.0.0 (2024-12-28)
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 224 KiB |
|
After Width: | Height: | Size: 224 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 573 KiB |
|
After Width: | Height: | Size: 573 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 575 KiB |
|
After Width: | Height: | Size: 575 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 89 KiB |
|
|
@ -1,69 +1,21 @@
|
|||
{
|
||||
"Name": "iGoX BusyLight",
|
||||
"Version": "0.2.0.0",
|
||||
"Version": "0.3.1.0",
|
||||
"Author": "iGoX",
|
||||
"$schema": "https://schemas.elgato.com/streamdeck/plugins/manifest.json",
|
||||
"Actions": [
|
||||
{
|
||||
"Name": "Set status as 'Available'",
|
||||
"UUID": "org.igox.busylight.status.available",
|
||||
"Icon": "imgs/actions/status/available/available",
|
||||
"Tooltip": "Set status as 'Available'",
|
||||
"Name": "Set BusyLight status",
|
||||
"UUID": "org.igox.busylight.status.set",
|
||||
"Icon": "imgs/actions/icons/status/status",
|
||||
"Tooltip": "Set BusyLight status",
|
||||
"PropertyInspectorPath": "ui/status-config.html",
|
||||
"Controllers": [
|
||||
"Keypad"
|
||||
],
|
||||
"States": [
|
||||
{
|
||||
"Image": "imgs/actions/status/available/available",
|
||||
"TitleAlignment": "bottom"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Set status as 'Away'",
|
||||
"UUID": "org.igox.busylight.status.away",
|
||||
"Icon": "imgs/actions/status/away/away",
|
||||
"Tooltip": "Set status as 'Away'",
|
||||
"PropertyInspectorPath": "ui/status-config.html",
|
||||
"Controllers": [
|
||||
"Keypad"
|
||||
],
|
||||
"States": [
|
||||
{
|
||||
"Image": "imgs/actions/status/away/away",
|
||||
"TitleAlignment": "bottom"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Set status as 'Busy'",
|
||||
"UUID": "org.igox.busylight.status.busy",
|
||||
"Icon": "imgs/actions/status/busy/busy",
|
||||
"Tooltip": "Set status as 'Busy'",
|
||||
"PropertyInspectorPath": "ui/status-config.html",
|
||||
"Controllers": [
|
||||
"Keypad"
|
||||
],
|
||||
"States": [
|
||||
{
|
||||
"Image": "imgs/actions/status/busy/busy",
|
||||
"TitleAlignment": "bottom"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Turn off the BusyLight",
|
||||
"UUID": "org.igox.busylight.status.off",
|
||||
"Icon": "imgs/actions/status/off/off",
|
||||
"Tooltip": "Turn off the BusyLight",
|
||||
"PropertyInspectorPath": "ui/status-config.html",
|
||||
"Controllers": [
|
||||
"Keypad"
|
||||
],
|
||||
"States": [
|
||||
{
|
||||
"Image": "imgs/actions/status/off/off",
|
||||
"Image": "imgs/actions/icons/status/status",
|
||||
"TitleAlignment": "bottom"
|
||||
}
|
||||
]
|
||||
|
|
@ -71,7 +23,7 @@
|
|||
{
|
||||
"Name": "Set brightness",
|
||||
"UUID": "org.igox.busylight.brigthness.set",
|
||||
"Icon": "imgs/actions/brightness/brightness",
|
||||
"Icon": "imgs/actions/icons/brightness/brightness",
|
||||
"Tooltip": "Set LED brightness",
|
||||
"PropertyInspectorPath": "ui/brightness-config.html",
|
||||
"Controllers": [
|
||||
|
|
@ -79,7 +31,7 @@
|
|||
],
|
||||
"States": [
|
||||
{
|
||||
"Image": "imgs/actions/brightness/brightness",
|
||||
"Image": "imgs/actions/icons/brightness/brightness",
|
||||
"TitleAlignment": "bottom"
|
||||
}
|
||||
]
|
||||
|
|
@ -87,7 +39,7 @@
|
|||
{
|
||||
"Name": "Set color",
|
||||
"UUID": "org.igox.busylight.color.set",
|
||||
"Icon": "imgs/actions/color/color",
|
||||
"Icon": "imgs/actions/icons/color/color",
|
||||
"Tooltip": "Set BusyLight displayed color",
|
||||
"PropertyInspectorPath": "ui/color-config.html",
|
||||
"Controllers": [
|
||||
|
|
@ -95,17 +47,17 @@
|
|||
],
|
||||
"States": [
|
||||
{
|
||||
"Image": "imgs/actions/color/color",
|
||||
"Image": "imgs/actions/icons/color/color",
|
||||
"TitleAlignment": "bottom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Category": "iGoX BusyLight",
|
||||
"CategoryIcon": "imgs/plugin/marketplace",
|
||||
"CategoryIcon": "imgs/plugin/category-icon",
|
||||
"CodePath": "bin/plugin.js",
|
||||
"Description": "Control your DIY BusyLight (https://github.com/igox/busylight) from your Stream Deck",
|
||||
"Icon": "imgs/plugin/marketplace",
|
||||
"Icon": "imgs/plugin/icon",
|
||||
"SDKVersion": 2,
|
||||
"Software": {
|
||||
"MinimumVersion": "6.4"
|
||||
|
|
|
|||
|
|
@ -25,5 +25,14 @@
|
|||
value="getGlobalSettings()">
|
||||
</sdpi-textfield>
|
||||
</sdpi-item>
|
||||
<sdpi-item label="Status">
|
||||
<sdpi-select setting="status" placeholder="Please choose a status">
|
||||
<option value="available">Available</option>
|
||||
<option value="away">Away</option>
|
||||
<option value="busy">Busy</option>
|
||||
<option value="on">On</option>
|
||||
<option value="off">Off</option>
|
||||
</sdpi-select>
|
||||
</sdpi-item>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import streamDeck, { action, DidReceiveSettingsEvent, WillAppearEvent, KeyDownEvent, SingletonAction } from "@elgato/streamdeck";
|
||||
import streamDeck, { action, DidReceiveSettingsEvent, WillAppearEvent, KeyDownEvent, PropertyInspectorDidAppearEvent, SingletonAction } from "@elgato/streamdeck";
|
||||
|
||||
@action({ UUID: "org.igox.busylight.brigthness.set" })
|
||||
export class SetBrightness extends SingletonAction<BrightnessSettings> {
|
||||
|
|
@ -25,7 +25,13 @@ export class SetBrightness extends SingletonAction<BrightnessSettings> {
|
|||
|
||||
const { settings } = ev.payload;
|
||||
await ev.action.setSettings(settings);
|
||||
await ev.action.setTitle(`${settings.brightness} %`);
|
||||
await ev.action.setTitle(`${settings.brightness}%`);
|
||||
}
|
||||
|
||||
override async onPropertyInspectorDidAppear(ev: PropertyInspectorDidAppearEvent<BrightnessSettings>): Promise<void> {
|
||||
streamDeck.logger.debug(`>>> Received onPropertyInspectorDidAppear. Setting action icon <<<`);
|
||||
|
||||
await ev.action.setImage(`imgs/actions/buttons/brigthness/brigthness.png`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import streamDeck, { action, JsonObject, KeyDownEvent, DidReceiveSettingsEvent, SingletonAction } from "@elgato/streamdeck";
|
||||
import streamDeck, { action, JsonObject, KeyDownEvent, DidReceiveSettingsEvent, PropertyInspectorDidAppearEvent, SingletonAction } from "@elgato/streamdeck";
|
||||
|
||||
@action({ UUID: "org.igox.busylight.color.set" })
|
||||
export class SetColor extends SingletonAction {
|
||||
|
|
@ -18,6 +18,12 @@ export class SetColor extends SingletonAction {
|
|||
const { settings } = ev.payload;
|
||||
await ev.action.setSettings(settings);
|
||||
}
|
||||
|
||||
override async onPropertyInspectorDidAppear(ev: PropertyInspectorDidAppearEvent<ColorSettings>): Promise<void> {
|
||||
streamDeck.logger.debug(`>>> Color button property inspector diplayed! <<<`);
|
||||
|
||||
await ev.action.setImage(`imgs/actions/buttons/colored/colored.png`);
|
||||
}
|
||||
}
|
||||
|
||||
function hexToRgb(hex: string): { r: number, g: number, b: number } {
|
||||
|
|
|
|||
|
|
@ -1,30 +1,20 @@
|
|||
import streamDeck, { action, KeyDownEvent, SingletonAction } from "@elgato/streamdeck";
|
||||
import streamDeck, { action, KeyDownEvent, SingletonAction, DidReceiveSettingsEvent } from "@elgato/streamdeck";
|
||||
|
||||
@action({ UUID: "org.igox.busylight.status.available" })
|
||||
export class SetStatusAvailable extends SingletonAction {
|
||||
override async onKeyDown(ev: KeyDownEvent): Promise<void> {
|
||||
setStatus('available');
|
||||
@action({ UUID: "org.igox.busylight.status.set" })
|
||||
export class SetStatus extends SingletonAction {
|
||||
override async onKeyDown(ev: KeyDownEvent<statusSettings>): Promise<void> {
|
||||
const { settings } = ev.payload;
|
||||
settings.status ??= 'available';
|
||||
setStatus(settings.status);
|
||||
}
|
||||
}
|
||||
|
||||
@action({ UUID: "org.igox.busylight.status.busy" })
|
||||
export class SetStatusBusy extends SingletonAction {
|
||||
override async onKeyDown(ev: KeyDownEvent): Promise<void> {
|
||||
setStatus('busy');
|
||||
}
|
||||
}
|
||||
override async onDidReceiveSettings(ev: DidReceiveSettingsEvent<statusSettings>): Promise<void> {
|
||||
const { settings } = ev.payload;
|
||||
let status = settings.status;
|
||||
streamDeck.logger.debug(`>>> Config status changed to: ${status} <<<`);
|
||||
|
||||
@action({ UUID: "org.igox.busylight.status.away" })
|
||||
export class SetStatusAway extends SingletonAction {
|
||||
override async onKeyDown(ev: KeyDownEvent): Promise<void> {
|
||||
setStatus('away');
|
||||
}
|
||||
}
|
||||
await ev.action.setImage(`imgs/actions/buttons/${status}/${status}.png`);
|
||||
|
||||
@action({ UUID: "org.igox.busylight.status.off" })
|
||||
export class SetStatusOff extends SingletonAction {
|
||||
override async onKeyDown(ev: KeyDownEvent): Promise<void> {
|
||||
setStatus('off');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -44,3 +34,7 @@ async function setStatus(status: string) {
|
|||
.then(response => response.json())
|
||||
.then(data => streamDeck.logger.debug(data));
|
||||
}
|
||||
|
||||
type statusSettings = {
|
||||
status?: string;
|
||||
};
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
import streamDeck, { LogLevel, SingletonAction, action, type DidReceiveSettingsEvent } from "@elgato/streamdeck";
|
||||
|
||||
//import { IncrementCounter } from "./actions/increment-counter";
|
||||
import { SetStatusAvailable, SetStatusBusy, SetStatusAway, SetStatusOff } from "./actions/set-status";
|
||||
import { SetStatus} from "./actions/set-status";
|
||||
import { SetBrightness } from "./actions/set-brightness";
|
||||
import { SetColor } from "./actions/set-color";
|
||||
|
||||
|
|
@ -9,10 +8,7 @@ import { SetColor } from "./actions/set-color";
|
|||
streamDeck.logger.setLevel(LogLevel.INFO);
|
||||
|
||||
// Register the actions.
|
||||
streamDeck.actions.registerAction(new SetStatusAvailable());
|
||||
streamDeck.actions.registerAction(new SetStatusBusy());
|
||||
streamDeck.actions.registerAction(new SetStatusAway());
|
||||
streamDeck.actions.registerAction(new SetStatusOff());
|
||||
streamDeck.actions.registerAction(new SetStatus());
|
||||
streamDeck.actions.registerAction(new SetBrightness());
|
||||
streamDeck.actions.registerAction(new SetColor());
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 152 KiB |
BIN
streamdeck-plugin/img/v0.3.0.0.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
streamdeck-plugin/img/v0.3.1.0.png
Normal file
|
After Width: | Height: | Size: 236 KiB |