Compare commits
4 Commits
v0.0.1
..
cb5a762c2f
| Author | SHA1 | Date | |
|---|---|---|---|
|
cb5a762c2f
|
|||
|
eca92a280e
|
|||
|
782db6f039
|
|||
| 69bb4aa6dc |
@@ -86,6 +86,7 @@ class LedController:
|
||||
|
||||
async def _off(self):
|
||||
self.color = (0, 0, 0)
|
||||
self.previousStatus = self.status
|
||||
self.status = "off"
|
||||
self._write(self.color)
|
||||
|
||||
@@ -121,7 +122,7 @@ class LedController:
|
||||
self.status = self.previousStatus
|
||||
self._write(self.color)
|
||||
|
||||
async def send(self, cmd):
|
||||
async def sendCommand(self, cmd):
|
||||
self._cmd = cmd
|
||||
self._flag.set()
|
||||
|
||||
@@ -129,8 +130,7 @@ class LedController:
|
||||
async def set_color(self, color, brightness=None):
|
||||
if brightness is not None:
|
||||
self.brightness = brightness
|
||||
|
||||
await self.send({
|
||||
await self.sendCommand({
|
||||
"type": "solid",
|
||||
"color": color
|
||||
})
|
||||
@@ -142,16 +142,19 @@ class LedController:
|
||||
if color is None:
|
||||
raise ValueError("invalid status")
|
||||
|
||||
await self.send({
|
||||
await self.sendCommand({
|
||||
"type": "solid",
|
||||
"color": color,
|
||||
"status": status.lower()
|
||||
})
|
||||
|
||||
async def get_status(self):
|
||||
return self.status
|
||||
|
||||
async def blink(self, frequency, duration):
|
||||
self.previousStatus = self.status
|
||||
|
||||
await self.send({
|
||||
await self.sendCommand({
|
||||
"type": "blink",
|
||||
"color": self.color,
|
||||
"frequency": frequency,
|
||||
@@ -160,7 +163,7 @@ class LedController:
|
||||
})
|
||||
|
||||
async def stop(self):
|
||||
await self.send({"type": "off"})
|
||||
await self.sendCommand({"type": "off"})
|
||||
|
||||
def get_state(self):
|
||||
if self.blinking and self.blinkDuration > 0:
|
||||
@@ -226,7 +229,6 @@ async def setBrightness(request):
|
||||
await led.set_color(current_color, brightness)
|
||||
|
||||
led.status = current_status
|
||||
|
||||
return {'brightness': led.brightness}
|
||||
|
||||
|
||||
@@ -235,6 +237,7 @@ async def setColor(request):
|
||||
r = request.json.get("r")
|
||||
g = request.json.get("g")
|
||||
b = request.json.get("b")
|
||||
brightness = request.json.get("brightness")
|
||||
|
||||
if r is None or g is None or b is None:
|
||||
return {'error': 'missing color'}, 400
|
||||
@@ -245,11 +248,17 @@ async def setColor(request):
|
||||
if not (0 <= r <= 255 and 0 <= g <= 255 and 0 <= b <= 255):
|
||||
return {'error': 'color out of bound'}, 400
|
||||
|
||||
brightness = request.json.get("brightness")
|
||||
if brightness is not None:
|
||||
if not isinstance(brightness, (int, float)):
|
||||
return {'error': 'wrong brightness type'}, 400
|
||||
|
||||
if brightness < 0 or brightness > 1:
|
||||
return {'error': 'brightness out of bound'}, 400
|
||||
|
||||
await led.set_color((r, g, b), brightness)
|
||||
status = await led.get_status()
|
||||
|
||||
return {'status': led.status}
|
||||
return {'status': status}
|
||||
|
||||
|
||||
@app.get('/api/color')
|
||||
@@ -260,7 +269,8 @@ async def getColor(request):
|
||||
|
||||
@app.get('/api/status')
|
||||
async def getStatus(request):
|
||||
return {'status': led.status}
|
||||
status = await led.get_status()
|
||||
return {'status': status}
|
||||
|
||||
|
||||
@app.route('/api/status/<status>', methods=['GET', 'POST'])
|
||||
@@ -270,7 +280,8 @@ async def setStatus(request, status):
|
||||
except ValueError:
|
||||
return {'error': 'unknown status'}, 404
|
||||
|
||||
return {'status': led.status}
|
||||
status = await led.get_status()
|
||||
return {'status': status}
|
||||
|
||||
|
||||
@app.post('/api/blink')
|
||||
@@ -307,7 +318,8 @@ async def getBlink(request):
|
||||
async def blinkStop(request):
|
||||
await led.stop()
|
||||
await led.set_status(led.previousStatus)
|
||||
return {'status': led.status}
|
||||
status = await led.get_status()
|
||||
return {'status': status}
|
||||
|
||||
|
||||
@app.get('/api/debug')
|
||||
@@ -367,4 +379,4 @@ async def main():
|
||||
await app.start_server(port=80)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
asyncio.run(main())
|
||||
|
||||
@@ -22,7 +22,7 @@ It comes with a with a simplistic but neat **Web UI** and a simple (but hopefull
|
||||
|
||||
| Controlled by Stream Deck with REST API | Light roll |
|
||||
| --- | --- |
|
||||
|  |  |
|
||||
|  |  |
|
||||
|
||||
# Web UI
|
||||
|
||||
@@ -33,7 +33,7 @@ You can try to reach the web UI @ <http://igox-busylight.local>.
|
||||
|
||||
| What an neat UI ! 😄 |
|
||||
| --- |
|
||||
|  |
|
||||
|  |
|
||||
|
||||
# BusyLight Buddy companion app
|
||||
|
||||
@@ -45,9 +45,11 @@ It features quick status presets, a custom color picker with saveable presets, a
|
||||
|
||||
# Stream Deck plug-in
|
||||
|
||||
You can download a Stream Deck plugin to control your BusyLight:
|
||||
You can download the Stream Deck plugin to control your BusyLight:
|
||||
|
||||
Or directly from [here](streamdeck-plugin/README.md).
|
||||
[](https://marketplace.elgato.com/product/igox-busylight-7448a0be-6dd6-4711-ba0d-86c52b9075b9)
|
||||
|
||||
Or directly from **[busyLight-streamdeck-pluing](https://code.igox.org/iGoX/busylight-streamdeck-plugin)** repository.
|
||||
|
||||
# BusyLight API
|
||||
|
||||
@@ -137,7 +139,7 @@ It will automatically switch to the BusyLight in:
|
||||
|
||||
| MuteDeck Configuration |
|
||||
| --- |
|
||||
|  |
|
||||
|  |
|
||||
|
||||
# Electronic parts
|
||||
|
||||
@@ -156,7 +158,7 @@ It will automatically switch to the BusyLight in:
|
||||
|
||||
| Tools > Manage plug-ins | lib selection |
|
||||
| --- | --- |
|
||||
|  |  |
|
||||
|  |  |
|
||||
|
||||
> ⚠️ **Compatibility note:** MicroPython v1.27 is **not compatible** with Microdot due to breaking changes in the underlying ESP-IDF v5.5. Use MicroPython **v1.24.1** with Microdot **v2.0.6**.
|
||||
|
||||
@@ -164,7 +166,7 @@ It will automatically switch to the BusyLight in:
|
||||
|
||||
**(4)** Copy the content of [ESP32](ESP32) folder with the modified `boot.py` file to the root of your ESP32 file system. Again, can easily be done using [Thonny](https://thonny.org):
|
||||
|
||||

|
||||

|
||||
|
||||
**Done!**
|
||||
|
||||
@@ -176,7 +178,7 @@ All the required 3D files (STLs and f3d project) to 3D print the enclosure are a
|
||||
|
||||
# Wiring / Soldering
|
||||
|
||||

|
||||

|
||||
|
||||
You can see a final assembly image [here](3D-files-to-print/README.md).
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 150 KiB |
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 195 KiB After Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 126 KiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
@@ -1,103 +0,0 @@
|
||||
# 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)
|
||||
|
||||
### Download
|
||||
|
||||
[org.igox.busylight.v0.2.0.0.streamDeckPlugin](download/org.igox.busylight.v0.2.0.0.streamDeckPlugin)
|
||||
|
||||
### Features
|
||||
|
||||
- Add the capability to set the color diplayed by BusyLigh LEDs.
|
||||
|
||||
### Fixes
|
||||
|
||||
- None.
|
||||
|
||||
### Bugs & known limitations
|
||||
|
||||
- None known at publication time.
|
||||
|
||||
### Screenshot
|
||||
|
||||

|
||||
|
||||
|
||||
## Version 0.1.0.0 (2024-12-28)
|
||||
|
||||
### Download
|
||||
|
||||
[org.igox.busylight.v0.1.0.0.streamDeckPlugin](download/org.igox.busylight.v0.1.0.0.streamDeckPlugin)
|
||||
|
||||
### Features
|
||||
|
||||
- Quick action buttons to set the BusyLight status (Available: green, Away: yellow, Busy: red).
|
||||
- Quick action button to turn off the BusyLight.
|
||||
- Button to set the BusyLight brightness.
|
||||
|
||||
### Fixes
|
||||
|
||||
- None: initial version of the plugin.
|
||||
|
||||
### Bugs & known limitations
|
||||
|
||||
- None known at publication time.
|
||||
|
||||
### Screenshot
|
||||
|
||||

|
||||
@@ -1,6 +0,0 @@
|
||||
# Node.js
|
||||
node_modules/
|
||||
|
||||
# Stream Deck files
|
||||
*.sdPlugin/bin
|
||||
*.sdPlugin/logs
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Attach to Plugin",
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"processId": "${command:PickProcess}",
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/bin/**/*.js"
|
||||
],
|
||||
"resolveSourceMapLocations": [
|
||||
"${workspaceFolder}/**"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
/* JSON schemas */
|
||||
"json.schemas": [
|
||||
{
|
||||
"fileMatch": [
|
||||
"**/manifest.json"
|
||||
],
|
||||
"url": "https://schemas.elgato.com/streamdeck/plugins/manifest.json"
|
||||
},
|
||||
{
|
||||
"fileMatch": [
|
||||
"**/layouts/*.json"
|
||||
],
|
||||
"url": "https://schemas.elgato.com/streamdeck/plugins/layout.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 224 KiB |
|
Before Width: | Height: | Size: 224 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 573 KiB |
|
Before Width: | Height: | Size: 573 KiB |
|
Before Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 575 KiB |
|
Before Width: | Height: | Size: 575 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 108 KiB |
@@ -1,80 +0,0 @@
|
||||
{
|
||||
"Name": "iGoX BusyLight",
|
||||
"Version": "0.3.1.0",
|
||||
"Author": "iGoX",
|
||||
"$schema": "https://schemas.elgato.com/streamdeck/plugins/manifest.json",
|
||||
"Actions": [
|
||||
{
|
||||
"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/icons/status/status",
|
||||
"TitleAlignment": "bottom"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Set brightness",
|
||||
"UUID": "org.igox.busylight.brigthness.set",
|
||||
"Icon": "imgs/actions/icons/brightness/brightness",
|
||||
"Tooltip": "Set LED brightness",
|
||||
"PropertyInspectorPath": "ui/brightness-config.html",
|
||||
"Controllers": [
|
||||
"Keypad"
|
||||
],
|
||||
"States": [
|
||||
{
|
||||
"Image": "imgs/actions/icons/brightness/brightness",
|
||||
"TitleAlignment": "bottom"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Set color",
|
||||
"UUID": "org.igox.busylight.color.set",
|
||||
"Icon": "imgs/actions/icons/color/color",
|
||||
"Tooltip": "Set BusyLight displayed color",
|
||||
"PropertyInspectorPath": "ui/color-config.html",
|
||||
"Controllers": [
|
||||
"Keypad"
|
||||
],
|
||||
"States": [
|
||||
{
|
||||
"Image": "imgs/actions/icons/color/color",
|
||||
"TitleAlignment": "bottom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Category": "iGoX BusyLight",
|
||||
"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/icon",
|
||||
"SDKVersion": 2,
|
||||
"Software": {
|
||||
"MinimumVersion": "6.4"
|
||||
},
|
||||
"OS": [
|
||||
{
|
||||
"Platform": "mac",
|
||||
"MinimumVersion": "10.15"
|
||||
},
|
||||
{
|
||||
"Platform": "windows",
|
||||
"MinimumVersion": "10"
|
||||
}
|
||||
],
|
||||
"Nodejs": {
|
||||
"Version": "20",
|
||||
"Debug": "enabled"
|
||||
},
|
||||
"UUID": "org.igox.busylight"
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head lang="en">
|
||||
<title>Configure your BusyLight</title>
|
||||
<meta charset="utf-8" />
|
||||
<script src="https://sdpi-components.dev/releases/v3/sdpi-components.js"></script>
|
||||
<script>
|
||||
function getGlobalSettings() {
|
||||
const { streamDeckClient } = SDPIComponents;
|
||||
const settings = streamDeckClient.getGlobalSettings();
|
||||
return settings.url || 'http://busylight-esp32.local';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
<!--
|
||||
Learn more about property inspector components at https://sdpi-components.dev/docs/components
|
||||
-->
|
||||
<sdpi-item label="URL or IP">
|
||||
<sdpi-textfield
|
||||
setting="url"
|
||||
placeholder="http://busylight-esp32.local"
|
||||
global="true"
|
||||
value="getGlobalSettings()">
|
||||
</sdpi-textfield>
|
||||
</sdpi-item>
|
||||
<sdpi-item label="Brightness">
|
||||
<sdpi-range
|
||||
setting="brightness"
|
||||
min="10"
|
||||
max="100"
|
||||
default="40"
|
||||
value="40"
|
||||
step="5"
|
||||
showlabels="true">
|
||||
<span slot="min">10%</span>
|
||||
<span slot="max">100%</span>
|
||||
</sdpi-range>
|
||||
</sdpi-item>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,33 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head lang="en">
|
||||
<title>Configure your BusyLight</title>
|
||||
<meta charset="utf-8" />
|
||||
<script src="https://sdpi-components.dev/releases/v3/sdpi-components.js"></script>
|
||||
<script>
|
||||
function getGlobalSettings() {
|
||||
const { streamDeckClient } = SDPIComponents;
|
||||
const settings = streamDeckClient.getGlobalSettings();
|
||||
return settings.url || 'http://busylight-esp32.local';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!--
|
||||
Learn more about property inspector components at https://sdpi-components.dev/docs/components
|
||||
-->
|
||||
<sdpi-item label="URL or IP">
|
||||
<sdpi-textfield
|
||||
setting="url"
|
||||
placeholder="http://busylight-esp32.local"
|
||||
global="true"
|
||||
value="getGlobalSettings()">
|
||||
</sdpi-textfield>
|
||||
</sdpi-item>
|
||||
<sdpi-item label="Color">
|
||||
<sdpi-color
|
||||
setting="color"></sdpi-color>
|
||||
</sdpi-item>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,38 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head lang="en">
|
||||
<title>Configure your BusyLight</title>
|
||||
<meta charset="utf-8" />
|
||||
<script src="https://sdpi-components.dev/releases/v3/sdpi-components.js"></script>
|
||||
<script>
|
||||
function getGlobalSettings() {
|
||||
const { streamDeckClient } = SDPIComponents;
|
||||
const settings = streamDeckClient.getGlobalSettings();
|
||||
return settings.url || 'http://busylight-esp32.local';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!--
|
||||
Learn more about property inspector components at https://sdpi-components.dev/docs/components
|
||||
-->
|
||||
<sdpi-item label="URL or IP">
|
||||
<sdpi-textfield
|
||||
setting="url"
|
||||
placeholder="http://busylight-esp32.local"
|
||||
global="true"
|
||||
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,22 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"watch": "rollup -c -w --watch.onEnd=\"streamdeck restart org.igox.busylight\""
|
||||
},
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@elgato/cli": "^1.1.0",
|
||||
"@rollup/plugin-commonjs": "^28.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.2.2",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-typescript": "^12.1.0",
|
||||
"@tsconfig/node20": "^20.1.2",
|
||||
"@types/node": "~20.15.0",
|
||||
"rollup": "^4.0.2",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elgato/streamdeck": "^1.0.0"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
import commonjs from "@rollup/plugin-commonjs";
|
||||
import nodeResolve from "@rollup/plugin-node-resolve";
|
||||
import terser from "@rollup/plugin-terser";
|
||||
import typescript from "@rollup/plugin-typescript";
|
||||
import path from "node:path";
|
||||
import url from "node:url";
|
||||
|
||||
const isWatching = !!process.env.ROLLUP_WATCH;
|
||||
const sdPlugin = "org.igox.busylight.sdPlugin";
|
||||
|
||||
/**
|
||||
* @type {import('rollup').RollupOptions}
|
||||
*/
|
||||
const config = {
|
||||
input: "src/plugin.ts",
|
||||
output: {
|
||||
file: `${sdPlugin}/bin/plugin.js`,
|
||||
sourcemap: isWatching,
|
||||
sourcemapPathTransform: (relativeSourcePath, sourcemapPath) => {
|
||||
return url.pathToFileURL(path.resolve(path.dirname(sourcemapPath), relativeSourcePath)).href;
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
{
|
||||
name: "watch-externals",
|
||||
buildStart: function () {
|
||||
this.addWatchFile(`${sdPlugin}/manifest.json`);
|
||||
},
|
||||
},
|
||||
typescript({
|
||||
mapRoot: isWatching ? "./" : undefined
|
||||
}),
|
||||
nodeResolve({
|
||||
browser: false,
|
||||
exportConditions: ["node"],
|
||||
preferBuiltins: true
|
||||
}),
|
||||
commonjs(),
|
||||
!isWatching && terser(),
|
||||
{
|
||||
name: "emit-module-package-file",
|
||||
generateBundle() {
|
||||
this.emitFile({ fileName: "package.json", source: `{ "type": "module" }`, type: "asset" });
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -1,58 +0,0 @@
|
||||
import streamDeck, { action, DidReceiveSettingsEvent, WillAppearEvent, KeyDownEvent, PropertyInspectorDidAppearEvent, SingletonAction } from "@elgato/streamdeck";
|
||||
|
||||
@action({ UUID: "org.igox.busylight.brigthness.set" })
|
||||
export class SetBrightness extends SingletonAction<BrightnessSettings> {
|
||||
|
||||
override async onKeyDown(ev: KeyDownEvent<BrightnessSettings>): Promise<void> {
|
||||
|
||||
streamDeck.logger.debug(`>>> Received KeyDownEvent. Settings: ${JSON.stringify(ev.payload.settings)} <<<`);
|
||||
|
||||
const { settings } = ev.payload;
|
||||
settings.brightness ??= 40;
|
||||
setBrightness(settings.brightness);
|
||||
}
|
||||
|
||||
override onWillAppear(ev: WillAppearEvent<BrightnessSettings>): void | Promise<void> {
|
||||
|
||||
streamDeck.logger.debug(`>>> Received WillAppearEvent. Settings: ${JSON.stringify(ev.payload.settings)} <<<`);
|
||||
|
||||
return ev.action.setTitle(`${ev.payload.settings.brightness ?? 40}%`);
|
||||
}
|
||||
|
||||
override async onDidReceiveSettings(ev: DidReceiveSettingsEvent<BrightnessSettings>): Promise<void> {
|
||||
|
||||
streamDeck.logger.debug(`>>> Received onDidReceiveSettings. Settings: ${JSON.stringify(ev.payload.settings)} <<<`);
|
||||
|
||||
const { settings } = ev.payload;
|
||||
await ev.action.setSettings(settings);
|
||||
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`);
|
||||
}
|
||||
}
|
||||
|
||||
async function setBrightness(brightness: number) {
|
||||
const settings = await streamDeck.settings.getGlobalSettings();
|
||||
const url = settings.url;
|
||||
|
||||
streamDeck.logger.debug(`>>> Sending brightness: ${brightness} to ${url} <<<`);
|
||||
|
||||
fetch(`${url}/api/brightness`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({"brightness": brightness/100})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => streamDeck.logger.debug(data));
|
||||
}
|
||||
|
||||
type BrightnessSettings = {
|
||||
brightness?: number;
|
||||
};
|
||||
@@ -1,57 +0,0 @@
|
||||
import streamDeck, { action, JsonObject, KeyDownEvent, DidReceiveSettingsEvent, PropertyInspectorDidAppearEvent, SingletonAction } from "@elgato/streamdeck";
|
||||
|
||||
@action({ UUID: "org.igox.busylight.color.set" })
|
||||
export class SetColor extends SingletonAction {
|
||||
override async onKeyDown(ev: KeyDownEvent<ColorSettings>): Promise<void> {
|
||||
|
||||
streamDeck.logger.debug(`>>> Received KeyDownEvent. Settings: ${JSON.stringify(ev.payload.settings)} <<<`);
|
||||
|
||||
const { settings } = ev.payload;
|
||||
settings.color ??= '#FFFFFF';
|
||||
setColor(hexToRgb(settings.color));
|
||||
}
|
||||
|
||||
override async onDidReceiveSettings(ev: DidReceiveSettingsEvent<ColorSettings>): Promise<void> {
|
||||
|
||||
streamDeck.logger.debug(`>>> Received onDidReceiveSettings. Settings: ${JSON.stringify(ev.payload.settings)} <<<`);
|
||||
|
||||
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 } {
|
||||
const hexNumber = parseInt(hex.replace('#', ''), 16);
|
||||
const r = (hexNumber >> 16) & 255;
|
||||
const g = (hexNumber >> 8) & 255;
|
||||
const b = hexNumber & 255;
|
||||
return { r, g, b };
|
||||
}
|
||||
|
||||
async function setColor(color: JsonObject) {
|
||||
const settings = await streamDeck.settings.getGlobalSettings();
|
||||
const url = settings.url;
|
||||
|
||||
streamDeck.logger.debug(`>>> Sending color: ${JSON.stringify({"r": color.r, "g": color.g, "b": color.b})} to ${url} <<<`);
|
||||
|
||||
fetch(`${url}/api/color`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({"r": color.r, "g": color.g, "b": color.b})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => streamDeck.logger.debug(data));
|
||||
}
|
||||
|
||||
type ColorSettings = {
|
||||
color?: string;
|
||||
};
|
||||
@@ -1,40 +0,0 @@
|
||||
import streamDeck, { action, KeyDownEvent, SingletonAction, DidReceiveSettingsEvent } from "@elgato/streamdeck";
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
override async onDidReceiveSettings(ev: DidReceiveSettingsEvent<statusSettings>): Promise<void> {
|
||||
const { settings } = ev.payload;
|
||||
let status = settings.status;
|
||||
streamDeck.logger.debug(`>>> Config status changed to: ${status} <<<`);
|
||||
|
||||
await ev.action.setImage(`imgs/actions/buttons/${status}/${status}.png`);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async function setStatus(status: string) {
|
||||
const settings = await streamDeck.settings.getGlobalSettings();
|
||||
const url = settings.url;
|
||||
|
||||
streamDeck.logger.debug(`>>> Sending status: ${status} to ${url} <<<`);
|
||||
|
||||
fetch(`${url}/api/status/${status}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => streamDeck.logger.debug(data));
|
||||
}
|
||||
|
||||
type statusSettings = {
|
||||
status?: string;
|
||||
};
|
||||
@@ -1,16 +0,0 @@
|
||||
import streamDeck, { LogLevel, SingletonAction, action, type DidReceiveSettingsEvent } from "@elgato/streamdeck";
|
||||
|
||||
import { SetStatus} from "./actions/set-status";
|
||||
import { SetBrightness } from "./actions/set-brightness";
|
||||
import { SetColor } from "./actions/set-color";
|
||||
|
||||
// We can enable "trace" logging so that all messages between the Stream Deck, and the plugin are recorded. When storing sensitive information
|
||||
streamDeck.logger.setLevel(LogLevel.INFO);
|
||||
|
||||
// Register the actions.
|
||||
streamDeck.actions.registerAction(new SetStatus());
|
||||
streamDeck.actions.registerAction(new SetBrightness());
|
||||
streamDeck.actions.registerAction(new SetColor());
|
||||
|
||||
// Finally, connect to the Stream Deck.
|
||||
streamDeck.connect();
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"extends": "@tsconfig/node20/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"customConditions": [
|
||||
"node"
|
||||
],
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "Bundler",
|
||||
"noImplicitOverride": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 152 KiB |
|
Before Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 236 KiB |