Initial commit

This commit is contained in:
2026-03-21 01:22:32 +01:00
parent d1c9e3f225
commit e95c8e75e9
75 changed files with 3783 additions and 1 deletions

103
streamdeck-plugin/README.md Normal file
View File

@@ -0,0 +1,103 @@
# 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
![v0.3.1.0 screenshot](img/v0.3.1.0.png)
## 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
![v0.3.0.0 screenshot](img/v0.3.0.0.png)
## 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
![v0.2.0.0 screenshot](img/v0.2.0.0.png)
## 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
![v0.1.0.0 screenshot](img/v0.1.0.0.png)

View File

@@ -0,0 +1,6 @@
# Node.js
node_modules/
# Stream Deck files
*.sdPlugin/bin
*.sdPlugin/logs

View File

@@ -0,0 +1,20 @@
{
// 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}/**"
]
}
]
}

View File

@@ -0,0 +1,17 @@
{
/* 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"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@@ -0,0 +1,80 @@
{
"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"
}

View File

@@ -0,0 +1,45 @@
<!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>

View File

@@ -0,0 +1,33 @@
<!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>

View File

@@ -0,0 +1,38 @@
<!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>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
{
"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"
}
}

View File

@@ -0,0 +1,49 @@
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;

View File

@@ -0,0 +1,58 @@
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;
};

View File

@@ -0,0 +1,57 @@
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;
};

View File

@@ -0,0 +1,40 @@
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;
};

View File

@@ -0,0 +1,16 @@
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();

View File

@@ -0,0 +1,17 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
"customConditions": [
"node"
],
"module": "ES2022",
"moduleResolution": "Bundler",
"noImplicitOverride": true
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB