Skip to content

Instantly share code, notes, and snippets.

@Udinic
Created January 19, 2021 17:44
Show Gist options
  • Save Udinic/fb9a9c4937df51f26ee888efe55f214f to your computer and use it in GitHub Desktop.
Save Udinic/fb9a9c4937df51f26ee888efe55f214f to your computer and use it in GitHub Desktop.
Tests a few automations for the Android TV
#!/bin/bash
# Usage:
# ./androidtv-tester <TV IP:5555> <option>
# Example:
# ./androidtv-tester 192.168.86.43:5555 2
adb_connect() {
adb connect $1
}
tv_night_mode_off() {
adb shell am start -n com.sony.dtv.configsettings/.PictureSettingActivity
adb shell input tap 1520 832
adb shell input tap 1520 312
adb shell input tap 1534 900
adb shell input keyevent 20
adb shell input keyevent 20
adb shell input tap 1534 900
adb shell am force-stop "com.sony.dtv.configsettings"
}
tv_night_mode_on() {
adb shell am start -n com.sony.dtv.configsettings/.PictureSettingActivity
adb shell input tap 1520 832
adb shell input tap 1520 312
adb shell input tap 1282 900
adb shell input keyevent 20
adb shell input keyevent 20
adb shell input tap 1282 900
adb shell am force-stop "com.sony.dtv.configsettings"
}
sleep_timer_30() {
adb shell am start -n com.sony.dtv.timers/com.sony.dtv.activity.TimersMainActivity
adb shell input tap 1520 311
adb shell input tap 1520 566
adb shell input keyevent 4
adb shell input keyevent 4
}
sleep_timer_45() {
adb shell am start -n com.sony.dtv.timers/com.sony.dtv.activity.TimersMainActivity
adb shell input tap 1520 311
adb shell input tap 1520 470
adb shell input keyevent 4
adb shell input keyevent 4
}
main() {
adb_connect $1
if [ "$2" = "1" ]; then
echo "1 - Night mode ON"
tv_night_mode_on
elif [ "$2" = "2" ]; then
echo "2 - Night mode OFF"
tv_night_mode_off
elif [ "$2" = "3" ]; then
echo "3 - Sleep timer 30 mins."
sleep_timer_30
elif [ "$2" = "4" ]; then
echo "4 - Sleep timer 45 mins."
sleep_timer_45
fi
}
if [ $# -eq 0 ]
then
echo "Usage: androidtv-tester.sh <TV IP:5555> <option>"
exit 1
fi
if [ -z "$2" ]
then
echo "Usage: androidtv-tester.sh <TV IP:5555> <option>"
echo "Select one of the options:"
echo "1 - Night mode ON"
echo "2 - Night mode OFF"
echo "3 - Sleep timer 30 mins."
echo "4 - Sleep timer 45 mins."
exit 1
fi
main $1 $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment