Overview
Set the target temperature for your thermostat in heating or cooling mode.
Endpoint
POST https://nolongerevil.com/api/v1/thermostat/{deviceId}/temperature
Self-hosted? Use http://localhost:3000/api/v1/thermostat/{deviceId}/temperature
Authentication
Required Scopes: write
Authorization: Bearer nle_your_api_key_here
Request
Path Parameters
| Parameter | Type | Required | Description |
|---|
deviceId | string | Yes | Device ID from /devices endpoint |
Request Body
| Field | Type | Required | Description |
|---|
value | number | Yes | Target temperature |
mode | string | Yes | "heat" or "cool" |
scale | string | No | "C" (default) or "F" |
Example Request
{
"value": 72,
"mode": "heat",
"scale": "F"
}
Response
Success Response (200 OK)
{
"success": true,
"message": "Command handled",
"device": "02AA01AB01234567",
"object": "shared.02AA01AB01234567",
"revision": 153,
"timestamp": 1764026373459
}
Error Responses
400 Bad Request:
{
"error": "Temperature value must be a number"
}
401/403/429: See authentication docs.
Code Examples
curl -X POST https://nolongerevil.com/api/v1/thermostat/dev_abc123xyz/temperature \
-H "Authorization: Bearer nle_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"value": 72, "mode": "heat", "scale": "F"}'
Temperature Scale
- Celsius: Use
"scale": "C" (default)
- Fahrenheit: Use
"scale": "F"
The thermostat internally uses Celsius. If you provide Fahrenheit, it will be converted automatically.
Thermostats round to the nearest 0.5°C increment.
Use Cases
Schedule-Based Control
const schedule = [
{ time: '06:00', temp: 68 }, // Morning
{ time: '09:00', temp: 62 }, // Day (away)
{ time: '17:00', temp: 70 }, // Evening
{ time: '22:00', temp: 65 } // Night
];
schedule.forEach(({ time, temp }) => {
cron.schedule(time, () => {
setTemperature(deviceId, temp, 'heat', 'F');
});
});
Smart Adjustments
// Adjust based on outdoor temperature
const outdoorTemp = await getWeatherTemperature();
if (outdoorTemp < 32) {
await setTemperature(deviceId, 72, 'heat', 'F'); // Colder outside
} else {
await setTemperature(deviceId, 68, 'heat', 'F'); // Warmer outside
}
Next Steps