Overview
Set the target temperature for your thermostat in heating or cooling mode.
Endpoint
POST https://nolongerevil.com/api/v1/thermostat/{deviceId}/temperature
Hosted service only. This endpoint is part of the hosted API at https://nolongerevil.com/api/v1 and requires an nle_ API key. It is not available on the self-hosted server.
Authentication
Required Scopes : write
Authorization: Bearer nle_your_api_key_here
Request
Path Parameters
Parameter Type Required Description deviceIdstring Yes Device ID from /devices endpoint
Request Body
Field Type Required Description valuenumber Yes Target temperature modestring Yes "heat" or "cool"scalestring 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
Set Temperature Range Set range for heat-cool mode
Get Status Check current temperature
Set Away Mode Enable energy-saving mode