コード例 #1
0
function getHeatingColor()
{
    if (isHeatingActive()) {
        return "label-warning";
    } else {
        return "label-default";
    }
}
コード例 #2
0
<?php

// manager.php
// Called every minuite via cron. Performs the logic to decide if heating should be turned on or off
chdir(dirname(__FILE__));
include "functions.php";
$heatingActive = isHeatingActive();
// Boost
$boostExit = "cancelled";
if (isBoostActive()) {
    $heatingBoost = true;
    if (getBoostRemaining() <= 0) {
        file_put_contents($logFile, date("d/m/y @ H:i") . " Boost Expired\n", FILE_APPEND);
        $boostExit = "expired";
        unlink("schedule/boost");
        $heatingBoost = false;
    }
} else {
    $heatingBoost = false;
}
// Timer
$now = date("N") - 1 . "-" . date("G") . "-" . floor(date("i") / 15) * 15;
if (file_exists("schedule/" . $now)) {
    $heating = true;
} else {
    $heating = false;
}
// Weather
$tempNow = getTemp();
$tempCold = getTempCold();
if ($tempNow <= $tempCold) {