From: Bernhard Tittelbach Date: Wed, 29 Oct 2014 18:59:43 +0000 (+0000) Subject: kiosk current files X-Git-Url: https://git.realraum.at/?p=svn42.git;a=commitdiff_plain;h=cdd9cf8f41352f1f707c53f464cd19be334c5578 kiosk current files --- diff --git a/raspberrypi_gpio_relay_licht/index.html b/raspberrypi_gpio_relay_licht/index.html index 5bf1fba..e99dc1f 100644 --- a/raspberrypi_gpio_relay_licht/index.html +++ b/raspberrypi_gpio_relay_licht/index.html @@ -1,5 +1,218 @@ - + + + + + + + +
Link to old switches
+
+
+
+
+
+
+ diff --git a/raspberrypi_gpio_relay_licht/indexz.html b/raspberrypi_gpio_relay_licht/indexz.html new file mode 100755 index 0000000..fa03ef3 --- /dev/null +++ b/raspberrypi_gpio_relay_licht/indexz.html @@ -0,0 +1,218 @@ + + + + + + + + + + +
+
+
+
+
+
+ + + diff --git a/raspberrypi_gpio_relay_licht/mswitch.cgi b/raspberrypi_gpio_relay_licht/mswitch.cgi index 08d1bcd..d62bce9 100755 --- a/raspberrypi_gpio_relay_licht/mswitch.cgi +++ b/raspberrypi_gpio_relay_licht/mswitch.cgi @@ -11,6 +11,7 @@ IDGPIOMAP[ceiling4]=17 IDGPIOMAP[ceiling5]=22 IDGPIOMAP[ceiling6]=21 GPIOPATH=/sys/class/gpio/gpio +SAVESTATE=/var/log/licht/mswitch.state for k v in ${(kv)IDGPIOMAP}; do GPIOIDMAP[$v]=$k @@ -44,6 +45,16 @@ print_gpio_state() { fi } +print_gpio_state_10() { + GPIO=${IDGPIOMAP[$1]} + GPIOVALUE=$(cat "${GPIOPATH}${GPIO}/value") + if [[ $GPIOVALUE == "0" ]]; then + echo -n "1" + else + echo -n "0" + fi +} + gpio_is_on() { GPIO=${IDGPIOMAP[$1]} GPIOVALUE=$(cat "${GPIOPATH}${GPIO}/value") @@ -61,9 +72,12 @@ for CHECKID in $VALID_ONOFF_IDS; do echo "$VAL" > "${GPIOPATH}${IDGPIOMAP[$CHECKID]}/value" fi GPIOSTATES+=(\"${CHECKID}\":"$(print_gpio_state $CHECKID)") + URISTATES+=("${CHECKID}=$(print_gpio_state_10 $CHECKID)") done JSON_STATE="{${(j:,:)GPIOSTATES}}" print ${(q)JSON_STATE} if ((#GPIOS > 0)); then print "[$(date +%s),\"$REMOTE_ADDR\",${(q)JSON_STATE}]," >> /var/log/licht/mswitch.log + echo -n "${(j:&:)URISTATES}">$SAVESTATE fi + diff --git a/raspberrypi_gpio_relay_licht/rc.local b/raspberrypi_gpio_relay_licht/rc.local index 254a556..33672c7 100644 --- a/raspberrypi_gpio_relay_licht/rc.local +++ b/raspberrypi_gpio_relay_licht/rc.local @@ -1,40 +1,41 @@ -#!/bin/sh -e -# -# rc.local -# -# This script is executed at the end of each multiuser runlevel. -# Make sure that the script will "exit 0" on success or any other -# value on error. -# -# In order to enable or disable this script just change the execution -# bits. -# -# By default this script does nothing. +#! /bin/sh +### BEGIN INIT INFO +# Provides: rc.local +# Required-Start: $all +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: Run /etc/rc.local if it exist +### END INIT INFO -for gpio in 4 17 18 21 22 23; do - echo $gpio > /sys/class/gpio/export - echo out > /sys/class/gpio/gpio$gpio/direction - chown www-data /sys/class/gpio/gpio$gpio/value -done +PATH=/sbin:/usr/sbin:/bin:/usr/bin -# Print the IP address -_IP=$(hostname -I) || true -if [ "$_IP" ]; then - printf "My IP address is %s\n" "$_IP" -fi +. /lib/init/vars.sh +. /lib/lsb/init-functions -MAX_TRIES=20 -if ! ifconfig eth0 && ifconfig wlan0 ; then - sleep 6 - while ((MAX_TRIES-- > 0)) && ! /sbin/wpa_cli status | grep -q wpa_state=COMPLETED; do - /sbin/wpa_cli status - ifdown wlan0 - ifup wlan0 - done -fi +do_start() { + if [ -x /etc/rc.local ]; then + [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)" + /etc/rc.local + ES=$? + [ "$VERBOSE" != no ] && log_end_msg $ES + return $ES + fi +} -su realraum -s /bin/sh -c "sleep 10 && /home/realraum/play-sound-status.py /home/realraum/play-sound-status.cfg &>/dev/null &" & -su realraum -s /bin/sh -c "sleep 10 && /home/realraum/stuff.py &>/dev/null &" & - -exit 0 +case "$1" in + start) + do_start + ;; + restart|reload|force-reload) + echo "Error: argument '$1' not supported" >&2 + exit 3 + ;; + stop) + ;; + *) + echo "Usage: $0 start|stop" >&2 + exit 3 + ;; +esac diff --git a/raspberrypi_gpio_relay_licht/realraumsimpel.png b/raspberrypi_gpio_relay_licht/realraumsimpel.png new file mode 100755 index 0000000..0b9cbb1 Binary files /dev/null and b/raspberrypi_gpio_relay_licht/realraumsimpel.png differ diff --git a/raspberrypi_gpio_relay_licht/realraumsimpelz.png b/raspberrypi_gpio_relay_licht/realraumsimpelz.png new file mode 100755 index 0000000..38e2904 Binary files /dev/null and b/raspberrypi_gpio_relay_licht/realraumsimpelz.png differ diff --git a/raspberrypi_gpio_relay_licht/style.css b/raspberrypi_gpio_relay_licht/style.css new file mode 100755 index 0000000..2560904 --- /dev/null +++ b/raspberrypi_gpio_relay_licht/style.css @@ -0,0 +1,70 @@ +body +{ + background-image:url("./realraumsimpel.png"); + background-repeat:no-repeat; +} + +#pc1 +{ + background-color:#f00; +} +.pc1 +{ + position:absolute; + height:122px; + width:122px; + top:370px; + left:697px; + background-color:#f00; + z-index:20; +} +.pc2 +{ + position:absolute; + height:122px; + width:122px; + top:142px; + left:697px; + background-color:#f00; + z-index:20; +} +.pc3 +{ + position:absolute; + height:122px; + width:122px; + top:370px; + left:402px; + background-color:#f00; + z-index:20; +} +.pc4 +{ + position:absolute; + height:122px; + width:122px; + top:142px; + left:402px; + background-color:#f00; + z-index:20; +} +.pc5 +{ + position:absolute; + height:122px; + width:122px; + top:370px; + left:127px; + background-color:#f00; + z-index:20; +} +.pc6 +{ + position:absolute; + height:122px; + width:122px; + top:142px; + left:127px; + background-color:#f00; + z-index:20; +} diff --git a/raspberrypi_gpio_relay_licht/stylez.css b/raspberrypi_gpio_relay_licht/stylez.css new file mode 100755 index 0000000..96a87fb --- /dev/null +++ b/raspberrypi_gpio_relay_licht/stylez.css @@ -0,0 +1,70 @@ +body +{ + background-image:url("./realraumsimpelz.png"); + background-repeat:no-repeat; +} + +#pc1 +{ + background-color:#f00; +} +.pc1 +{ + position:absolute; + height:122px; + width:122px; + top:370px; + left:697px; + background-color:#f00; + z-index:20; +} +.pc2 +{ + position:absolute; + height:122px; + width:122px; + top:142px; + left:697px; + background-color:#f00; + z-index:20; +} +.pc3 +{ + position:absolute; + height:122px; + width:122px; + top:370px; + left:402px; + background-color:#f00; + z-index:20; +} +.pc4 +{ + position:absolute; + height:122px; + width:122px; + top:142px; + left:402px; + background-color:#f00; + z-index:20; +} +.pc5 +{ + position:absolute; + height:122px; + width:122px; + top:370px; + left:127px; + background-color:#f00; + z-index:20; +} +.pc6 +{ + position:absolute; + height:122px; + width:122px; + top:142px; + left:127px; + background-color:#f00; + z-index:20; +} diff --git a/raspberrypi_gpio_relay_licht/switch.cgi b/raspberrypi_gpio_relay_licht/switch.cgi index d4e3683..5ff6ac6 100755 --- a/raspberrypi_gpio_relay_licht/switch.cgi +++ b/raspberrypi_gpio_relay_licht/switch.cgi @@ -183,12 +183,12 @@ fi #Pattern1 echo "
" -echo -n " " -echo -n " " -echo -n " " -echo -n " " -echo -n " " -echo -n " " +echo -n " " +echo -n " " +echo -n " " +echo -n " " +echo -n " " +echo -n " " echo "
" if [ "$NOFLOAT" = "1" ]; then diff --git a/raspberrypi_gpio_relay_licht/switch.html b/raspberrypi_gpio_relay_licht/switch.html new file mode 100644 index 0000000..5bf1fba --- /dev/null +++ b/raspberrypi_gpio_relay_licht/switch.html @@ -0,0 +1,5 @@ + + + + +