Initial commit
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
.DS_Store
|
||||||
|
**/Bruno/
|
||||||
BIN
3D-files-to-print/Busylight v2.f3d
Normal file
BIN
3D-files-to-print/LED cover.stl
Normal file
BIN
3D-files-to-print/LED support bottom.stl
Normal file
BIN
3D-files-to-print/LED support top.stl
Normal file
5
3D-files-to-print/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
Loctite glue and hot glue gun are you friends :smile:
|
||||||
|
|
||||||
|
All files can be printed in PLA. \
|
||||||
|
To have a nice light diffusion, I printed the `LED cover.stl` file in [_vase mode_](https://all3dp.com/2/cura-vase-mode-all-you-need-to-know/).
|
||||||
|

|
||||||
BIN
3D-files-to-print/Raiser.stl
Normal file
BIN
3D-files-to-print/USB holder.stl
Normal file
BIN
3D-files-to-print/USB plate.stl
Normal file
34
ESP32/boot.py
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
# This file is executed on every boot (including wake-boot from deepsleep)
|
||||||
|
# It is executed after boot.py, before main.py
|
||||||
|
import os, machine
|
||||||
|
import network
|
||||||
|
import gc
|
||||||
|
|
||||||
|
gc.collect()
|
||||||
|
|
||||||
|
# Disable Access Point
|
||||||
|
ap_if = network.WLAN(network.AP_IF)
|
||||||
|
ap_if.active(False)
|
||||||
|
|
||||||
|
# Connect to the WIFI when booting
|
||||||
|
SSID = '<YOUR WIFI SSID>' # Set the WIFI network SSID
|
||||||
|
PASSWORD = '<YOUR WIFI PASSWORD>' # Set the WIFI network password
|
||||||
|
network.country('<YOUR COUNTRY CODE>') # Set the country code for the WIFI (ISO 3166-1 Alpha-2 country code)
|
||||||
|
network.hostname('busylight-esp32') # Hostname that will identify this device on the network
|
||||||
|
|
||||||
|
def boot_wifi_connect():
|
||||||
|
wlan = network.WLAN(network.STA_IF)
|
||||||
|
if not wlan.isconnected():
|
||||||
|
print('connecting to network...')
|
||||||
|
wlan.active(True)
|
||||||
|
wlan.connect(SSID, PASSWORD)
|
||||||
|
while not wlan.isconnected():
|
||||||
|
pass
|
||||||
|
ip, mask, gateway, dns = wlan.ifconfig()
|
||||||
|
print('\nNetwork config:')
|
||||||
|
print('- IP address: ' + ip)
|
||||||
|
print('- Network mask: ' + mask)
|
||||||
|
print('- Network gateway: ' + gateway)
|
||||||
|
print('- DNS server: ' + dns + '\n')
|
||||||
|
|
||||||
|
boot_wifi_connect()
|
||||||
219
ESP32/main.py
Normal file
|
|
@ -0,0 +1,219 @@
|
||||||
|
from microdot import Microdot, send_file
|
||||||
|
import machine, sys, neopixel, time
|
||||||
|
|
||||||
|
app = Microdot()
|
||||||
|
|
||||||
|
# Difine NeoPixel object
|
||||||
|
nbPixels = 12*2
|
||||||
|
pinPixelStrip = 16 # ESP32 D1 Mini
|
||||||
|
neoPixelStrip = neopixel.NeoPixel(machine.Pin(pinPixelStrip), nbPixels)
|
||||||
|
|
||||||
|
# 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 = statusColors.get('OFF')
|
||||||
|
blStatus = 'off'
|
||||||
|
blPreviousStatus='off'
|
||||||
|
blBrightness = 0.1 # Adjust the brightness (0.0 - 1.0)
|
||||||
|
|
||||||
|
def __setColor(color):
|
||||||
|
r, g , b = color
|
||||||
|
r = int(r * blBrightness)
|
||||||
|
g = int(g * blBrightness)
|
||||||
|
b = int(b * blBrightness)
|
||||||
|
return (r, g, b)
|
||||||
|
|
||||||
|
def __setBusyLightColor(color, brightness):
|
||||||
|
global blBrightness
|
||||||
|
blBrightness = brightness
|
||||||
|
global blColor
|
||||||
|
blColor = color
|
||||||
|
neoPixelStrip.fill(__setColor(color))
|
||||||
|
neoPixelStrip.write()
|
||||||
|
|
||||||
|
global blStatus
|
||||||
|
blStatus = 'colored'
|
||||||
|
|
||||||
|
def __setBusyLightStatus(status):
|
||||||
|
status = status.upper()
|
||||||
|
color = statusColors.get(status)
|
||||||
|
__setBusyLightColor(color, blBrightness)
|
||||||
|
|
||||||
|
global blStatus
|
||||||
|
blStatus = status.lower()
|
||||||
|
|
||||||
|
# Microdot APP routes
|
||||||
|
|
||||||
|
@app.get('/static/<path:path>')
|
||||||
|
async def staticRoutes(request, path):
|
||||||
|
if '..' in path:
|
||||||
|
# directory traversal is not allowed
|
||||||
|
return {'error': '4040 Not found'}, 404
|
||||||
|
return send_file('static/' + path)
|
||||||
|
|
||||||
|
@app.get('/')
|
||||||
|
async def getIndex(request):
|
||||||
|
return send_file('static/index.html')
|
||||||
|
|
||||||
|
@app.get('/api/brightness')
|
||||||
|
async def getBrightness(request):
|
||||||
|
return {'brightness': blBrightness}
|
||||||
|
|
||||||
|
@app.post('/api/brightness')
|
||||||
|
async def setBrightness(request):
|
||||||
|
brightness = request.json.get("brightness")
|
||||||
|
|
||||||
|
if brightness is None:
|
||||||
|
return {'error': 'missing brightness parameter'}, 400
|
||||||
|
|
||||||
|
if type(brightness) is float \
|
||||||
|
or type(brightness) is int:
|
||||||
|
if brightness < 0 or brightness > 1:
|
||||||
|
return {'error': 'brigthness out of bound (0.0 - 1.0)'}, 400
|
||||||
|
else:
|
||||||
|
return {'error': 'wrong brigthness type (float)'}, 400
|
||||||
|
|
||||||
|
# Save blStatus
|
||||||
|
global blStatus
|
||||||
|
status = blStatus
|
||||||
|
|
||||||
|
# Apply new brightness to current color
|
||||||
|
color = blColor
|
||||||
|
__setBusyLightColor(color, brightness)
|
||||||
|
|
||||||
|
# Restore global status
|
||||||
|
blStatus = status
|
||||||
|
|
||||||
|
global blBrightness
|
||||||
|
blBrightness = brightness
|
||||||
|
|
||||||
|
return {'brightness': blBrightness}
|
||||||
|
|
||||||
|
|
||||||
|
@app.post('/api/color')
|
||||||
|
async def setColor(request):
|
||||||
|
|
||||||
|
r = request.json.get("r")
|
||||||
|
g = request.json.get("g")
|
||||||
|
b = request.json.get("b")
|
||||||
|
|
||||||
|
if bool(r is None or g is None or b is None):
|
||||||
|
return {'error': 'missing color'}, 400
|
||||||
|
else:
|
||||||
|
if type(r) is int \
|
||||||
|
and type(g) is int \
|
||||||
|
and type(b) is int:
|
||||||
|
color = (r, g, b)
|
||||||
|
else:
|
||||||
|
return {'error': 'wrong color type (int)'}, 400
|
||||||
|
|
||||||
|
if (r < 0 or r > 255) \
|
||||||
|
or (g < 0 or g > 255) \
|
||||||
|
or (b < 0 or b > 255):
|
||||||
|
return {'error': 'color out of bound (0 - 255)'}, 400
|
||||||
|
|
||||||
|
brightness = request.json.get("brightness")
|
||||||
|
|
||||||
|
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
|
||||||
|
__setBusyLightColor(color, brightness)
|
||||||
|
|
||||||
|
__setBusyLightColor(color, blBrightness)
|
||||||
|
|
||||||
|
return {'status': blStatus}
|
||||||
|
|
||||||
|
@app.route('/api/status/<status>', methods=['GET', 'POST'])
|
||||||
|
async def setStatus(request, status):
|
||||||
|
lStatus = status.lower()
|
||||||
|
if lStatus == 'on':
|
||||||
|
__setBusyLightStatus('ON')
|
||||||
|
elif lStatus == 'off':
|
||||||
|
__setBusyLightStatus('OFF')
|
||||||
|
elif lStatus == 'available':
|
||||||
|
__setBusyLightStatus('AVAILABLE')
|
||||||
|
elif lStatus == 'away':
|
||||||
|
__setBusyLightStatus('AWAY')
|
||||||
|
elif lStatus == 'busy':
|
||||||
|
__setBusyLightStatus('BUSY')
|
||||||
|
else:
|
||||||
|
return {'error': 'unknown /api/status/' + lStatus + ' route'}, 404
|
||||||
|
|
||||||
|
return {'status': blStatus}
|
||||||
|
|
||||||
|
@app.get('/api/color')
|
||||||
|
async def getColor(request):
|
||||||
|
r, g, b = neoPixelStrip.__getitem__(0)
|
||||||
|
return {'color': {'r': r, 'g': g, 'b': b}}
|
||||||
|
|
||||||
|
@app.get('/api/status')
|
||||||
|
async def getStatus(request):
|
||||||
|
return {'status': blStatus}
|
||||||
|
|
||||||
|
@app.get('/api/debug')
|
||||||
|
async def getDebugInfo(request):
|
||||||
|
r, g, b = blColor
|
||||||
|
dr, dg, db = neoPixelStrip.__getitem__(0)
|
||||||
|
return {'status': blStatus, 'brightness': blBrightness, 'color': {'r': r, 'g': g, 'b': b}, 'dimColor': {'r': dr, 'g': dg, 'b': db}}
|
||||||
|
|
||||||
|
@app.post('/api/mutedeck-webhook')
|
||||||
|
async def mutedeckWebhook(request):
|
||||||
|
|
||||||
|
if request.json.get('control') != 'system':
|
||||||
|
if request.json.get('call') == 'active':
|
||||||
|
if request.json.get('mute') == 'active':
|
||||||
|
isMuted = True
|
||||||
|
else:
|
||||||
|
isMuted = False
|
||||||
|
|
||||||
|
if request.json.get('video') == 'active':
|
||||||
|
isVideoOn = True
|
||||||
|
else:
|
||||||
|
isVideoOn = False
|
||||||
|
|
||||||
|
if isMuted:
|
||||||
|
__setBusyLightStatus('away')
|
||||||
|
else:
|
||||||
|
__setBusyLightStatus('busy')
|
||||||
|
else:
|
||||||
|
__setBusyLightStatus('available')
|
||||||
|
|
||||||
|
return {'status': blStatus}
|
||||||
|
|
||||||
|
|
||||||
|
@app.post('/shutdown')
|
||||||
|
async def shutdown(request):
|
||||||
|
request.app.shutdown()
|
||||||
|
return 'The server is shutting down...'
|
||||||
|
|
||||||
|
# Startup effect
|
||||||
|
def startUpSeq():
|
||||||
|
print('Start seq begins')
|
||||||
|
__setBusyLightStatus('OFF')
|
||||||
|
time.sleep_ms(100)
|
||||||
|
__setBusyLightStatus('BUSY')
|
||||||
|
time.sleep_ms(200)
|
||||||
|
__setBusyLightStatus('AWAY')
|
||||||
|
time.sleep_ms(300)
|
||||||
|
__setBusyLightStatus('AVAILABLE')
|
||||||
|
time.sleep_ms(500)
|
||||||
|
__setBusyLightStatus('OFF')
|
||||||
|
print('Start seq is ended')
|
||||||
|
__setBusyLightColor(statusColors.get('OFF'), 0.4)
|
||||||
|
|
||||||
|
startUpSeq()
|
||||||
|
|
||||||
|
# Start API webserver
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(port=80, debug=True)
|
||||||
70
ESP32/static/busylight-api.js
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
async function setStatus(status = '') {
|
||||||
|
// Les options par défaut sont indiquées par *
|
||||||
|
const response = await fetch(`/api/status/${status}`, {
|
||||||
|
method: "POST", // *GET, POST, PUT, DELETE, etc.
|
||||||
|
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getStatus() {
|
||||||
|
// Les options par défaut sont indiquées par *
|
||||||
|
const response = await fetch(`/api/status`, {
|
||||||
|
method: "GET", // *GET, POST, PUT, DELETE, etc.
|
||||||
|
cache: "no-cache" // *default, no-cache, reload, force-cache, only-if-cached
|
||||||
|
});
|
||||||
|
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setColor(color = {}) {
|
||||||
|
// Les options par défaut sont indiquées par *
|
||||||
|
const response = await fetch(`/api/color`, {
|
||||||
|
method: "POST", // *GET, POST, PUT, DELETE, etc.
|
||||||
|
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify(color) // le type utilisé pour le corps doit correspondre à l'en-tête "Content-Type"
|
||||||
|
});
|
||||||
|
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getColor() {
|
||||||
|
// Les options par défaut sont indiquées par *
|
||||||
|
const response = await fetch(`/api/color`, {
|
||||||
|
method: "GET", // *GET, POST, PUT, DELETE, etc.
|
||||||
|
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setBrightness(brightness = {}) {
|
||||||
|
// Les options par défaut sont indiquées par *
|
||||||
|
const response = await fetch(`/api/brightness`, {
|
||||||
|
method: "POST", // *GET, POST, PUT, DELETE, etc.
|
||||||
|
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify(brightness) // le type utilisé pour le corps doit correspondre à l'en-tête "Content-Type"
|
||||||
|
});
|
||||||
|
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getBrightness() {
|
||||||
|
// Les options par défaut sont indiquées par *
|
||||||
|
const response = await fetch(`/api/brightness`, {
|
||||||
|
method: "GET", // *GET, POST, PUT, DELETE, etc.
|
||||||
|
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return response.json(); // transforme la réponse JSON reçue en objet JavaScript natif
|
||||||
|
}
|
||||||
136
ESP32/static/index.html
Normal file
|
|
@ -0,0 +1,136 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>BusyLight</title>
|
||||||
|
<script src="static/busylight-api.js"></script>
|
||||||
|
<script src="static/jscolor.min.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body onload="initForm()">
|
||||||
|
<h1>Status</h1>
|
||||||
|
<section>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
jscolor.presets.rgb = {
|
||||||
|
format: 'rgb',
|
||||||
|
alphaChannel: false
|
||||||
|
};
|
||||||
|
|
||||||
|
//var colorPicker = new JSColor("colorPicker", "{preset:'default', onChange: 'putColor(this)'}")
|
||||||
|
var colorPickerOpts = {};
|
||||||
|
colorPickerOpts["preset"] = "rgb";
|
||||||
|
colorPickerOpts["format"] = "rgb";
|
||||||
|
colorPickerOpts["alphaChannel"] = false;
|
||||||
|
colorPickerOpts["onChange"] = "putColor(this)";
|
||||||
|
var colorPicker = new JSColor("#colorPicker", colorPickerOpts);
|
||||||
|
|
||||||
|
async function initForm() {
|
||||||
|
var s = await getStatus();
|
||||||
|
var c = await getColor();
|
||||||
|
var b = await getBrightness();
|
||||||
|
|
||||||
|
var statusRadio;
|
||||||
|
switch (s.status) {
|
||||||
|
case 'off':
|
||||||
|
statusRadio = document.getElementById('off');
|
||||||
|
break;
|
||||||
|
case 'busy':
|
||||||
|
statusRadio = document.getElementById('busy');
|
||||||
|
break;
|
||||||
|
case 'available':
|
||||||
|
statusRadio = document.getElementById('available');
|
||||||
|
break;
|
||||||
|
case 'away':
|
||||||
|
statusRadio = document.getElementById('away');
|
||||||
|
break;
|
||||||
|
case 'colored':
|
||||||
|
statusRadio = document.getElementById('colored');
|
||||||
|
colorPicker.fromString('rgb(' + c.color.r + ',' + c.color.g + ',' + c.color.b + ')');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
statusRadio.checked = true;
|
||||||
|
|
||||||
|
brightnessRange = document.getElementById('brightness');
|
||||||
|
brightnessRange.value = b.brightness * 100;
|
||||||
|
|
||||||
|
setColorPickerColor(s.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
function openColorPicker() {
|
||||||
|
colorPicker.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function putColor(picker) {
|
||||||
|
var color = {};
|
||||||
|
color.r = Math.round(picker.channel('R'));
|
||||||
|
color.g = Math.round(picker.channel('G'));
|
||||||
|
color.b = Math.round(picker.channel('B'));
|
||||||
|
var s = await setColor(color);
|
||||||
|
statusRadio = document.getElementById('colored');
|
||||||
|
statusRadio.checked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function putStatus(status) {
|
||||||
|
var s = await setStatus(status);
|
||||||
|
setColorPickerColor(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setColorPickerColor(status) {
|
||||||
|
switch (status) {
|
||||||
|
case 'off':
|
||||||
|
colorPicker.fromString('rgb(0,0,0)');
|
||||||
|
break;
|
||||||
|
case 'busy':
|
||||||
|
colorPicker.fromString('rgb(255,0,0)');
|
||||||
|
break;
|
||||||
|
case 'available':
|
||||||
|
colorPicker.fromString('rgb(0,255,0)');
|
||||||
|
break;
|
||||||
|
case 'away':
|
||||||
|
colorPicker.fromString('rgb(246,190,0)');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function putBrightness(value) {
|
||||||
|
var brightness = {};
|
||||||
|
brightness.brightness = value/100;
|
||||||
|
var b = await setBrightness(brightness);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
ESP32/static/jscolor.min.js
vendored
Normal file
128
README.md
Normal file
|
|
@ -0,0 +1,128 @@
|
||||||
|
# What's this project?
|
||||||
|
|
||||||
|
A simple to build, nice looking, portable DIY **Busy Light**.
|
||||||
|
|
||||||
|
It comes with a with a rudimentary (and ugly) **Web UI** and a simple (but hopefully convenient) **Rest API**.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# Web UI
|
||||||
|
A very simplistic (and ugly) UI is available on port `80`. \
|
||||||
|
Default hostname is `busylight-esp32`.
|
||||||
|
|
||||||
|
You can try to reach the web UI @ `http://busylight-esp32.local`.
|
||||||
|
|
||||||
|
| What an ugly UI ! :smile: |
|
||||||
|
|---------------------------|
|
||||||
|
|  |
|
||||||
|
|
||||||
|
# BusyLight API
|
||||||
|
## End points
|
||||||
|
| Path | Method | Parameter | Description |
|
||||||
|
|--------|------|-----------|-------------|
|
||||||
|
| /api/color | POST | `color` JSON object | Set the BusyLight color according to the `color` object passed in the request body. Return a `status` object. |
|
||||||
|
| /api/color | GET | n/a | Retreive the color currently displyed by the BusyLight. Return a `color` object. |
|
||||||
|
| /api/brightness | POST | `brightness` JSON object | Set the BusyLight brightness according to the `brightness` object passed in the request body. Return a `status` object. |
|
||||||
|
| /api/brightness | GET | n/a | Retreive the BusyLight brightness. Return a `brightness` object. |
|
||||||
|
| /api/status/on | POST / GET | n/a | Light up the BusyLight. White color. Return a `status` object. |
|
||||||
|
| /api/status/available | POST / GET | n/a | Set the BusyLight in `available` mode. Green color. Return a `status` object. |
|
||||||
|
| /api/status/away | POST / GET | n/a | Set the BusyLight in `away` mode. Yellow 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 | GET | n/a | Retreive the current BusyLight status. Return a `status` object. |
|
||||||
|
| /api/debug | GET | n/a | Retreive the full BusyLight status. |
|
||||||
|
|
||||||
|
## JSON objects
|
||||||
|
### `color` object
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"r": 255,
|
||||||
|
"g": 0,
|
||||||
|
"b": 127,
|
||||||
|
"brightness": 0.5
|
||||||
|
}
|
||||||
|
```
|
||||||
|
`r`: RED color | integer | [0 .. 255]\
|
||||||
|
`g`: GREEN color | integer | [0 .. 255]\
|
||||||
|
`b`: BLUE color | integer | [0 .. 255]\
|
||||||
|
`brightness`: LED brighness (optional) | float | [0.0 .. 1.0]
|
||||||
|
|
||||||
|
### `brightness` object
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"brightness": 0.5
|
||||||
|
}
|
||||||
|
```
|
||||||
|
`brightness`: LED brighness | float | [0.0 .. 1.0]
|
||||||
|
|
||||||
|
### `status` object
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"status": "<STATUS>"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
\<STATUS\> : `on` | `off` | `available` | `away` | `busy` | `colored`
|
||||||
|
|
||||||
|
|
||||||
|
# MuteDeck integration
|
||||||
|
The `POST api/mutedeck-webhook` endpoint aims to collect [MuteDeck](https://mutedeck.com/help/docs/notifications.html#enabling-the-webhook-integration) webhook callbacks.
|
||||||
|
|
||||||
|
It will automatically switch to the BusyLight in:
|
||||||
|
- busy mode (Red color) when entering a meeting with Mic `ON` **and** camera `ON`.
|
||||||
|
- away mode (Yellow color) when entering a meeting with Mic `OFF` **and** camera `ON`.
|
||||||
|
- away mode (Yellow color) if the mic is muted during a meeting.
|
||||||
|
- available mode (Green color) when exiting/closing a meeting.
|
||||||
|
|
||||||
|
| MuteDeck Configuration |
|
||||||
|
|---------------------------------------------------|
|
||||||
|
|  |
|
||||||
|
|
||||||
|
# Electronic parts
|
||||||
|
| Parts | Links (Amazon - not affiliated) |
|
||||||
|
|-------------------------|-----------------------------------------------------------------------------------------------------------|
|
||||||
|
| Micro-controler | [D1 ESP32 Mini NodeMCU](https://www.amazon.fr/dp/B0CDXB48DZ) |
|
||||||
|
| Led rings (x2) | [AZDelivery 5 x LED Ring 5V RGB compatible avec WS2812B 12-Bit 38mm](https://www.amazon.fr/dp/B07V1GGKHV) |
|
||||||
|
| Battery | [Anker PowerCore 5000mAh](https://www.amazon.fr/dp/B01CU1EC6Y) |
|
||||||
|
| USB A to USB C adapter | [USB A to USB C adapter](https://www.amazon.fr/dp/B0BYK917NM) |
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
**(1)** Flash your ESP32 with [Micropython](https://micropython.org/download/ESP32_GENERIC/).
|
||||||
|
|
||||||
|
**(2)** Install [microdot](https://microdot.readthedocs.io/en/latest/index.html) library on the ESP32. This can easily be done using [Thonny](https://thonny.org):
|
||||||
|
|
||||||
|
| Tools > Manage plug-ins | lib selection |
|
||||||
|
|-------------------------------|-------------------------------------|
|
||||||
|
|  |  |
|
||||||
|
|
||||||
|
**(3)** Drop the content of [ESP32](ESP32/) folder to the root directory of your ESP32 file system. Again, can easily be done using [Thonny](https://thonny.org):
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**Done!**
|
||||||
|
|
||||||
|
# 3D files - Enclosure
|
||||||
|
|
||||||
|
All the required 3D files (STLs and f3d project) to 3D print the enclosure are available in the [3D-files-to-print](3D-files-to-print/) folder.
|
||||||
|
|
||||||
|
# Wiring
|
||||||
|
|
||||||
|
To be done
|
||||||
|
|
||||||
|
# Tools & libs
|
||||||
|
|
||||||
|
## Thonny
|
||||||
|
https://thonny.org
|
||||||
|
|
||||||
|
## Micropython
|
||||||
|
https://micropython.org
|
||||||
|
|
||||||
|
## Microdot
|
||||||
|
https://microdot.readthedocs.io/en/latest/index.html
|
||||||
|
|
||||||
|
## JSColor
|
||||||
|
https://jscolor.com
|
||||||
BIN
img/busyligh-3d.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
img/busylight.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
img/file-copy.png
Normal file
|
After Width: | Height: | Size: 154 KiB |
BIN
img/lib-install.png
Normal file
|
After Width: | Height: | Size: 195 KiB |
BIN
img/lib-menu.png
Normal file
|
After Width: | Height: | Size: 109 KiB |
BIN
img/mutedeck-webhook-conf.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
img/web-ui.png
Normal file
|
After Width: | Height: | Size: 12 KiB |