Devices & room
Use a room preset
POST
/api/room/presetAdmin. Needs an unlock token (
x-tempolight-token) while a PIN lock is set; without a lock, anyone can call it.Lays out the room from a ready-made layout, built for your controllers.
Request body application/json
idstringrequiredA preset id from presets in the state.
Responses
200OKapplication/json
namestringshapesobject[]zonesobject[]400The 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/room/preset' \
-H 'content-type: application/json' \
-d '{
"id": "fourwalls"
}'const res = await fetch("http://localhost:8080/api/room/preset", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"id": "fourwalls"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"http://localhost:8080/api/room/preset",
json={
"id": "fourwalls"
},
)
print(res.json())Response
{
"name": "My room",
"shapes": [
{
"type": "line",
"name": "Desk strip",
"count": 120,
"dev": "d4k2x9",
"rot": 0,
"start": 0,
"rev": false,
"from": null,
"zone": null,
"pts": [
[
1.5,
6
],
[
14.5,
6
]
]
}
],
"zones": []
}{
"error": "Unknown preset \"x\""
}{
"error": "Settings are locked. Unlock with the PIN in Settings."
}