Modifying scripts for VPN detection.
[pingpong.git] / automation / clickers.sh
1 #!/bin/bash
2
3 # This script does clicking action automatically
4 # We just need to set up the timer duration
5
6 # Parameters:
7 # $1 : device identification (run "adb devices" to figure out)
8 #
9 # Command:
10 # ./clickers.sh <device-identification>
11
12 # Loop variables
13 BEGIN=1
14 END=100
15 #END=4
16 INC=1
17 DEVICE=$1
18
19 # Range of random number (in seconds)
20 RAN_STA=100
21 RAN_END=200
22
23 for ((i=$BEGIN; i<=$END; i+=$INC));
24 do
25         
26         date +"%m/%d/%Y %r"
27         #./adb -s "$DEVICE" shell getevent -l - use this command to get the position
28         # Click on screen
29         #./adb -s "$DEVICE" shell input tap 500 1500
30         # TP-Link switch
31         #./adb -s "$DEVICE" shell input tap 1002 913
32         # TP-Link bulb on/off
33         #./adb -s "$DEVICE" shell input tap 994 560
34         # D-Link switch
35         #./adb -s "$DEVICE" shell input tap 987 346
36         # D-Link motion sensor
37         #./adb -s "$DEVICE" shell input tap 975 840
38         # SmartThings plug
39         #./adb -s "$DEVICE" shell input tap 921 1188
40         #./adb -s "$DEVICE" shell input tap 533 653
41         # WeMo, WeMo Insight, LiFX bulbs, Hue bulbs with ST-app
42         ./adb -s "$DEVICE" shell input tap 533 653
43         # WeMo
44         #./adb -s "$DEVICE" shell input tap 981 532
45         # WeMo Insight
46         #./adb -s "$DEVICE" shell input tap 981 326
47         # Kwikset doorlock
48         #if (( $i % 2 ))
49         #then
50                 # locking
51         #       ./adb -s "$DEVICE" shell input tap 153 1211
52         #else
53                 # unlocking
54         #       ./adb -s "$DEVICE" shell input tap 520 1211
55         #fi
56         # Hue bulb
57         #./adb -s "$DEVICE" shell input tap 923 383
58         # Lifx bulb
59         #./adb -s "$DEVICE" shell input tap 506 580
60         # Amcrest camera
61         #if (( $i % 2 ))
62         #then
63                 # live view
64         #       ./adb -s "$DEVICE" shell input tap 92 139
65         #       ./adb -s "$DEVICE" shell input tap 92 139
66         #else
67                 # stop live view (go to playback)
68         #       ./adb -s "$DEVICE" shell input tap 92 139
69         #       ./adb -s "$DEVICE" shell input tap 92 250
70         #fi
71         # Arlo camera
72         #if (( $i % 2 ))
73         #then
74                 # live view
75                 #./adb -s "$DEVICE" shell input tap 532 740
76         #       ./adb -s "$DEVICE" shell input tap 533 653
77         #else
78                 # stop live view
79                 #./adb -s "$DEVICE" shell input tap 101 1012
80         #       ./adb -s "$DEVICE" shell input tap 533 653
81         #       ./adb -s "$DEVICE" shell input tap 533 653
82         #       ./adb -s "$DEVICE" shell input tap 533 653
83         #fi
84         # Blossom
85         #if (( $i % 2 ))
86         #then
87                 # start watering
88         #       ./adb -s "$DEVICE" shell input tap 538 1597
89         #else
90                 # stop watering
91         #       ./adb -s "$DEVICE" shell input tap 496 1533
92         #fi
93         # Dlink siren
94         #./adb -s "$DEVICE" shell input tap 994 802
95         # Nest thermostat
96         #if (( $i % 2))
97         #then
98                 # start fan
99         #       ./adb -s "$DEVICE" shell input tap 524 1668
100         #       ./adb -s "$DEVICE" shell input tap 936 1709
101         #else
102                 # stop fan
103         #       ./adb -s "$DEVICE" shell input tap 524 1668
104         #       ./adb -s "$DEVICE" shell input tap 679 1702
105         #fi
106         # Alexa
107         #if (( $i % 2))
108         #then
109                 # Using Google Translate and 
110                 #       having her speak to Alexa
111                 # Question 1
112         #        ./adb -s "$DEVICE" shell input tap 907 145
113         #        ./adb -s "$DEVICE" shell input tap 543 692
114         #       ./adb -s "$DEVICE" shell input tap 148 775
115         #else
116                 # Question 2
117         #        ./adb -s "$DEVICE" shell input tap 907 145
118         #        ./adb -s "$DEVICE" shell input tap 463 1668
119         #       ./adb -s "$DEVICE" shell input tap 148 775
120         #fi
121         #date +%r
122         #RAND=$[( $RANDOM % $RAN_END ) + $RAN_STA]
123         #RAND=$[`jot -r 1 $RAN_STA $RAN_END`]
124         #echo "Delay: $RAND seconds"
125         #sleep $[$RAND]s
126
127         # TP-Link bulb - change colors
128         #if (( $i % 2 ))
129         #then
130                 # color 1 - horizontal
131                 #./adb -s "$DEVICE" shell input tap 250 1000
132                 # color 3 - vertical
133         #        ./adb -s "$DEVICE" shell input tap 500 1250
134         #else
135                 # color 2 - horizontal
136                 #./adb -s "$DEVICE" shell input tap 750 1000
137                 # color 4 - vertical
138         #        ./adb -s "$DEVICE" shell input tap 500 750
139         #fi
140         
141         # pick a prime number > 120 seconds
142         sleep 131s
143         #sleep 53s
144 done