update();
$error_string = "";
$lastSeenTimeStr = date("H:i:s, Y-m-d",($light->getClientLastSeen()));
$lastSeenTimeDiff = (time()-$light->getClientLastSeen());
// route actions
if (isset($_GET['action'])) {
if ($_GET['action'] == 'enlighten') {
// set off time to now + 15 minutes
$light->times['instant-on'] = time() + (15*60);
if ($light->saveTimes() === true) {
header('Location: index.php?success=true');
} else {
$error_string = "Error saving config file";
}
} else if ($_GET['action'] == 'update') {
if (isset($_POST) && !empty($_POST)) {
// parse form data
$parse_state = checkTimesInput($_POST);
if ($parse_state === true) {
// change values of $times arrays
$light->times['time1']['on'] = $_POST['time1-start'];
$light->times['time1']['off'] = $_POST['time1-stop'];
$light->times['time2']['on'] = $_POST['time2-start'];
$light->times['time2']['off'] = $_POST['time2-stop'];
$light->times['time3']['on'] = $_POST['time3-start'];
$light->times['time3']['off'] = $_POST['time3-stop'];
// save new $times array
$light->saveTimes();
header('Location: index.php?success=true');
} else {
$error_string = $parse_state;
}
} else {
$error_string = "ERROR: no form data received";
}
} else {
echo "invalid action\n";
}
}
?>
Lightscontrol Control Interface
Garagenlicht
Licht: |
state) ? 'EINGESCHALTET'
: 'AUSGESCHALTET';?> |
Änderung in: |
changeTime === 1) ? $light->changeTime." Minute" : $light->changeTime." Minuten" ?> |
Licht temporär an (15 Min)
weitere Informationen:
Sonnenaufgang: | sunrise ?> |
Sonnenuntergang: | sunset ?> |
Aktuelle Zeit: | |
Nacht (ja/nein): | isNight) ? "ja" : "nein" ?> |
Client Last Seen: | ;
vor Min:Sek |
Einstellungen