");} if ($debug) {echo "
DEBUG ENABLED
!!!!do not use debug parameter WHEN CODE IS IN PRODUCTION !!!!
";} if ($debug) {echo "read = -".$read."-
";} if ($debug) {echo "setTmp = -".$setTmp."-
";} if ($debug) {echo "setAway = -".$setAway."-
";} if ($debug) {echo "
";} // -------------------------------------------------------------------------- // actions if ($setTmp != NULL) { // var_dump($setTmp); // $success = $nest->setTargetTemperature(20.5); if ($debug) { $infos = $nest->getDeviceInfo(); echo "setTmp to ".$setTmp."°".$infos->scale." - success : ".$success."
"; } } // Get the device information: $infos = $nest->getDeviceInfo(); // display $infos raw content for dev purpose if ($debug) {print_r($infos);} if ($debug) {echo "
";} if ($debug) {echo "
";} if ($debug) {var_dump($infos);} if ($debug) {echo "
";} /* strucutre de $infos [current_state] => stdClass Object [mode] => heat | off | heat,auto-eco,away [temperature] => 20.73999 [backplate_temperature] => 20.73999 [humidity] => 42 [ac] => [heat] => 1 [alt_heat] => [fan] => [hot_water] => [auto_away] => -1 [manual_away] => | 1 [structure_away] => | 1 [leaf] => [battery_level] => 3.954 [active_stages] => stdClass Object [heat] => stdClass Object [stage1] => 1 [stage2] => [stage3] => [alt] => [alt_stage2] => [aux] => [emergency] => [cool] => stdClass Object [stage1] => [stage2] => [stage3] => [eco_mode] => schedule [eco_temperatures_assist_enabled] => 1 [eco_temperatures] => stdClass Object [low] => 16.15352 [high] => [target] => stdClass Object [mode] => heat | off [temperature] => 21 [time_to_target] => 0 [sensors] => stdClass Object [all] => Array ( ) [active] => Array ( ) [active_temperatures] => Array ( ) [serial_number] => xxxxxxxxxxxxxxxx [scale] => C [location] => df915920-c2a3-11e4-9221-22000b4b8cc7 [network] => stdClass Object [online] => 1 [last_connection] => 2020-02-15 18:39:32 [last_connection_UTC] => 2020-02-15 17:39:32 [wan_ip] => /xxx.xxx.xxx.xxx [local_ip] => xxx.xxx.xxx.xxx [mac_address] => xxxxxxxxxxxx [name] => Nest Living [auto_cool] => [auto_heat] => 19 [where] => Séjour ) */ echo "
".$infos->name." - ".$infos->where."

"; if ($read == NULL or $read == 'temperature') { // Current temperature echo "Current temperature : ".$infos->current_state->temperature."°".$infos->scale."
"; } if ($read == NULL or $read == 'humidity') { // Current humidity echo "Current humidity : ".$infos->current_state->humidity."%
"; } if ($read == NULL or $read == 'target') { // Target temperature echo "Target temperature : ".$infos->target->temperature."°".$infos->scale."
"; } if ($read == NULL or $read == 'eco') { // Eco temperature echo "Eco temperature : ".$infos->current_state->eco_temperatures->low."°".$infos->scale."
"; } if ($read == NULL or $read == 'mode') { // Target mode echo "Target mode : ".$infos->target->mode."
"; } if ($read == NULL or $read == 'away') { // Away mode echo "Away mode : "; if ($infos->current_state->manual_away == "") { echo "Present
"; } else { echo "Away
"; } } // setTmp echo "
Set the target temperature to : "; echo "15 - "; echo "15.5 - "; echo "16 - "; echo "16.5 - "; echo "17 - "; echo "17.5 - "; echo "18 - "; echo "18.5 - "; echo "19 - "; echo "19.5 - "; echo "20 - "; echo "20.5 - "; echo "21 - "; echo "21.5 - "; echo "22 - "; echo "22.5 - "; echo "23 - "; echo "23.5 - "; echo "24 - "; echo "24.5 - "; echo "25 "; echo "°".$infos->scale."
"; ?>