init III
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
require "func.php";
|
||||
require "config.php";
|
||||
|
||||
if (isset($_GET["action"])) {
|
||||
# Status lesen
|
||||
if ($_GET["action"] === "getstatus") {
|
||||
$state = load('state.php');
|
||||
for ($i=0; $i<$switches; $i++) {
|
||||
$j=$i+1;
|
||||
echo "$j:'$state[$i]';";
|
||||
}
|
||||
}
|
||||
|
||||
# Last state change lesen
|
||||
if ($_GET["action"] === "getchanged") {
|
||||
if (file_exists("changed")) {
|
||||
echo "changed";
|
||||
} else {
|
||||
echo "unchanged";
|
||||
}
|
||||
unlink ("changed");
|
||||
}
|
||||
|
||||
if ($_GET["action"] === "setstatus") {
|
||||
$a=['', '', '', '', '', ''];
|
||||
for ($i=0; $i < $switches; $i++) {
|
||||
$j=$i+1;
|
||||
if ($_GET["oos$j"] === "on") {
|
||||
$a[$i]="checked";
|
||||
}
|
||||
}
|
||||
save("state.php", $a);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$switches = 6;
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
function load($path)
|
||||
{
|
||||
return require $path;
|
||||
}
|
||||
|
||||
function save($path, $array)
|
||||
{
|
||||
$content = '<?php' . PHP_EOL . 'return ' . var_export($array, true) . ';';
|
||||
return is_numeric(file_put_contents($path, $content));
|
||||
}
|
||||
|
||||
160
Perl Ubiquiti mpower steuerung/control center/template/index.php
Normal file
160
Perl Ubiquiti mpower steuerung/control center/template/index.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
|
||||
<head>
|
||||
<title>power.andregeissler.de</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="refresh" content="30">
|
||||
<link rel="shortcut icon" href="images/favicon.ico">
|
||||
<style type="text/css">
|
||||
/* <![CDATA[ */
|
||||
.onoffswitch {
|
||||
position: relative; width: 100px;
|
||||
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
|
||||
}
|
||||
.onoffswitch-checkbox {
|
||||
display: none;
|
||||
}
|
||||
.onoffswitch-label {
|
||||
display: block; overflow: hidden; cursor: pointer;
|
||||
border: 2px solid #999999; border-radius: 20px;
|
||||
}
|
||||
.onoffswitch-inner {
|
||||
display: block; width: 200%; margin-left: -100%;
|
||||
-moz-transition: margin 0.3s ease-in 0s; -webkit-transition: margin 0.3s ease-in 0s;
|
||||
-o-transition: margin 0.3s ease-in 0s; transition: margin 0.3s ease-in 0s;
|
||||
}
|
||||
.onoffswitch-inner:before, .onoffswitch-inner:after {
|
||||
display: block; float: left; width: 50%; height: 35px; padding: 0; line-height: 35px;
|
||||
font-size: 15px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
|
||||
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
|
||||
}
|
||||
.onoffswitch-inner:before {
|
||||
content: "AN";
|
||||
padding-left: 10px;
|
||||
background-color: #00FF00; color: #000000;
|
||||
}
|
||||
.onoffswitch-inner:after {
|
||||
content: "AUS";
|
||||
padding-right: 10px;
|
||||
background-color: #FF0000; color: #000000;
|
||||
text-align: right;
|
||||
}
|
||||
.onoffswitch-switch {
|
||||
display: block; width: 20px; margin: 7.5px;
|
||||
background: #FFFFFF;
|
||||
border: 2px solid #999999; border-radius: 20px;
|
||||
position: absolute; top: 0; bottom: 0; right: 61px;
|
||||
-moz-transition: all 0.3s ease-in 0s; -webkit-transition: all 0.3s ease-in 0s;
|
||||
-o-transition: all 0.3s ease-in 0s; transition: all 0.3s ease-in 0s;
|
||||
}
|
||||
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
|
||||
margin-left: 0;
|
||||
}
|
||||
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
|
||||
right: 0px;
|
||||
}
|
||||
input[type=submit] {padding:5px 10px; background:#ccc; none;
|
||||
cursor:pointer;
|
||||
-webkit-border-radius: 5px;
|
||||
border: 2px solid #999999;
|
||||
border-radius: 20px;
|
||||
height: 35px;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
/* ]]> */
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require "config.php";
|
||||
require "func.php";
|
||||
if (isset($_GET[device])) {
|
||||
$name=$_GET[device];
|
||||
}
|
||||
if($_POST["save"] === "yes") {
|
||||
$a=['', '', '', '', '', ''];
|
||||
for ($i=0; $i < $switches; $i++) {
|
||||
$j=$i+1;
|
||||
if ($_POST["oos$j"] === "on") {
|
||||
$a[$i]="checked";
|
||||
}
|
||||
}
|
||||
for ($i=0; $i < $switches; $i++) {
|
||||
$l[]=$_POST["ool$i"];
|
||||
}
|
||||
save("label.php", $l);
|
||||
save("state.php", $a);
|
||||
save("changed", "1");
|
||||
file_put_contents("timer", $_POST['timerareacontent']);
|
||||
}
|
||||
$state = load("state.php");
|
||||
$label = load("label.php");
|
||||
$timerfilecontent = file_get_contents("timer");
|
||||
?>
|
||||
|
||||
<form action="index.php?device=<?php echo $name ?>" method="post">
|
||||
<table border="0" width="300px">
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<?php print "<b>$name</b>"; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Port</td>
|
||||
<td>Beschreibung</td>
|
||||
<td align="center">Zustand</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
for ($i = 0; $i < $switches; $i++) {
|
||||
$j=$i+1;
|
||||
echo "
|
||||
<tr>
|
||||
<td>
|
||||
$j
|
||||
</td>
|
||||
<td>
|
||||
<input type='text' size='15' name='ool$i' value='$label[$i]'>
|
||||
</td>
|
||||
<td align='center'>
|
||||
<div class='onoffswitch'>
|
||||
<input type='checkbox' name='oos$j' class='onoffswitch-checkbox' id='myonoffswitch$j' $state[$i]>
|
||||
<label class='onoffswitch-label' for='myonoffswitch$j'>
|
||||
<span class='onoffswitch-inner'></span>
|
||||
<span class='onoffswitch-switch'></span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td></td><td></td>
|
||||
<td align="center">
|
||||
<input type="submit" value="Speichern"/>
|
||||
<input type="hidden" name="device" value="<?php echo $name ?>">
|
||||
<input type="hidden" name="save" value="yes">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<textarea name="timerareacontent" cols="45" rows="29">
|
||||
<?php echo "$timerfilecontent"; ?>
|
||||
</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<form action="/index.php" method="post" target="_top">
|
||||
<input type="hidden" name="delete" value="yes">
|
||||
<input type="hidden" name="path" value="<?php echo dirname(__FILE__)?>">
|
||||
<input type="submit" value="Entfernen"/>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
return array (
|
||||
0 => 'Port 1',
|
||||
1 => 'Port 2',
|
||||
2 => 'Port 3',
|
||||
3 => 'Port 4',
|
||||
4 => 'Port 5',
|
||||
5 => 'Port 6',
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
return array (
|
||||
0 => 'checked',
|
||||
1 => 'checked',
|
||||
2 => 'checked',
|
||||
3 => 'checked',
|
||||
4 => 'checked',
|
||||
5 => 'checked',
|
||||
);
|
||||
55
Perl Ubiquiti mpower steuerung/control center/template/timer
Normal file
55
Perl Ubiquiti mpower steuerung/control center/template/timer
Normal file
@@ -0,0 +1,55 @@
|
||||
###START
|
||||
# Ausgang,on|off,hh:mm|always
|
||||
# bsp
|
||||
# 6,off,00:00
|
||||
# 6,on,00:01
|
||||
# 1,on,always
|
||||
|
||||
# usb (1)
|
||||
1,on,always
|
||||
|
||||
# Werkzeuge (2)
|
||||
|
||||
# licht (3)
|
||||
|
||||
# Trockner (4)
|
||||
4,off,02:00
|
||||
|
||||
# Temperatur (5)
|
||||
5,on,always
|
||||
|
||||
# Port ohne Gerät, Nachts für eine Minute abschalten (6)
|
||||
6,off,00:00
|
||||
6,on,00:01
|
||||
|
||||
# auto on/off Frühschicht
|
||||
#3,on,05:00
|
||||
#4,on,05:00
|
||||
#3,off,05:30
|
||||
#4,off,05:30
|
||||
#3,on,15:30
|
||||
#4,on,15:30
|
||||
#3,off,16:30
|
||||
#4,off,16:30
|
||||
|
||||
# auto on/off Mittelschicht
|
||||
3,on,07:25
|
||||
4,on,07:25
|
||||
3,off,07:40
|
||||
4,off,07:40
|
||||
3,on,17:40
|
||||
4,on,17:40
|
||||
3,off,18:20
|
||||
4,off,18:20
|
||||
|
||||
# auto on/off Spätschicht
|
||||
#3,on,11:00
|
||||
#4,on,11:00
|
||||
#3,off,11:30
|
||||
#4,off,11:30
|
||||
#3,on,21:40
|
||||
#4,on,21:40
|
||||
#3,off,22:20
|
||||
#4,off,22:20
|
||||
|
||||
###ENDE
|
||||
Reference in New Issue
Block a user