-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmmsetb.sh
More file actions
executable file
·31 lines (28 loc) · 708 Bytes
/
mmsetb.sh
File metadata and controls
executable file
·31 lines (28 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#
# Set the MagicMirror brightness setting
#
IP="MM.M.M.MM"
PORT=8080
apikey="xxx_Remote-Control-API-Key_xxxxx"
usage() {
echo "Usage: mmsetb [number]"
echo "Where 'number' is an integer value in the range 0-200"
exit 1
}
[ "$1" ] || usage
if [ "$1" -ge 0 ] && [ "$1" -le 200 ]
then
usejq=`type -p jq`
if [ "$usejq" ]
then
curl -X GET http://${IP}:${PORT}/api/brightness/$1?apiKey=${apikey} 2> /dev/null | jq .
else
curl -X GET http://${IP}:${PORT}/api/brightness/$1?apiKey=${apikey}
echo ""
fi
else
echo "Brightness setting $1 out of range or not a number"
echo "Valid brightness values are integer values [0-200]"
usage
fi