The TV works normally until you tap Lock on your phone. Then YouTube, Hotstar, Netflix and the other video apps are paused, casting from phones stops, and the TV goes to its home screen. It stays that way, even after the TV restarts, until you tap Unlock. No app is installed on the TV; the phone talks to it over your Wi-Fi using Android's own debugging link (ADB).
What Lock doesThree ways to control itPrepare the TVFix the IP addressesPhone setup with TermuxCommandsAway from homeOther TV brandsLimits
What Lock does
- Pauses the video apps: YouTube, Hotstar, SonyLIV, Prime Video, ZEE5, JioCinema, Netflix, MX Player, the TV's own video and USB media players. A paused app shows "app paused" and cannot be switched back on from the TV's Settings.
- Pauses the Play Store, so no new video app can be installed meanwhile.
- Switches off Chromecast and screen mirroring, so nobody can cast from a phone.
- Stops whatever is playing and returns to the home screen.
Unlock brings everything back exactly as it was. Apps the TV doesn't have are skipped. If a TV doesn't allow pausing, the script disables the app instead and says so.
Three ways to control it
| From | How | Needs |
|---|---|---|
| Phone | home_lock.sh in Termux, with one-tap home-screen buttons | Phone on the home Wi-Fi |
| Phone browser | Lock / Unlock on the FocusGuard home page | The children's PC on, with FocusGuard |
| Windows PC | tv_lock.bat lock or unlock | adb (platform-tools) on that PC |
If you use FocusGuard too, home_lock.sh goes through the PC when it is on, so the phones and the PC share one lock state. When the PC is off, the phone locks the TV directly. Without FocusGuard, it simply talks to the TV directly every time (TV-only mode).
1 · Prepare the TV (once)
- On the TV: Settings › Device Preferences › About, then click Build seven times until it says you are a developer. (On some TVs it is Settings › System › About.)
- Go back to Device Preferences › Developer options and turn on USB debugging. On some models there is also Network debugging or ADB over network: turn that on too.
- Note the TV's IP address: Settings › Network & Internet › your Wi-Fi.
- The first time the phone (or PC) connects, the TV shows Allow USB debugging?. Tick Always allow from this computer and press OK with the remote. Each phone or PC is asked once.
2 · Fix the IP addresses on the router
The phone finds the TV (and the children's PC) by IP address, so those must not change after a restart. Instead of setting a static IP on each device, reserve it on the router; nothing changes on the TV or PC.
- Open the router page in a browser, usually
192.168.1.1or192.168.0.1. The login is often on a sticker under the router. - Find DHCP › Address Reservation (also called Static Lease, DHCP Binding or IP & MAC Binding).
- Add the TV's MAC address with its current IP, and the same for the children's PC (on the PC,
ipconfig /allshows the Physical Address). Save, and reboot the router if it asks.
Step-by-step guide, with how to read IP and MAC from the router's device list and where the menu sits on common routers: Fixed IP addresses for home devices.
3 · Phone setup with Termux (Android)
Termux is a free Linux terminal app for Android. It runs adb, the same tool a PC uses to talk to the TV, so your phone can lock the TV directly, even with the PC switched off. Termux:Widget turns the commands into one-tap buttons on the home screen, so day to day you never type anything. Do this on each parent's phone.
- Install Termux and Termux:Widget from F-Droid (f-droid.org), or both from GitHub releases. Don't mix sources, and don't use the Play Store Termux: it is outdated and will not work with the widget.
- Download
home_lock.shon the phone (the button at the top of this page). It lands in Downloads. - Open the script in any text editor app, or in Termux with
nanoafter step 4, and change the two lines under CHANGE THESE TWO LINES:TV="<TV-IP>:5555", andPC="<PC-IP>:8765"if you use FocusGuard. - Open Termux and run these one at a time. Tap Allow when Android asks for storage access:
Ifpkg update pkg install android-tools curl termux-setup-storage cp ~/storage/downloads/home_lock.sh ~/ bash ~/home_lock.sh setupcpsays the file is missing, runls ~/storage/downloads | grep -i lock. The phone may have renamed it (for examplehome_lock.sh.txt); use that name in thecpline. - Setup asks for the FocusGuard parent PIN. With FocusGuard, type it (it is saved in a file only Termux can read). Without FocusGuard, just press Enter: you get TV-only mode.
- Pair with the TV: run
bash ~/home_lock.sh status. When it says Look at the TV, tick Always allow on the TV and press OK. It waits up to 60 seconds. - Add the buttons: long-press an empty spot on the home screen › Widgets › Termux:Widget. If it asks for permission, open Termux:Widget once from the app list, and allow "Display over other apps" for Termux if Android asks.
| Button | What it does |
|---|---|
| 1_TV_Lock / 2_TV_Unlock | Lock or unlock the TV (through the PC if it is on, otherwise directly). Takes about 30–60 seconds; the TV must be on. |
| 3_PC_Study_30 / 4_PC_Study_60 | Give each child 30 or 60 minutes of study time on the PC (FocusGuard only) |
| 5_PC_Stop | End the study time now (FocusGuard only) |
| 6_Status | TV locked or not, and each child: signed in, study time left |
Typed commands
bash ~/home_lock.sh status
bash ~/home_lock.sh tv lock | tv unlock | tv status
bash ~/home_lock.sh pc give 45 # 45 min for every child
bash ~/home_lock.sh pc give 45 kid1 # one child only
bash ~/home_lock.sh pc stop | pc status
bash ~/home_lock.sh setup # change the PIN, remake buttons
From a Windows PC
Put tv_lock.bat in C:\platform-tools next to adb.exe, set TV= at the top, and run tv_lock.bat lock or tv_lock.bat unlock.
Away from home
Termux reaches the TV on its home-Wi-Fi address, so the buttons work only at home. To use them from outside, install Tailscale (a free private VPN) on the TV and the phones with the same account, while the TV is unlocked. Then put the TV's Tailscale address (100.x.y.z) in the TV= line. Test once from mobile data; some TVs stop background apps in standby.
Other TV brands
The app list is for a Xiaomi Mi TV in India, but the method works on most Android TV and Google TV sets (Sony, TCL, OnePlus, Realme, Hisense with Google TV and others). To adjust the lists for your TV, connect from a PC and list its apps:
adb connect <TV-IP>:5555
adb shell pm list packages | findstr /i "video youtube netflix prime hotstar cast"
Add or remove names in the APPS list (video apps) and SERVICES list (casting) near the top of the script. Fire TV sticks also accept adb, but their app names differ. Samsung (Tizen) and LG (webOS) TVs are not Android, so this script does not work on them.
Optional: clean up a Mi TV
tv_clean.bat switches off Xiaomi's clutter and tracking apps (Mi TV+, Mi channels, analytics, auto-install, Mi Music, Gallery, recommendations) over Wi-Fi from a PC. Run tv_clean.bat, then reboot the TV. tv_clean.bat restore turns everything back on.
Leave these alone: com.mi.bluetooth (the remote stops working), mitv.service, droidlogic packages, tv.settings, systemui, and katniss (voice search). A factory reset or big firmware update may bring the clutter back; run it again then.
Limits
- It cannot block a set-top box, game console or anything on HDMI. Only apps on the TV itself.
- The TV must be on (or in network standby) when you press Lock. Once locked, it stays locked when switched off.
- A factory reset of the TV removes the lock and the pairing.
- If your TV falls back to disabled instead of paused, someone who knows where to look could re-enable the apps in Settings › Apps. Status shows which method was used.
- Tested on a Xiaomi Mi TV with Android TV 11. Test Lock and Unlock once on your own TV before relying on it.