Nest::setAutoAwayEnabled PHP Method

setAutoAwayEnabled() public method

public setAutoAwayEnabled ( $enabled, $serial_number = null )
    public function setAutoAwayEnabled($enabled, $serial_number = null)
    {
        $serial_number = $this->getDefaultSerial($serial_number);
        $data = json_encode(array('auto_away_enable' => $enabled));
        return $this->doPOST("/v2/put/device." . $serial_number, $data);
    }

Usage Example

Esempio n. 1
0
// Available: FAN_MODE_MINUTES_PER_HOUR_15, FAN_MODE_MINUTES_PER_HOUR_30, FAN_MODE_MINUTES_PER_HOUR_45, FAN_MODE_MINUTES_PER_HOUR_ALWAYS_ON
//$success = $nest->setFanMode(array(FAN_MODE_MINUTES_PER_HOUR, 1800)); // Same as above. See the FAN_MODE_MINUTES_PER_HOUR_* defines for the possible values.
var_dump($success);
echo "Setting fan mode to run every day, but only between 5am and 10pm...\n";
$success = $nest->setFanEveryDaySchedule(5, 22);
// Send 0,0 to run all day long
var_dump($success);
echo "Turning system off...\n";
$success = $nest->turnOff();
var_dump($success);
echo "Setting away mode...\n";
$success = $nest->setAway(AWAY_MODE_ON);
// Available: AWAY_MODE_ON, AWAY_MODE_OFF
var_dump($success);
echo "Enabling (Nest Sense) Auto-Away...\n";
$success = $nest->setAutoAwayEnabled(true);
var_dump($success);
echo "Setting dual-fuel breakpoint (use alternative heat when the outdoor temperature is below -5°)...\n";
// Note: when using temperatures, it will use the units you set on the device. I'm using celsius on my device, so I'm using celsius here.
$success = $nest->setDualFuelBreakpoint(-5);
// Available: DUALFUEL_BREAKPOINT_ALWAYS_PRIMARY, DUALFUEL_BREAKPOINT_ALWAYS_ALT, or a temperature between -12°C and 9°C (10-50°F)
var_dump($success);
echo "----------\n\n";
sleep(1);
echo "Device information:\n";
$infos = $nest->getDeviceInfo();
jlog($infos);
echo "----------\n\n";
echo "Device schedule:\n";
// Returns as array, one element for each day of the week for which there has at least one scheduled event.
// Array keys are a textual representation of a day, three letters, as returned by `date('D')`. Array values are arrays of scheduled temperatures, including a time (in minutes after midnight), and a mode (one of the TARGET_TEMP_MODE_* defines).