#!/bin/sh for QUERY in `echo $QUERY_STRING | tr '&' ' '`; do for VALUE in `echo $QUERY | tr '=' ' '`; do if [ "$VALUE" == "id" ]; then ID='?' elif [ "$ID" == "?" ]; then ID=$VALUE elif [ "$VALUE" == "power" ]; then POWER='?' elif [ "$POWER" == "?" ]; then POWER=$VALUE elif [ "$VALUE" == "mobile" ]; then MOBILE='1' NOFLOAT='1' elif [ "$VALUE" == "nofloat" ]; then NOFLOAT='1' fi i=$i+1 done done GPIOPATH=/sys/class/gpio/gpio #VALID_ONOFF_IDS="7 18 20 29" VALID_ONOFF_IDS="7 18 20" VALID_SEND_IDS="" print_gpio_state() { GPIOVALUE=$(cat "${GPIOPATH}${1}/value") if [ "$GPIOVALUE" = "1" ]; then echo "ON" else echo "Off" fi } gpio_is_on() { GPIOVALUE=$(cat "${GPIOPATH}${1}/value") [ "$GPIOVALUE" = "1" ] } if [ "$POWER" == "1" -o "$POWER" == "0" ]; then for CHECKID in $VALID_ONOFF_IDS ; do if [ "$CHECKID" == "$ID" ]; then echo "$POWER" > "${GPIOPATH}${ID}/value" echo "Content-type: text/html" echo "" echo "" echo "" echo "Realraum Relay Switch" echo '' echo "" exit 0 fi done fi DESC_7="Decke Links Vorne" DESC_20="Decke Rechts Vorne" DESC_18="Decke Rechts Mitte" #DESC_29="GPIO Nicht Belegt" echo "Content-type: text/html" echo "" echo "" echo "" echo "Realraum Relay Power" echo '' echo '' echo "" echo "" #echo "

Realraum rf433ctl

" #echo "
" echo "
" echo "
" for DISPID in $VALID_ONOFF_IDS; do NAME="$(eval echo -n \$DESC_$DISPID)" [ -z "$NAME" ] && NAME=$DISPID echo "
" echo "" if gpio_is_on $DISPID; then echo " " echo " " else echo " " echo " " fi echo "" echo -n "
$NAME
" # echo -n "
$NAME (" # print_gpio_state $DISPID # echo ")
" echo "
" if [ "$NOFLOAT" == "1" ]; then echo "
" fi done echo "
" echo "" echo -n " " echo -n " " echo "" echo -n "
Alle
" echo "
" if [ "$NOFLOAT" == "1" ]; then echo "
" fi echo "
" if [ "$MOBILE" != "1" -a -n "$VALID_SEND_IDS" ]; then echo "
" ITEMCOUNT=0 for DISPID in $VALID_SEND_IDS; do ITEMCOUNT=$((ITEMCOUNT+1)) NAME="$(eval echo \$DESC_$DISPID)" [ -z "$NAME" ] && NAME=$DISPID echo "
" echo "" echo " " echo "" echo "
$NAME
" echo "
" if [ "$NOFLOAT" == "1" -a $((ITEMCOUNT % 2 )) -ne 1 ]; then echo "
" fi done echo "
" fi echo "
" echo "" echo ""