[PR #7] [MERGED] feat: Android TV Remote wake/sleep + admin panel pairing #7

Closed
opened 2026-08-09 19:09:25 +02:00 by zaph0d · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/niels-emmer/wall-cast/pull/7
Author: @niels-emmer
Created: 3/27/2026
Status: Merged
Merged: 3/27/2026
Merged by: @niels-emmer

Base: mainHead: remote-control


📝 Commits (2)

  • 397aead feat(caster): add Android TV Remote wake/sleep control
  • aabee04 feat(pairing): admin panel pairing flow for Android TV Remote

📊 Changes

8 files changed (+670 additions, -2 deletions)

View changed files

📝 .gitignore (+3 -0)
📝 backend/app/routers/config.py (+71 -1)
📝 caster/Dockerfile (+3 -1)
📝 caster/cast.py (+91 -0)
caster/pair.py (+261 -0)
caster/remote.py (+104 -0)
📝 config/wall-cast.example.yaml (+12 -0)
📝 frontend/src/admin/AdminPanel.tsx (+125 -0)

📄 Description

Summary

  • Wake/sleep without ADB — new remote.py module uses androidtvremote2 (port 6466, the same protocol the Google TV app uses) to send KEYCODE_WAKEUP / KEYCODE_SLEEP; falls back to Wake-on-LAN magic packet if chromecast_mac is set
  • Admin panel pairing flow — pair a Google TV screen directly from Admin → Screens → Diagnostics, no terminal required
  • Signal file pattern (consistent with existing recast) — backend drops signal files, cast.py picks them up each cycle; pairing runs as a background subprocess so it doesn't block casting

New files

File Purpose
caster/remote.py wake_screen() / sleep_screen() helpers
caster/pair.py Interactive + non-interactive pairing script

Config

screens:
  - id: living-room
    chromecast_ip: 192.168.1.42
    chromecast_mac: aa:bb:cc:dd:ee:ff   # optional — enables WoL fallback

Pairing flow

  1. Open Admin → Screens → select a screen → Diagnostics
  2. Click Pair now (requires Chromecast IP to be set)
  3. A PIN appears on the TV — enter it in the admin panel
  4. Done — Paired badge appears; wake/sleep now work via the API

New API endpoints

Method Path Purpose
GET /api/admin/pairing/{screen_id} Paired status + session state
POST /api/admin/pairing/start Initiate pairing
POST /api/admin/pairing/pin Submit PIN
POST /api/admin/casting/wake Wake display
POST /api/admin/casting/sleep Sleep display

Test plan

  • docker compose up --build -d on server — caster image rebuilds with androidtvremote2 + wakeonlan
  • Admin → Screens → Diagnostics shows Pair now for unpaired screens with an IP set
  • Pair a screen: click Pair now → PIN appears on TV → enter PIN → badge shows Paired
  • Re-pair button works after initial pairing
  • pair-start-<sid>.signal is consumed within one cast cycle (≤60 s)
  • Certs appear in config/atv-certs/<screen-id>/ on the server

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/niels-emmer/wall-cast/pull/7 **Author:** [@niels-emmer](https://github.com/niels-emmer) **Created:** 3/27/2026 **Status:** ✅ Merged **Merged:** 3/27/2026 **Merged by:** [@niels-emmer](https://github.com/niels-emmer) **Base:** `main` ← **Head:** `remote-control` --- ### 📝 Commits (2) - [`397aead`](https://github.com/niels-emmer/wall-cast/commit/397aeadca493a51f6462442193271336177cef0f) feat(caster): add Android TV Remote wake/sleep control - [`aabee04`](https://github.com/niels-emmer/wall-cast/commit/aabee040997fbe869ba2e9cd81a2cabd26d3d3c2) feat(pairing): admin panel pairing flow for Android TV Remote ### 📊 Changes **8 files changed** (+670 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+3 -0) 📝 `backend/app/routers/config.py` (+71 -1) 📝 `caster/Dockerfile` (+3 -1) 📝 `caster/cast.py` (+91 -0) ➕ `caster/pair.py` (+261 -0) ➕ `caster/remote.py` (+104 -0) 📝 `config/wall-cast.example.yaml` (+12 -0) 📝 `frontend/src/admin/AdminPanel.tsx` (+125 -0) </details> ### 📄 Description ## Summary - **Wake/sleep without ADB** — new `remote.py` module uses `androidtvremote2` (port 6466, the same protocol the Google TV app uses) to send `KEYCODE_WAKEUP` / `KEYCODE_SLEEP`; falls back to Wake-on-LAN magic packet if `chromecast_mac` is set - **Admin panel pairing flow** — pair a Google TV screen directly from Admin → Screens → Diagnostics, no terminal required - **Signal file pattern** (consistent with existing recast) — backend drops signal files, `cast.py` picks them up each cycle; pairing runs as a background subprocess so it doesn't block casting ## New files | File | Purpose | |------|---------| | `caster/remote.py` | `wake_screen()` / `sleep_screen()` helpers | | `caster/pair.py` | Interactive + non-interactive pairing script | ## Config ```yaml screens: - id: living-room chromecast_ip: 192.168.1.42 chromecast_mac: aa:bb:cc:dd:ee:ff # optional — enables WoL fallback ``` ## Pairing flow 1. Open Admin → Screens → select a screen → Diagnostics 2. Click **Pair now** (requires Chromecast IP to be set) 3. A PIN appears on the TV — enter it in the admin panel 4. Done — **Paired** badge appears; wake/sleep now work via the API ## New API endpoints | Method | Path | Purpose | |--------|------|---------| | `GET` | `/api/admin/pairing/{screen_id}` | Paired status + session state | | `POST` | `/api/admin/pairing/start` | Initiate pairing | | `POST` | `/api/admin/pairing/pin` | Submit PIN | | `POST` | `/api/admin/casting/wake` | Wake display | | `POST` | `/api/admin/casting/sleep` | Sleep display | ## Test plan - [ ] `docker compose up --build -d` on server — caster image rebuilds with `androidtvremote2` + `wakeonlan` - [ ] Admin → Screens → Diagnostics shows **Pair now** for unpaired screens with an IP set - [ ] Pair a screen: click Pair now → PIN appears on TV → enter PIN → badge shows **Paired** - [ ] Re-pair button works after initial pairing - [ ] `pair-start-<sid>.signal` is consumed within one cast cycle (≤60 s) - [ ] Certs appear in `config/atv-certs/<screen-id>/` on the server 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
zaph0d 2026-08-09 19:09:25 +02:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
github-mirrors/wall-cast#7
No description provided.