Home remote app ("Nate's Remote") — how it actually works
Technical reference for the owner: what the Android remote app is, which part runs where, why it works at home, why it cannot work off the home network today, and the realistic options for changing that. Verified against the code and live services.
What it is
One Android app — "Nate's Remote" (com.example.atvremote, built with
Jetpack Compose + Chaquopy) — that drives three boxes from your S23
Ultra:
| # | Device | Address | How it's controlled |
|---|---|---|---|
| 1 | Apple TV 4th gen "Bedroom (2)" | 192.168.1.167 | pyatv (Companion protocol), running INSIDE the Android app |
| 2 | TCL 75Q691G TV | 192.168.1.93 | ADB key events via the broker (the "proxy") |
| 3 | Nvidia Shield | 192.168.1.176 | ADB key events via the broker |
The app also does per-TV physical input switching (HDMI 1/2/3…) for the TCL, app launching on all boxes, on-the-fly text typing on the ATV, and polls now-playing. Volume buttons are shown but intentionally non-functional on the ATV (it predates remote volume — see Caveats).
The two control paths — this is the crux
There are different plumbing per device, and the difference explains everything (why things work, and why they don't away from home):
AT HOME (on 192.168.1.0/24):
Apple TV: PHONE ──pyatv, direct──▶ 192.168.1.167
(the Python library runs in the app via Chaquopy;
pairing credentials are stored in the app on the phone)
TCL/Shield: PHONE ──HTTPS──▶ BROKER on lab box (192.168.1.171:8081)
│
└── adb ──▶ 192.168.1.93 / 192.168.1.176
- Apple TV = the app talks to the TV directly. No middleman. The "proxy" you keep thinking has to go is actually only in the TCL/Shield path — and it's load-bearing there, because ADB only reaches those boxes from inside the home network. The Apple TV path dodges the broker entirely, which is precisely why it's the one that dies off-LAN.
- The broker is a small Python HTTP server (systemd user service
atv-broker, port 8081, bound on all interfaces). It authenticates with a 32-char token in the request headerX-ATV-Token, and it holds the keys: adb device map, keycode map, the TCL input-switch logic, and — for the web remote — a separate pyatv worker process (its own Python, isolated so a pairing crash can't kill the broker). Apple TV credentials for the web remote also live on the box; for the Android app they live in the app on the phone.
Why the "proxy" exists (and why a plain app can't avoid it at all)
ADB is a debugging protocol that speaks to a specific IP on your LAN. From
your phone on cell data there is no route to 192.168.1.93 — no app,
written in any language, can fix that. Any solution for TCL/Shield off-LAN
is a middleman on your network by definition. Same story for pyatv and the
Apple TV: Companion only reaches 192.168.1.167 from inside the LAN.
The web remote (already exists, worth remembering)
The same broker serves a PWA at http://192.168.1.171:8081/remote
(Safari → Add to Home Screen) — this is the path built for Megan's iPhone.
It controls the same three devices, and its Apple TV traffic goes through
the box's pyatv worker (phone holds no secrets). It has a short-code unlock
(6-digit PIN) and a token unlock. It is equally LAN-only — same reason as
the app.
Why it doesn't work off the home network (your exact symptom)
"I see devices on any network outside my home but obviously it doesn't function since I'm not on my home LAN."
- Seeing the devices ≠ connectivity. The device list is persisted in
the app's local storage on the phone, so it renders anywhere. But each
entry is an address on
192.168.1.0/24that only exists at home. - Apple TV (in-app pyatv): phone tries to reach
192.168.1.167over cell/Wi-Fi → no route → times out. Dead. - TCL/Shield (broker): broker lives at
192.168.1.171:8081, and the box firewall (ufw) only advertises that port to the home LAN. From your phone away from home the broker is unreachable too. Dead. - Nothing is misbehaving — every path terminates on a home-LAN address. The whole system was architected as a home-only system; that's the feature set, and it works.
What already exists for an off-LAN path (half-built)
- The lab box is on Tailscale (
lootgoblin.tailf5d5f8.ts.net, 100.103.219.124) — it's always your "at home" in encrypted form, no router ports exposed, no tracking. - Your S23 is already a Tailscale node (
nathans-s23). - The broker listens on all interfaces (
0.0.0.0:8081). - What's missing is just the explicit exposure of 8081 to the tailnet
(one command, needs sudo on the box):
sudo tailscale serve --bg 8081. Until that's done, ufw still scopes the port to the LAN. - Note: even with the broker exposed, the Android app's Apple TV traffic
would still be dead off-LAN (pyatv is in the phone). Fixing that means
routing ATV commands through the broker's
/atv/*endpoints — which already exist (status/apps/playing/cmd/launch/text/pair) and are proven by the web remote. The only broker endpoint not yet written is a standaloneGET /atv/scan.
Feature status matrix (as of now)
| Feature | ATV | TCL | Shield | Notes |
|---|---|---|---|---|
| D-pad / select / menu / back | ✔ | ✔ | ✔ | |
| Play/pause | ✔ | ✔ | ✔ | |
| Home / wake / sleep | ✔ | ✔ | ✔ | "power" works only as sleep; a cold box's ADB is off |
| App launch | ✔ | — | ✔ | apps list pulled live |
| Text input | ✔ | — | — | |
| Now-playing poll | ✔ | — | — | |
| Physical input switching | — | ✔ | — | only the vendor Live-TV URI form works; verified against dumpsys oracle |
| Volume | ✖ (shown) | ✔ | ✔ | ATV4 limitation: no MRP; HID keys ignored. Workaround: HDMI-CEC (TCL "Simplink" + ATV Remotes setting) so the TV remote's rocker drives ATV volume |
| Off-LAN | ✖ | ✖ | ✖ | home-only by architecture (see above) |
| Second ATV ("Living Room" @ .182) | not paired | pairable in one go (PIN on screen) |
Known quirks: TCL's wireless ADB occasionally de-authorizes (reconnect +
tap "Allow" on the TV); the broker token is compiled into the APK (rotating
it = rebuild); the app is debug-signed under a com.example.* package —
fine for personal use, must be re-packaged properly for any store.
The options, spelled out
This is the decision table to react to. They're not mutually exclusive in the way you'd hope; pick a lane.
A. Keep it home-only (status quo). Zero work. Fast, simple, zero security surface. Everything above keeps working. Off-LAN = nothing. Cost: the phone stays a dead weight away from home.
B. Expose the broker to Tailscale, keep the in-phone pyatv (hybrid). One sudo command on the box + app gets a "server" picker: LAN address at home, tailnet name away. TCL/Shield work anywhere the phone is a tailnet node; Apple TV still only at home (pyatv stays in-phone). Cheapest change, but you now maintain two control paths for the ATV inside one app.
C. App becomes a pure client of the broker (the "real app"). All three
devices go over the box's existing /atv/*, /cmd, /input HTTP API.
pyatv moves to the box (the worker for the web remote already does this),
the app drops Chaquopy — the slow, fragile Python-in-APK build — and
builds become fast and boring. Secrets stop living on phone/TVs and live
only on the box. Works anywhere phone + box have a path (LAN now, tailnet
after the one sudo command). Cost: re-wiring the ATV section of the app +
adding the one /atv/scan endpoint; every keypress takes one extra hop
through the box (negligible on LAN; fine over direct WireGuard tunnel).
This is the version that finally makes "the app" one thing.
D. Do nothing about Android, lean on the PWA. The web remote
(:8081/remote) is already a full client with all three devices and is the
least code to get off-LAN via option B's one command (Safari PWA + tailnet
HTTPS = works anywhere, no app rebuild at all). Good fallback if you decide
Megan's setup is the canonical one and your phone is secondary.
E. Internet exposure (not recommended). Router port forwards or Tailscale Funnel to reach the boxes from any network, devices not on your tailnet. Maximally reachable, maximally risky (your TVs on the public internet; tracking exposure cuts against the whole point of this lab).
Also decoupled from the above, whenever you want it: a proper package name + release signing (for Play Store, if we ever go there), and the open-source "no-tracking TV OS" thread (separate project, gated on hardware).
Where everything lives
| Thing | Location |
|---|---|
| App source (Android + Python bridge) | ~/odysseus/data/agent_workspace/atv-remote (lab box) |
| Broker service | unit atv-broker (systemd user) → ~/.hermes/tools/atv-broker/broker.py |
| pyatv worker | ~/.hermes/tools/atv-broker/atv-worker.py (project venv) |
| Web remote page | ~/.hermes/tools/atv-broker/remote.html, served at :8081/remote |
| Broker token / pin | ~/.hermes/tools/atv-broker/token, …/access-pin (rotate = delete file) |
| ATV creds (web path) | ~/.hermes/tools/atv-broker/atv-creds.json (box only) |
| TLC/Shield debloat restore lists | ~/odysseus/data/agent_workspace/tcl-tv/ & …/shield-tv/ |
| Fresh APK download (LAN) | http://192.168.1.171:8081/ |
Build & install (for future reference)
cd ~/odysseus/data/agent_workspace/atv-remote
./gradlew :app:assembleDebug # >10 min while Chaquopy is in the build
# install: USB cable, or open http://192.168.1.171:8081/ in the phone's browser
Phone identity check before installing: adb devices must show the USB
serial (S23 Ultra), not a :5555 entry — .176 is the Shield, a control
target, and it has burned a session before via misidentified install
targets.
Updated 2026-11-27 from the atv-remote project state, broker source, and live service checks.