init - fan on/off works
This commit is contained in:
commit
0c91689f9e
77
remote
Executable file
77
remote
Executable file
@ -0,0 +1,77 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DEVICE="10.0.1.170:5555"
|
||||||
|
ADB="adb -s $DEVICE shell"
|
||||||
|
|
||||||
|
connect_device() {
|
||||||
|
if ! adb connect 10.0.1.170; then
|
||||||
|
echo "Failed to connect to device"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
launch_app() {
|
||||||
|
$ADB monkey -p com.tiqiaa.remote -c android.intent.category.LAUNCHER 1 > /dev/null 2>&1
|
||||||
|
sleep 1.5
|
||||||
|
}
|
||||||
|
|
||||||
|
tap() {
|
||||||
|
$ADB input tap $1 $2
|
||||||
|
sleep 1.5
|
||||||
|
}
|
||||||
|
|
||||||
|
open_menu() {
|
||||||
|
tap 10 50 # Adjust these coordinates for the menu button
|
||||||
|
}
|
||||||
|
|
||||||
|
select_device() {
|
||||||
|
case "$1" in
|
||||||
|
fan)
|
||||||
|
tap 20 150 # Adjust these coordinates for the fan option
|
||||||
|
;;
|
||||||
|
ac)
|
||||||
|
tap 20 250 # Adjust these coordinates for the AC option
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown device: $1"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
control_device() {
|
||||||
|
case "$1" in
|
||||||
|
power)
|
||||||
|
tap 30 200 # Adjust for power button
|
||||||
|
;;
|
||||||
|
speed)
|
||||||
|
tap 30 300 # Adjust for speed button
|
||||||
|
;;
|
||||||
|
mode)
|
||||||
|
tap 30 400 # Adjust for mode button
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown command: $1"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main script
|
||||||
|
connect_device
|
||||||
|
launch_app
|
||||||
|
|
||||||
|
# Check if enough arguments are provided
|
||||||
|
if [ "$#" -lt 2 ]; then
|
||||||
|
echo "Usage: $0 {fan|ac} {power|speed|mode}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Select device
|
||||||
|
open_menu
|
||||||
|
select_device "$1"
|
||||||
|
|
||||||
|
# Control device
|
||||||
|
control_device "$2"
|
||||||
|
|
||||||
|
echo "Command executed successfully"
|
Loading…
x
Reference in New Issue
Block a user