From: Bernhard Tittelbach Date: Tue, 22 Oct 2013 23:49:35 +0000 (+0000) Subject: update and display button/light state X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=9ecce64a6cab6656eb5701ac48d03145a24ab5b4;p=svn42.git update and display button/light state --- diff --git a/router_gpio_relay_licht/mswitch.cgi b/router_gpio_relay_licht/mswitch.cgi index 94176ce..c389c38 100755 --- a/router_gpio_relay_licht/mswitch.cgi +++ b/router_gpio_relay_licht/mswitch.cgi @@ -46,11 +46,11 @@ for CHECKID in $VALID_ONOFF_IDS; do if [ $VAL == 1 -o $VAL == 0 ]; then echo "$VAL" > "${GPIOPATH}${CHECKID}/value" fi - echo -n "$CHECKID:" + echo -n "\"$CHECKID\":" print_gpio_state $CHECKID echo "," done -echo "-1:false}" +echo "\"-1\":false}" # echo "" # echo "" # echo "Realraum Relay Switch" diff --git a/router_gpio_relay_licht/switch.cgi b/router_gpio_relay_licht/switch.cgi index 926b941..01dce98 100755 --- a/router_gpio_relay_licht/switch.cgi +++ b/router_gpio_relay_licht/switch.cgi @@ -24,6 +24,7 @@ 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") @@ -40,7 +41,7 @@ gpio_is_on() { } if [ "$POWER" == "1" -o "$POWER" == "0" ]; then - for CHECKID in $VALID_ONOFF_IDS ; do + for CHECKID in $VALID_ONOFF_IDS ; do if [ "$CHECKID" == "$ID" ]; then echo "$POWER" > "${GPIOPATH}${ID}/value" echo "Content-type: text/html" @@ -66,10 +67,43 @@ echo "" echo "" echo "Realraum Relay Power" echo '