notajson.dev
← All projects
building2026 · iPhone · side project

TV Remote

My TV remote broke, and every remote app I tried on the App Store wanted a subscription, so I built my own. An iPhone remote for Sony BRAVIA (Google TV) and Apple TV, with Home Screen, Lock Screen and Control Center widgets. For Apple TV it speaks Apple's private Companion protocol, documented by the open-source pyatv project.

// stack

What it's built with, and where each piece runs.

9 technologies · tap one to see where it runs

app/TypeScript
  • React Native 0.88 · React 19Every screen: remote, touchpad, apps, keyboard, devices
  • TypeScript 6The app and all the protocol code; tsc runs clean
  • Expo SDK 58 (dev client)Builds, native config and the Expo Modules API
  • expo-glass-effect · expo-blurThe Liquid Glass style, beside Soft Stone and Flat
  • react-native-svgIcons and the remote artwork
native/Swift
  • Two custom Expo modulestv-discovery and tv-tls, written in Swift, called from TypeScript
  • Network frameworkBonjour discovery and TLS sockets to the TV
  • CryptoKitX25519, Ed25519 and ChaCha20-Poly1305 for Apple TV
  • KeychainPairing keys, shared with the widget
widgets/Swift
  • WidgetKit · SwiftUIHome Screen and Lock Screen widgets
  • App IntentsButtons that work from the widget and Control Center
  • @bacons/apple-targetsKeeps the widget's Xcode target inside the Expo project
protocols/by hand
  • Apple CompanionOPACK, TLV8, SRP-6a pairing, HKDF-SHA512 keys
  • Sony REST + IRCCButtons, apps and power on BRAVIA
  • Google TV remote protocolTyping on Google TV

Logos: Simple Icons (CC0). Trademarks belong to their owners.

// snapshots

Every screen, in every style.

48 / 48 real iPhone screenshots · 8 screens × 3 styles × 2 themes

// how it works

One remote, a different protocol per TV.

Every TV plugs in behind one interface. The remote, touchpad, apps and keyboard work the same whichever TV is on the other end.

TVFinds itPairsControls it withStatus
Sony BRAVIABonjour, plus a subnet scan4-digit PIN on the TVSony's REST and IRCC API; Google TV's remote protocol for typing✓ working
Apple TVBonjour (companion-link)4-digit PIN over SRP-6aCompanion: an encrypted channel for buttons, apps, typing and the profile switcher✓ working
Google TV / Android TVBonjour6-character codeGoogle TV's remote protocol, already built for typing◐ next
Roku · Samsung · LGWi-FiNone, or an Allow promptWi-Fi commands; Samsung and LG need a wake-up signal○ planned

// decisions

Three calls worth explaining.

01

Crypto in Swift, protocol in TypeScript

X25519, Ed25519 and ChaCha20-Poly1305 run natively on CryptoKit. Framing, OPACK and pairing stay in TypeScript, where they are easy to read and change.

02

One interface for every TV

Each brand implements one TVClient. A new brand needs discovery, pairing and control; the tabs, keyboard and device switching work unchanged.

03

Don't keep the phone busy

The widget redraws only when what it shows changes, the TV search stops after 12 s, and held buttons stop repeating after 20 s.

// checks

What's verified, and what isn't yet.

remote-native-app · main
Queued: $ npx tsc --noEmit
Queued: $ pair + control a Sony BRAVIA
Queued: $ pair + control an Apple TV
Queued: $ widgets: home, lock screen, control center
Queued: $ protocol unit tests (SRP, OPACK, TLV8)

queued · 5 checks

// next

More TVs, easiest first.

  1. ◐ nextGoogle TV / Android TVTCL, Hisense, Philips, Xiaomi. Most of the protocol is already built.
  2. ○ thenRokuPlain Wi-Fi commands and no pairing. App icons and typing included.
  3. ○ thenSamsungA secure Wi-Fi connection and an Allow prompt on the TV.
  4. ○ thenLGGood app control; needs a wake-up signal to turn on.