Devices & room
Add a device
POST
/api/devicesAdmin. Needs an unlock token (
x-tempolight-token) while a PIN lock is set; without a lock, anyone can call it.Adds a controller by kind: WLED by address (its LED count is read from it), a virtual room, Govee, OpenRGB, Hue (press the link button first), Nanoleaf (hold the power button first), LIFX, WiZ, Kasa, Yeelight, Twinkly, or a DMX universe. It is placed in the room by itself. Answers the device; adding one that is already there answers that one.
Request body application/json
object
hoststringrequirednamestringddpPortintegerledsintegerforcebooleanAdd it even when it doesn't answer.
Responses
200OKapplication/json
idstringrequiredd…
namestringrequiredhoststringrequiredIts address (virtual for a virtual room).
kindstringLeft out for WLED.
One of
"govee" "openrgb" "hue" "nanoleaf" "lifx" "wiz" "kasa" "yeelight" "twinkly" "dmx"ledsintegerddpPortintegerenabledbooleanvirtualbooleanprotocolstringOne of
"ddp" "e131" "artnet"universeintegermaxAmpsnumber0 to 500mAperLednumber5 to 200goveeModestringOne of
"color" "segments"goveeSegmentsintegerlightLatencyMsintegerThis light's own delay set by hand, 0-500 ms (light timing). Left out: estimated.
0 to 500lightobjectSmart lights: what was found (for example zones) and their options.
hueobjectHue bridges only.
nanoleafobjectNanoleaf only.
fixturesobject[]DMX devices only.
healthobject | null400The body isn't valid JSON, or a value is wrong.application/json
errorstringrequiredWhat went wrong, in a sentence for people.
403Locked, or not allowed.application/json
errorstringrequiredWhat went wrong, in a sentence for people.
Request
curl -X POST 'http://localhost:8080/api/devices' \
-H 'content-type: application/json' \
-d '{
"host": "192.168.1.42",
"name": "Desk strip"
}'const res = await fetch("http://localhost:8080/api/devices", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"host": "192.168.1.42",
"name": "Desk strip"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"http://localhost:8080/api/devices",
json={
"host": "192.168.1.42",
"name": "Desk strip"
},
)
print(res.json())Response
{
"id": "d4k2x9",
"name": "Desk strip",
"host": "192.168.1.42",
"ddpPort": 4048,
"leds": 120,
"enabled": true
}{
"error": "Couldn't reach a WLED controller at 192.168.1.42 (timeout). Check the address, or add it anyway."
}{
"error": "Settings are locked. Unlock with the PIN in Settings."
}