nest api - How do i set temperature by using plain REST not firebase api -
i not find information on how set target temperature or set away mode. has gotten work?
https://developer-api.nest.com/devices.json?auth=asdasdasd
^ provides information how modify temperature or away mode??
keep auth in querystring, , put json-formatted change appropriate endpoint. eg (php):
to set target temperature:
$ch = curl_init("https://developer-api.nest.com/devices/thermostats/$thermostat_id?auth=$auth"); curl_setopt($ch, curlopt_customrequest, "put"); curl_setopt($ch, curlopt_postfields, '{"target_temperature_c": 21.5}'); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_returntransfer, 1); echo curl_exec($ch);
to set away mode:
$ch = curl_init("https://developer-api.nest.com/structures/$structure_id?auth=$auth"); curl_setopt($ch, curlopt_customrequest, "put"); curl_setopt($ch, curlopt_postfields, '{"away":"away"}'); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_returntransfer, 1); echo curl_exec($ch);
Comments
Post a Comment