3 for QUERY in `echo $QUERY_STRING | tr '&' ' '`; do
4 for VALUE in `echo $QUERY | tr '=' ' '`; do
5 if [ "$VALUE" == "id" ]; then
7 elif [ "$ID" == "?" ]; then
9 elif [ "$VALUE" == "power" ]; then
11 elif [ "$POWER" == "?" ]; then
13 elif [ "$VALUE" == "mobile" ]; then
16 elif [ "$VALUE" == "nofloat" ]; then
24 UNIXSOCK=/var/run/powersensordaemon/cmd.sock
25 VALID_ONOFF_IDS="regalleinwand labortisch bluebar couchred couchwhite all lichter ambientlights boiler"
26 VALID_SEND_IDS_CUSTOM_DISPLAY="ymhpoweroff ymhpower ymhvolup ymhvoldown"
27 VALID_SEND_IDS="ymhpoweron ymhcd ymhwdtv ymhtuner ymhaux ymhsattv ymhvolmute ymhmenu ymhplus ymhminus ymhtest ymhtimelevel ymheffect ymhprgup ymhprgdown ymhtunplus ymhtunminus ymhtunabcde ymhtape ymhvcr ymhextdec ymhsleep ymhp5 panicled blueled moviemode"
28 #VALID_BANSHEE_IDS="playPause next prev"
29 #VALID_CAM_MOTOR_IDS="c C w W"
31 [ "$POWER" == "send" ] && POWER=on
32 if [ "$POWER" == "on" -o "$POWER" == "off" ]; then
33 for CHECKID in $VALID_ONOFF_IDS $VALID_SEND_IDS $VALID_SEND_IDS_CUSTOM_DISPLAY; do
34 if [ "$CHECKID" == "$ID" ]; then
35 echo "power $POWER $ID" | usocket $UNIXSOCK
36 echo "Content-type: text/html"
40 echo "<title>Realraum rf433ctl</title>"
41 echo '<script type="text/javascript">window.location="http://slug.realraum.at/cgi-bin/switch.cgi";</script>'
47 for CHECKID in $VALID_BANSHEE_IDS; do
48 if [ "$CHECKID" == "$ID" ]; then
49 echo "$ID/" | nc wuerfel.realraum.at 8484
50 echo "Content-type: text/html"
54 echo "<title>Realraum rf433ctl</title>"
55 echo '<script type="text/javascript">window.location="http://slug.realraum.at/cgi-bin/switch.cgi";</script>'
61 for CHECKID in $VALID_CAM_MOTOR_IDS; do
62 if [ "$CHECKID" == "$ID" ]; then
63 echo "$ID" > /dev/ttyACM0
64 echo "Content-type: text/html"
68 echo "<title>Realraum rf433ctl</title>"
69 echo '<script type="text/javascript">window.location="http://slug.realraum.at/cgi-bin/switch.cgi";</script>'
76 DESC_regalleinwand="LEDs Regal Leinwand"
77 DESC_bluebar="Blaue LEDs Bar"
78 DESC_labortisch="Labortisch"
79 DESC_couchred="LEDs Couch Red"
80 DESC_couchwhite="LEDS Couch White"
81 DESC_ambientlights="Ambient Lichter"
82 DESC_boiler="Warmwasser Küche"
83 DESC_lichter="Alle Lichter"
85 DESC_ymhpoweron="Receiver On (off+tgl)"
86 DESC_ymhpoweroff="Receiver Off"
87 DESC_ymhpower="Receiver On/Off"
88 DESC_ymhvolup="VolumeUp"
89 DESC_ymhvoldown="VolumeDown"
91 DESC_ymhwdtv="Input S/PDIF Wuerfel"
92 DESC_ymhtuner="Input Tuner"
93 DESC_ymhvolmute="Mute"
98 DESC_ymhtimelevel="Time/Levels"
99 DESC_ymheffect="DSP Effect Toggle"
100 DESC_ymhprgup="DSP Up"
101 DESC_ymhprgdown="DSP Down"
102 DESC_ymhtunplus="Tuner +"
103 DESC_ymhtunminus="Tuner -"
104 DESC_ymhtunabcde="Tuner ABCDE"
107 DESC_ymhextdec="ExtDec Toggle"
108 DESC_seep="Sleep Modus"
109 DESC_panicled="HAL9000 says hi"
110 DESC_blueled="Blue Led"
111 DESC_moviemode="Movie Mode"
117 echo "Content-type: text/html"
121 echo "<title>Realraum rf433ctl</title>"
122 echo '<script type="text/javascript">'
123 echo 'function sendButton( onoff, btn )'
125 echo ' var req = new XMLHttpRequest();'
126 echo ' url = "http://slug.realraum.at/cgi-bin/switch.cgi?power="+onoff+"&id="+btn;'
127 echo ' req.open("GET", url ,false);'
128 echo ' //google chrome workaround'
129 echo ' req.setRequestHeader("googlechromefix","");'
130 echo ' req.send(null);'
132 [ "$NOFLOAT" == "1" ] && tail -n+6 /www/ymhremote.html | head -n 58
134 [ "$NOFLOAT" == "1" ] && tail -n+67 /www/ymhremote.html | head -n 37
136 echo 'div.switchbox {'
139 #echo ' max-width:236px;'
140 echo ' max-width:300px;'
141 echo ' font-size:10pt;'
142 echo ' border:1px solid black;'
143 #echo ' height: 32px;'
147 echo 'div.switchnameleft {'
148 echo ' width:12em; display:inline-block; vertical-align:middle; margin-left:3px;'
151 echo 'span.alignbuttonsright {'
152 echo ' top:0px; float:right; display:inline-block; text-align:right; padding:0;'
155 echo 'div.switchnameright {'
156 echo ' width:12em; display:inline-block; vertical-align:middle; float:right; display:inline-block; margin-left:1ex; margin-right:3px; margin-top:3px; margin-bottom:3px;'
159 echo 'span.alignbuttonsleft {'
160 echo ' float:left; text-align:left; padding:0;'
164 echo ' font-size:11pt;'
166 echo ' height: 32px;'
167 echo ' background-color: lime;'
172 echo ' font-size:11pt;'
174 echo ' height: 32px;'
175 echo ' background-color: red;'
180 echo ' font-size:11pt;'
182 echo ' height: 32px;'
183 #echo ' background-color: grey;'
189 #echo "<h1>Realraum rf433ctl</h1>"
190 #echo "<div style=\"float:left; border:1px solid black;\">"
191 echo "<div style=\"float:left;\">"
192 echo "<div style=\"float:left; border:1px solid black; margin-right:2ex; margin-bottom:2ex;\">"
193 for DISPID in $VALID_ONOFF_IDS; do
194 NAME="$(eval echo \$DESC_$DISPID)"
195 [ -z "$NAME" ] && NAME=$DISPID
197 echo "<div class=\"switchbox\">"
198 echo "<span class=\"alignbuttonsleft\">"
199 echo " <button class=\"onbutton\" onClick='sendButton(\"on\",\"$DISPID\");'>On</button>"
200 echo " <button class=\"offbutton\" onClick='sendButton(\"off\",\"$DISPID\");'>Off</button>"
202 echo "<div class=\"switchnameright\">$NAME</div>"
205 if [ "$NOFLOAT" == "1" ]; then
210 #Custom Buttons Start
211 echo "<div class=\"switchbox\">"
212 echo "<span class=\"alignbuttonsleft\">"
213 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhpower\");'>Tgl</button>"
214 echo " <button class=\"offbutton\" onClick='sendButton(\"on\",\"ymhpoweroff\");'>Off</button>"
216 echo "<div class=\"switchnameright\">Receiver Power</div>"
218 if [ "$NOFLOAT" == "1" ]; then
221 echo "<div class=\"switchbox\">"
222 echo "<span class=\"alignbuttonsleft\">"
223 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhvolup\");'>↑</button>"
224 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhvoldown\");'>↓</button>"
226 echo "<div class=\"switchnameright\">Receiver Volume</div>"
228 if [ "$NOFLOAT" == "1" ]; then
235 if [ "$MOBILE" != "1" ]; then
237 echo "<div style=\"float:left; border:1px solid black; margin-right:2ex; margin-bottom:2ex;\">"
241 for DISPID in $VALID_SEND_IDS; do
242 ITEMCOUNT=$((ITEMCOUNT+1))
243 NAME="$(eval echo \$DESC_$DISPID)"
244 [ -z "$NAME" ] && NAME=$DISPID
246 echo "<div class=\"switchbox\">"
247 echo "<span class=\"alignbuttonsleft\">"
248 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"$DISPID\");'> </button>"
250 echo "<div class=\"switchnameright\">$NAME</div>"
252 if [ "$NOFLOAT" == "1" -a $((ITEMCOUNT % 2 )) -ne 1 ]; then
257 echo '<div class="switchbox">Goto <a href="/ymhremote.html">Yamaha Receiver Remote</a></div>'
260 if [ "$NOFLOAT" == "1" ]; then
261 echo "<div style=\"float:left; border:1px solid black;\">"
262 tail -n+107 /www/ymhremote.html | head -n 5
266 echo "<div style=\"float:left; border:1px solid black; margin-top:5px;\">"
267 for DISPID in $VALID_BANSHEE_IDS $VALID_CAM_MOTOR_IDS; do
268 NAME="$(eval echo \$DESC_$DISPID)"
269 [ -z "$NAME" ] && NAME=$DISPID
271 echo "<div class=\"switchbox\">"
272 echo "<span class=\"alignbuttonsleft\">"
273 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"$DISPID\");'> </button>"
275 echo "<div class=\"switchnameright\">$NAME</div>"
277 if [ "$NOFLOAT" == "1" ]; then