Overview
Change the HVAC operating mode between heat, cool, heat-cool (auto), or off.
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.
Endpoint
POST https://nolongerevil.com/api/v1/thermostat/{deviceId}/mode
Authentication
Required Scopes : write
Request Body
Field Type Required Description modestring Yes "heat", "cool", "heat-cool", or "off"
Response
Success (200 OK):
{
"success" : true ,
"message" : "Command handled" ,
"device" : "02AA01AB01234567" ,
"object" : "shared.02AA01AB01234567" ,
"revision" : 155 ,
"timestamp" : 1764026377395
}
HVAC Modes
Mode Description heatHeating only - maintains minimum temperature coolCooling only - maintains maximum temperature heat-coolAuto mode - maintains temperature range offSystem off - no heating or cooling
When switching to heat-cool mode, use the Set Temperature Range endpoint to configure the temperature range.
Code Examples
curl -X POST https://nolongerevil.com/api/v1/thermostat/dev_abc123xyz/mode \
-H "Authorization: Bearer nle_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"mode": "heat-cool"}'
async function setMode ( deviceId , mode ) {
const response = await fetch (
`https://nolongerevil.com/api/v1/thermostat/ ${ deviceId } /mode` ,
{
method: 'POST' ,
headers: {
'Authorization' : 'Bearer nle_your_api_key_here' ,
'Content-Type' : 'application/json'
},
body: JSON . stringify ({ mode })
}
);
return await response . json ();
}
// Usage
await setMode ( 'dev_abc123xyz' , 'heat' );
def set_mode ( device_id , mode ):
response = requests.post(
f 'https://nolongerevil.com/api/v1/thermostat/ { device_id } /mode' ,
headers = { 'Authorization' : 'Bearer nle_your_api_key_here' },
json = { 'mode' : mode}
)
response.raise_for_status()
return response.json()
Use Cases
Seasonal Mode Switching
// Switch to cooling for summer
if ( month >= 5 && month <= 9 ) {
await setMode ( deviceId , 'cool' );
} else {
await setMode ( deviceId , 'heat' );
}
Energy Saving
// Turn off HVAC when nobody's home
if ( awayMode ) {
await setMode ( deviceId , 'off' );
}
Next Steps
Set Temperature Set target temperature
Set Temperature Range Configure heat-cool range