diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..48025db --- /dev/null +++ b/changelog.txt @@ -0,0 +1,24 @@ +--------------------------- + PiSwitch - Changelog +--------------------------- + +V 1.2 +- Bezeichnung frei wälbar +- Lichterkette hinzugefügt + +--------------------------- + +V 1.1 +- Genauigkeit verbessert +- Footer angepasst +- Parameter hinzugefügt + +--------------------------- + +V 1.0 +- erste Version +- Footer hinzugefügt +- Buttons formatiert +- Layout optimiert + +--------------------------- diff --git a/config.php b/config.php new file mode 100644 index 0000000..896347c --- /dev/null +++ b/config.php @@ -0,0 +1,9 @@ + diff --git a/images/favicon.ico b/images/favicon.ico new file mode 100644 index 0000000..d9f51de Binary files /dev/null and b/images/favicon.ico differ diff --git a/images/pi.png b/images/pi.png new file mode 100644 index 0000000..f9c8c59 Binary files /dev/null and b/images/pi.png differ diff --git a/images/switch_off.png b/images/switch_off.png new file mode 100644 index 0000000..5aa0894 Binary files /dev/null and b/images/switch_off.png differ diff --git a/images/switch_on.png b/images/switch_on.png new file mode 100644 index 0000000..8fcd58d Binary files /dev/null and b/images/switch_on.png differ diff --git a/index.php b/index.php new file mode 100644 index 0000000..2a3cd89 --- /dev/null +++ b/index.php @@ -0,0 +1,129 @@ + + + + PiSwitch + + + + + + + + + +

PiSwitch - Interface + +

+ +

+

+ + + + +
+ +

+ +

+

+ + + + +
+

+ +

+

+ + + + +

+ +

+ + + + + +

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
BezeichnungStatus
+ +
+ + + + + +

+ +

+ + diff --git a/name.php b/name.php new file mode 100644 index 0000000..5849d8a --- /dev/null +++ b/name.php @@ -0,0 +1,10 @@ + diff --git a/param.php b/param.php new file mode 100644 index 0000000..c916b0c --- /dev/null +++ b/param.php @@ -0,0 +1,52 @@ + diff --git a/script/10.sh b/script/10.sh new file mode 100644 index 0000000..ef754d9 --- /dev/null +++ b/script/10.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +sudo rm status/status_01; +sudo touch status/status_01; +sudo echo "0" >> status/status_01; \ No newline at end of file diff --git a/script/11.sh b/script/11.sh new file mode 100644 index 0000000..3dff5e4 --- /dev/null +++ b/script/11.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +sudo rm status/status_01; +sudo touch status/status_01; +sudo echo "1" >> status/status_01; \ No newline at end of file diff --git a/script/20.sh b/script/20.sh new file mode 100644 index 0000000..c0d8de9 --- /dev/null +++ b/script/20.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +sudo rm status/status_02; +sudo touch status/status_02; +sudo echo "0" >> status/status_02; \ No newline at end of file diff --git a/script/21.sh b/script/21.sh new file mode 100644 index 0000000..af3834a --- /dev/null +++ b/script/21.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +sudo rm status/status_02; +sudo touch status/status_02; +sudo echo "1" >> status/status_02; \ No newline at end of file diff --git a/script/30.sh b/script/30.sh new file mode 100644 index 0000000..d69eeb4 --- /dev/null +++ b/script/30.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +sudo rm status/status_03; +sudo touch status/status_03; +sudo echo "0" >> status/status_03; \ No newline at end of file diff --git a/script/31.sh b/script/31.sh new file mode 100644 index 0000000..0b7f7cb --- /dev/null +++ b/script/31.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +sudo rm status/status_03; +sudo touch status/status_03; +sudo echo "1" >> status/status_03; \ No newline at end of file diff --git a/script/buttons.py b/script/buttons.py new file mode 100644 index 0000000..295c7a9 --- /dev/null +++ b/script/buttons.py @@ -0,0 +1,33 @@ +import RPi.GPIO as GPIO +import time +import os + +GPIO.setmode(GPIO.BCM) +GPIO.setwarnings(False) + +GPIO.setup(14,GPIO.IN,pull_up_down=GPIO.PUD_UP) +GPIO.setup(15,GPIO.IN,pull_up_down=GPIO.PUD_UP) +GPIO.setup(18,GPIO.IN,pull_up_down=GPIO.PUD_UP) + +while True: + input_state1 = GPIO.input(14) + input_state2 = GPIO.input(15) + input_state3 = GPIO.input(18) + if input_state1 == False: + print('Button 1, Steckdose 1 an') + time.sleep(1.5) + os.system("sh 11.sh") + if input_state2 == False: + print('Button 2, Steckdose 2 an') + os.system("sh 21.sh") + time.sleep(1.5) + if input_state3 == False: + print('Button 3, Steckdose 3 an') + os.system("sh 31.sh") + time.sleep(1.5) + + +#s01 = open("status_01.txt", "r") +#s01.close + +#print s01 diff --git a/script/kette0.sh b/script/kette0.sh new file mode 100644 index 0000000..a1452d1 --- /dev/null +++ b/script/kette0.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +pin="8" + +echo $pin > /sys/class/gpio/export +echo "out" > /sys/class/gpio/gpio$pin/direction +echo "0" > /sys/class/gpio/gpio$pin/value + +sudo rm status/status_04; +sudo touch status/status_04; +sudo echo "0" >> status/status_04; + diff --git a/script/kette1.sh b/script/kette1.sh new file mode 100644 index 0000000..6615be2 --- /dev/null +++ b/script/kette1.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +pin="8" + +echo $pin > /sys/class/gpio/export +echo "out" > /sys/class/gpio/gpio$pin/direction +echo "1" > /sys/class/gpio/gpio$pin/value + +sudo rm status/status_04; +sudo touch status/status_04; +sudo echo "1" >> status/status_04; + diff --git a/status.php b/status.php new file mode 100644 index 0000000..9ba114c --- /dev/null +++ b/status.php @@ -0,0 +1,6 @@ + diff --git a/status/status_01 b/status/status_01 new file mode 100644 index 0000000..573541a --- /dev/null +++ b/status/status_01 @@ -0,0 +1 @@ +0 diff --git a/status/status_02 b/status/status_02 new file mode 100644 index 0000000..573541a --- /dev/null +++ b/status/status_02 @@ -0,0 +1 @@ +0 diff --git a/status/status_03 b/status/status_03 new file mode 100644 index 0000000..573541a --- /dev/null +++ b/status/status_03 @@ -0,0 +1 @@ +0 diff --git a/status/status_04 b/status/status_04 new file mode 100644 index 0000000..573541a --- /dev/null +++ b/status/status_04 @@ -0,0 +1 @@ +0 diff --git a/style.css b/style.css new file mode 100644 index 0000000..9415749 --- /dev/null +++ b/style.css @@ -0,0 +1,128 @@ +body { + background:linear-gradient(45deg ,white, #A4C67D) no-repeat center center fixed; + margin-left:100px; + margin-right: 100px; + } + +h1 { + font-size:250%; + font-family:Helvetica; + border-bottom:solid thin black; + } + +div.status { + margin-top:50px; + } + +td { + text-align: center; + font-family:Helvetica; + } + +th { + text-align: center; + font-family:Helvetica; + font-size: 13px; + font-weight:900; + } + +tbody tr:hover { + background: lightgreen; + color: white; + } + + +.switchoff{ + -moz-box-shadow:inset 0px 1px 0px 0px #f7c5c0; + -webkit-box-shadow:inset 0px 1px 0px 0px #f7c5c0; + box-shadow:inset 0px 1px 0px 0px #f7c5c0; + background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #fc8d83), color-stop(1, #e4685d)); + background:-moz-linear-gradient(top, #fc8d83 5%, #e4685d 100%); + background:-webkit-linear-gradient(top, #fc8d83 5%, #e4685d 100%); + background:-o-linear-gradient(top, #fc8d83 5%, #e4685d 100%); + background:-ms-linear-gradient(top, #fc8d83 5%, #e4685d 100%); + background:linear-gradient(to bottom, #fc8d83 5%, #e4685d 100%); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fc8d83', endColorstr='#e4685d',GradientType=0); + background-color:#fc8d83; + -moz-border-radius:6px; + -webkit-border-radius:6px; + border-radius:6px; + border:1px solid #d83526; + display:inline-block; + cursor:pointer; + color:#ffffff; + font-family:Helvetica; + font-size:15px; + font-weight:bold; + padding:6px 24px; + text-decoration:none; + text-shadow:0px 1px 0px #b23e35; +} +.switchoff:hover { + background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #e4685d), color-stop(1, #fc8d83)); + background:-moz-linear-gradient(top, #e4685d 5%, #fc8d83 100%); + background:-webkit-linear-gradient(top, #e4685d 5%, #fc8d83 100%); + background:-o-linear-gradient(top, #e4685d 5%, #fc8d83 100%); + background:-ms-linear-gradient(top, #e4685d 5%, #fc8d83 100%); + background:linear-gradient(to bottom, #e4685d 5%, #fc8d83 100%); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e4685d', endColorstr='#fc8d83',GradientType=0); + background-color:#e4685d; +} +.switchoff:active { + position:relative; + top:1px; +} + + +.switchon{ + -moz-box-shadow:inset 0px 1px 0px 0px #d9fbbe; + -webkit-box-shadow:inset 0px 1px 0px 0px #d9fbbe; + box-shadow:inset 0px 1px 0px 0px #d9fbbe; + background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #b8e356), color-stop(1, #a5cc52)); + background:-moz-linear-gradient(top, #b8e356 5%, #a5cc52 100%); + background:-webkit-linear-gradient(top, #b8e356 5%, #a5cc52 100%); + background:-o-linear-gradient(top, #b8e356 5%, #a5cc52 100%); + background:-ms-linear-gradient(top, #b8e356 5%, #a5cc52 100%); + background:linear-gradient(to bottom, #b8e356 5%, #a5cc52 100%); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#b8e356', endColorstr='#a5cc52',GradientType=0); + background-color:#b8e356; + -moz-border-radius:6px; + -webkit-border-radius:6px; + border-radius:6px; + border:1px solid #83c41a; + display:inline-block; + cursor:pointer; + color:#ffffff; + font-family:Helvetica; + font-size:15px; + font-weight:bold; + padding:6px 24px; + text-decoration:none; + text-shadow:0px 1px 0px #86ae47; +} +.switchon:hover { + background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #a5cc52), color-stop(1, #b8e356)); + background:-moz-linear-gradient(top, #a5cc52 5%, #b8e356 100%); + background:-webkit-linear-gradient(top, #a5cc52 5%, #b8e356 100%); + background:-o-linear-gradient(top, #a5cc52 5%, #b8e356 100%); + background:-ms-linear-gradient(top, #a5cc52 5%, #b8e356 100%); + background:linear-gradient(to bottom, #a5cc52 5%, #b8e356 100%); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#a5cc52', endColorstr='#b8e356',GradientType=0); + background-color:#a5cc52; +} +.switchon:active { + position:relative; + top:1px; +} + +#footer { + position:absolute; + bottom: 0; + width: 100%; + background-color: #CFCFCF; + height: 4em; + text-align: center; + left:0; right:0; bottom:0; + font-family: Helvetica; + font-size: 11px; +} diff --git a/switch.php b/switch.php new file mode 100644 index 0000000..c6df161 --- /dev/null +++ b/switch.php @@ -0,0 +1,74 @@ +alert('$name1 angeschalten');"; + echo ""; +} + +if(isset($_POST['sent10'])){ + shell_exec('sudo '.$path.'/./send '.$code.' 1 0'); + shell_exec('sudo '.$path.'/./send '.$code.' 1 0'); + shell_exec('sudo script/10.sh'); + echo ""; + echo ""; +} + +if(isset($_POST['sent21'])){ + shell_exec('sudo '.$path.'/./send '.$code.' 2 1'); + shell_exec('sudo '.$path.'/./send '.$code.' 2 1'); + shell_exec('sudo script/21.sh'); + echo ""; + echo ""; +} + +if(isset($_POST['sent20'])){ + shell_exec('sudo '.$path.'/./send '.$code.' 2 0'); + shell_exec('sudo '.$path.'/./send '.$code.' 2 0'); + shell_exec('sudo script/20.sh'); + echo ""; + echo ""; +} + +if(isset($_POST['sent31'])){ + shell_exec('sudo '.$path.'/./send '.$code.' 3 1'); + shell_exec('sudo '.$path.'/./send '.$code.' 3 1'); + shell_exec('sudo script/31.sh'); + echo ""; + echo ""; +} + +if(isset($_POST['sent30'])){ + shell_exec('sudo '.$path.'/./send '.$code.' 3 0'); + shell_exec('sudo '.$path.'/./send '.$code.' 3 0'); + shell_exec('sudo script/30.sh'); + echo ""; + echo ""; +} + + +if(isset($_POST['kette1'])){ + shell_exec('sudo script/kette1.sh'); + echo ""; + echo ""; +} + +if(isset($_POST['kette0'])){ + shell_exec('sudo script/kette0.sh'); + echo ""; + echo ""; +} + +?>