Daemon API Reference¶
Binary: statuslightd
The daemon listens on a Unix domain socket (default /tmp/statuslight.sock) and exposes a JSON REST API.
Starting the Daemon¶
statuslightd # default socket
statuslightd --socket /tmp/statuslight.sock # custom socket
statuslightd --slack-token xoxp-... --slack-interval 30 # with Slack
Endpoints¶
GET /status¶
Returns current daemon state.
Response 200:
{
"device_connected": true,
"current_color": { "r": 255, "g": 0, "b": 0, "hex": "#FF0000" },
"slack_sync_enabled": false
}
When no device is connected, current_color is null.
POST /color¶
Set by preset name or hex string.
Request:
Response 200:
Response 400 (bad input):
Response 503 (no device):
POST /rgb¶
Set by exact RGB values.
Request:
Response 200:
POST /off¶
Turn off the light. No request body required.
Response 200:
GET /presets¶
List all available presets.
Response 200:
[
{ "name": "red", "hex": "#FF0000" },
{ "name": "green", "hex": "#00FF00" },
{ "name": "blue", "hex": "#0000FF" }
]
GET /devices¶
List connected Slicky devices.
Response 200:
[
{
"path": "DevSrvsID:4298190949",
"serial": "77971799",
"manufacturer": "Lexcelon",
"product": "Slicky-1.0"
}
]
GET /device-color¶
Read the current color directly from the device hardware (if the driver supports readback).
Query parameters:
| Param | Type | Description |
|---|---|---|
device |
string | Optional serial number to target a specific device |
Response 200 (readback supported):
Response 200 (readback not supported):
Response 500 (read failed):
Response 503 (no device):
GET /button-status¶
Get the current button-detected status.
Response 200:
{
"detected_preset": "busy",
"device_color": { "r": 255, "g": 0, "b": 0, "hex": "#FF0000" },
"polling_enabled": true,
"slack_sync": false
}
When no button-cycle color is active, detected_preset is null. When no color has been set, device_color is null.
Configuration: Button polling is controlled by the [button] section in config.toml:
[button]
enabled = true # Enable button polling (default: true)
poll_interval = 2 # Polling interval in seconds (default: 2)
slack_sync = false # Sync button status to Slack (default: false)
GET /slack/status¶
Get Slack integration status.
Response 200:
POST /slack/configure¶
Configure Slack integration.
Request:
{
"token": "xoxp-...",
"poll_interval_secs": 30,
"emoji_map": {
":no_entry:": "#FF0000",
":calendar:": "#FF4500",
":palm_tree:": "#808080"
}
}
All fields are optional — only provided fields are updated.
Response 200:
POST /slack/enable¶
Start Slack polling. A token must already be configured.
Response 200:
Response 400 (no token):
POST /slack/disable¶
Stop Slack polling.
Response 200:
Error Responses¶
All errors return a JSON body with an error field:
| Status | Meaning |
|---|---|
| 400 | Bad input (invalid color, unknown preset, missing token) |
| 500 | Internal error (HID communication failure) |
| 503 | Device not available |