forked from sagen/hue-upnp
-
Notifications
You must be signed in to change notification settings - Fork 10
/
hue-upnp-helper.sh
executable file
·104 lines (82 loc) · 1.94 KB
/
hue-upnp-helper.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
#examples:
#./hue-upnp-helper.sh "Wemo Light" on true
#./hue-upnp-helper.sh "hue light 2" xy [0.4544,0.511]
#./hue-upnp-helper.sh "My toaster" ct 396
#./hue-upnp-helper.sh "PC WOL" bri 254
echo "$0 called with '$1' '$2' '$3'"
DEVICE1="PC WOL"
DEVICE2="Wemo Outlet"
DEVICE3="Wemo Light"
#HUE LIGHT 1 (DEVICE1)
if [ "$1" == "$DEVICE1" ]; then
echo "Running directive for $DEVICE1"
#ON/OFF Directive
if [ "$2" == "on" ]; then
if [ "$3" == "true" ]; then
echo 1 on true
#INSERTING WAKEONLAN
wakeonlan 11:22:33:44:55:66
elif [ "$3" == "false" ]; then
echo 1 on false
fi
#BRIGHTNESS
elif [ "$2" == "bri" ]; then
echo 1 bri $3
#CT
elif [ "$2" == "ct" ]; then
echo 1 ct $3
#XY
elif [ "$2" == "xy" ]; then
echo 1 xy $3
fi
#HUE LIGHT 2 (DEVICE2)
elif [ "$1" == "$DEVICE2" ]; then
echo "Running directive for $DEVICE2"
#ON/OFF Directive
if [ "$2" == "on" ]; then
if [ "$3" == "true" ]; then
echo 2 on true
#INSERTING WEMO-ON COMMAND
./wemo_control.sh 192.168.1.110 ON
elif [ "$3" == "false" ]; then
echo 2 on false
#INSERTING WEMO-OFF COMMAND
./wemo_control.sh 192.168.1.110 OFF
fi
#BRIGHTNESS
elif [ "$2" == "bri" ]; then
echo 2 bri $3
#CT
elif [ "$2" == "ct" ]; then
echo 2 ct $3
#XY
elif [ "$2" == "xy" ]; then
echo 2 xy $3
fi
#HUE LIGHT 3 (DEVICE3)
elif [ "$1" == "$DEVICE3" ]; then
echo "Running directive for $DEVICE3"
#ON/OFF Directive
if [ "$2" == "on" ]; then
if [ "$3" == "true" ]; then
echo 3 on true
./wemo_control.sh 192.168.1.111 ON
elif [ "$3" == "false" ]; then
echo 3 on false
./wemo_control.sh 192.168.1.111 OFF
fi
#BRIGHTNESS
elif [ "$2" == "bri" ]; then
echo 3 bri $3
#CT
elif [ "$2" == "ct" ]; then
echo 3 ct $3
#XY
elif [ "$2" == "xy" ]; then
echo 3 xy $3
fi
else
echo "Error: Unknown Device '$1' command=$2 $3"
exit 1
fi