Index of every page on this site: llms.txt
All skills
romit07 avatar

/android-home-server

@b45fb6a
Run it yourself

Set up and operate a spare non-rooted Android phone as a Linux home server and home-automation hub (Termux + SSH, Tailscale, ADB over network) to control WiZ lamps, a Sony Bravia TV, camera apps and phone settings remotely. Use when asked to set up, check, repair or use the Android home server, lamps, TV or phone automation.

  • 22 files
  • 44.7 KB
  • Updated 3 weeks ago
  • GitHub
Use this Skill: https://skilld.dev/gh/romit07/android-home-server/android-home-server

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈87 tokens for metadata: the name and description. ≈1.5k when used: this file. ≈5.1k more on demand in 6 files.

Description uses 4.3% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈348 characters, or 4.3%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Android Home Server skill

You are an agent with a shell on a controller machine (laptop, VPS or cloud box). The phone is a spare, non-rooted Android device on the user's home Wi-Fi. You reach it only over Tailscale. Repo: https://github.com/romit07/android-home-server

Ground rules

  • Never expose ADB or SSH to the public internet. Use the phone's Tailscale address only.
  • Wrap every adb call in timeout (e.g. timeout 20 adb ...). Half-dead links hang forever.
  • Never install apps on the phone, rename things, or change settings beyond what the user asked; ask first.
  • Some steps need the human (tapping on the phone, pairing codes, signing in). Ask for exactly that step, then verify.
  • Don't send screenshots to the user unless asked; prefer scripts/ui.sh (text) to check screen state, delete screenshots afterwards.
  • Keep secrets (keys, IPs, MACs) in config.env, never in commits or chat logs that go public.

Setup (do in order, verify each step)

Step 1. Controller tools

sudo apt-get install -y adb openssh-client python3 git   # or brew install android-platform-tools
git clone https://github.com/romit07/android-home-server && cd android-home-server
cp config.example.env config.env

Verify: adb version && ssh -V && python3 --version all succeed.

Step 2. Tailscale on both ends

Human: install Tailscale on the phone (Play Store) and sign in. Install on the controller (curl -fsSL https://tailscale.com/install.sh | sh && sudo tailscale up) with the same account. Verify: tailscale status lists the phone; tailscale ping <phone> gets a pong (via DERP is OK). Put the name/IP in PHONE_HOST.

Step 3. Termux + SSH

Human: install Termux from F-Droid, open it, run: pkg install -y curl && curl -fsSL https://raw.githubusercontent.com/romit07/android-home-server/main/scripts/termux-setup.sh | bash Then add the controller's public key: generate with ssh-keygen -t ed25519 -f ~/.ssh/android_termux -N '', and have the human paste the .pub into Termux ~/.ssh/authorized_keys (or use ssh-copy-id -p 8022 with the temporary passwd). Set SSH_USER (Termux whoami) and SSH_KEY in config.env. Verify: ssh -i $SSH_KEY -p 8022 $SSH_USER@$PHONE_HOST 'uname -a; python --version; which nc nmap' prints Linux/aarch64 and paths.

Step 4. ADB over network

Human: enable Developer options (tap Build number 7x), turn on Wireless debugging, open "Pair device with pairing code", tell you IP, pairing port, code and debug port.

timeout 30 adb pair <ip>:<pair-port> <code>
timeout 15 adb connect <ip>:<debug-port>
timeout 15 adb -s <ip>:<debug-port> tcpip 5555
timeout 15 adb connect $PHONE_HOST:5555

Verify: timeout 15 adb devices shows <PHONE_HOST>:5555 device and ./scripts/adb-reconnect.sh prints connected.

Step 5. Keep-alive

Ask the human to: keep it charging; set Termux + Tailscale battery to Unrestricted; set Tailscale as Always-on VPN; optionally Developer options → Stay awake. Then:

adb -s $PHONE_HOST:5555 push scripts/keepawake.sh /data/local/tmp/
timeout 10 adb -s $PHONE_HOST:5555 shell 'nohup sh /data/local/tmp/keepawake.sh >/dev/null 2>&1 &'
timeout 10 adb -s $PHONE_HOST:5555 shell dumpsys deviceidle disable    # optional

Verify: timeout 10 adb -s $PHONE_HOST:5555 shell 'ps -A | grep -c keepawake' ≥ 1; dumpsys deviceidle enabled prints 0 if disabled.

Step 6. WiZ lamps (optional)

Get bulb MACs (WiZ app → bulb → settings, or router client list) into BULB_MACS, set LAN_PREFIX. Verify: ./scripts/lamps.py discover finds every MAC; ./scripts/lamps.py status returns JSON from each bulb; ./scripts/lamps.py day logs DAY ok. Schedule: set LAMP_SCHEDULE, start nohup python3 scripts/scheduler.py >/dev/null 2>&1 &. Also suggest the human create the same schedules in the WiZ app (Automation → Schedules) as a backup that runs on the bulbs themselves.

Step 7. Sony Bravia (optional)

Human: TV Settings → Network → Home network → IP control → Simple IP control ON (and Authentication "Normal and Pre-Shared Key" if present). Put TV_IP in config (find via ip neigh on the phone / router). Verify: ./scripts/tv.sh status returns *SAPOWR000000000000000X. For apps, enable network debugging on the TV, run ./scripts/tv-adb.sh youtube and ask the human to accept the ADB prompt on the TV once.

Operating commands

Task Command
Health check tailscale ping $PHONE_HOST; ./scripts/adb-reconnect.sh
Lamps ./scripts/lamps.py day|on|night|warm|off|status|discover
TV ./scripts/tv.sh on|off|status|vol N|mute|input hdmiN; ./scripts/tv-adb.sh youtube|url URL
Silence phone ./scripts/dnd.sh on / off / status / until 23:59 (alarms-only; always schedule the off)
Read screen ./scripts/ui.sh (text, ids, bounds, CLICK flags)
Drive an app ./scripts/tap.sh open <pkg>, ./scripts/tap.sh text "<label>", ./scripts/tap.sh X Y
Linux on phone ssh -i $SSH_KEY -p 8022 $SSH_USER@$PHONE_HOST '<cmd>'

App automation loop (WiZ app, camera apps, anything): ui.sh → pick the element → tap.sh → ui.sh again to confirm the new state. Never assume a tap worked.

Recovery playbook

  1. adb devices shows offline / commands hang → ./scripts/adb-reconnect.sh (kill-server + connect).
  2. tailscale ping fails → the phone is off Tailscale or off Wi-Fi. Ask the human to open Tailscale on the phone; a "DNS unavailable" warning = bad Wi-Fi → restart router/extender.
  3. Bulbs/TV not found → ping sweep (lamps.py discover); if still missing, ask the human to restart the Wi-Fi extender (devices often drop off it). IPs shuffle after power cuts; always match by MAC.
  4. Phone rebooted → ask the human to enable Wireless debugging; redo Step 4 tcpip 5555, restart keepawake, re-apply deviceidle disable.
  5. A scheduled action failed → don't retry endlessly; report it and run it once manually if the user wants.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at b45fb6a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 3 weeks ago

README badge

README badge for romit07/android-home-server