setFanMode() public method

public setFanMode ( $mode, $serial_number = null )
Esempio n. 1
0
// Note: setting temperatures will use the units you set on the device. I'm using celsius on my device, so I'm using celsius here.
$success = $nest->setTargetTemperature(26);
var_dump($success);
echo "Setting target temperatures (range)...\n";
$success = $nest->setTargetTemperatures(23.0, 26.0);
var_dump($success);
echo "Setting target temperature mode...\n";
$success = $nest->setTargetTemperatureMode(TARGET_TEMP_MODE_COOL, 26.0);
// Available: TARGET_TEMP_MODE_COOL, TARGET_TEMP_MODE_HEAT, TARGET_TEMP_MODE_RANGE
var_dump($success);
echo "Setting target temperature mode (range)...\n";
$success = $nest->setTargetTemperatureMode(TARGET_TEMP_MODE_RANGE, array(23.0, 26.0));
// Available: TARGET_TEMP_MODE_COOL, TARGET_TEMP_MODE_HEAT, TARGET_TEMP_MODE_RANGE
var_dump($success);
echo "Setting fan mode...\n";
$success = $nest->setFanMode(FAN_MODE_ON);
// Available: FAN_MODE_AUTO or FAN_MODE_EVERY_DAY_OFF, FAN_MODE_ON or FAN_MODE_EVERY_DAY_ON
// setFanMode() can also take an array as it's argument. See the comments below for examples (FAN_MODE_TIMER, FAN_MODE_MINUTES_PER_HOUR).
var_dump($success);
echo "Setting fan mode: on with timer (15 minutes)...\n";
$success = $nest->setFanModeOnWithTimer(FAN_TIMER_15M);
// Available: FAN_TIMER_15M, FAN_TIMER_30M, FAN_TIMER_45M, FAN_TIMER_1H, FAN_TIMER_2H, FAN_TIMER_4H, FAN_TIMER_8H, FAN_TIMER_12H
//$success = $nest->setFanMode(array(FAN_MODE_TIMER, 900)); // Same as above. See the FAN_TIMER_* defines for the possible values.
var_dump($success);
echo "Canceling timer that was just set...\n";
$success = $nest->cancelFanModeOnWithTimer();
var_dump($success);
echo "Setting fan mode to 30 minutes per hour...\n";
$success = $nest->setFanModeMinutesPerHour(FAN_MODE_MINUTES_PER_HOUR_30);
// 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.
Esempio n. 2
0
        $exttemp = $nest->temperatureInCelsius($locations[0]->outside_temperature);
        // Drop target humidity 5% for every 5degree C drop below 0
        $target = max(0, $maxhumidity + $exttemp);
        $target = round(min($target, $maxhumidity, 60));
        if (abs($target - $infos->target->humidity) >= 1) {
            // Target humidity has changed
            $nest->setHumidity(intval($target));
        }
    }
    //-------------------------------------------circulation mode-------------------------------------------------------------------------
    // If circulate air mode is allowed, check to see if inside temp is over setpoint by 1.4 (circbuffer) degrees and that all other criteria are met. Enable fan until criteria are not met.
    if ($circmode == true and $low_target_temp + $circbuffer - $infos->current_state->temperature <= 0 and round($low_target_temp) >= $circtemp and $infos->current_state->fan == 0 and $infos->current_state->temperature - $circobuffer > $locations[0]->outside_temperature) {
        $nest->setFanModeOnWithTimer(FAN_TIMER_15M);
        //run fan for 15 minutes
    } else {
        $nest->setFanMode(FAN_MODE_AUTO);
        //set fan back to auto.
    }
} elseif ($datatype === 'daily') {
    //Used to get Nest energy reports. Includes 10 days of data.
    $energy = $nest->getEnergyLatest();
    //Loop through the array of days and get the data for eac day
    $yesterday_date = date("Y-m-d", time() - 60 * 60 * 24);
    //calculate yesterday's date. We can't get degree days for today.
    $days = $energy->objects[0]->value->days;
    //print_r($weather);//Print array of days to browser for debug purposes
    foreach ($days as $day) {
        //We can only get degree days for yesterday or older.
        $active_date = date("Ymd", strtotime($day->day));
        //Change date format for weather underground api
        //print_r($active_date);//Print active date for debug purposes