Skip to content

Latest commit

 

History

History
337 lines (258 loc) · 9.4 KB

File metadata and controls

337 lines (258 loc) · 9.4 KB

tvOS Reality Check - HomeKit Adopter Project

Date: November 21, 2025 Status: 🚫 CRITICAL LIMITATIONS DISCOVERED Authors: Jordan Koch


🚨 CRITICAL DISCOVERY

tvOS HomeKit is SEVERELY LIMITED by Apple's design.

After thorough investigation and multiple conversion attempts (macOS → iOS → tvOS), we've discovered that:

❌ What DOESN'T Work on tvOS:

  1. Cannot Discover Accessories

    • HMAccessoryBrowser - UNAVAILABLE on tvOS
    • Cannot scan for unadopted accessories
    • Cannot detect new devices on network
  2. Cannot Add/Remove Homes

    • HMHomeManager.addHome() - UNAVAILABLE
    • HMHomeManager.removeHome() - UNAVAILABLE
    • Cannot create or delete homes
  3. Cannot Add/Remove Rooms

    • HMHome.addRoom() - UNAVAILABLE
    • HMHome.removeRoom() - UNAVAILABLE
    • Cannot manage room structure
  4. Cannot Pair Accessories

    • HMHome.addAccessory() - UNAVAILABLE
    • HMHome.removeAccessory() - UNAVAILABLE
    • Cannot adopt unadopted accessories
  5. Cannot Assign Accessories to Rooms

    • HMHome.assignAccessory() - UNAVAILABLE
    • Cannot organize accessories
  6. Limited Camera/QR Support

    • QR code scanning impractical on TV
    • Limited AVFoundation support

✅ What DOES Work on tvOS:

  1. View Existing Configuration

    • HMHomeManager.homes - Read existing homes
    • HMHome.accessories - List accessories
    • HMHome.rooms - List rooms
    • HMAccessory properties - Read state
  2. Control Accessories

    • HMAccessory.services - Access services
    • HMService.characteristics - Read/write values
    • Turn lights on/off
    • Adjust thermostats
    • Control switches, outlets, etc.
  3. Monitor State

    • Delegate callbacks for changes
    • Accessory reachability
    • Characteristic value updates

🎯 Apple's Design Intent

tvOS HomeKit is designed for CONTROL ONLY, not CONFIGURATION.

Apple expects users to:

  1. Use iOS/iPadOS Home app to configure HomeKit
  2. Use tvOS apps to view and control existing accessories
  3. Share data via iCloud - both platforms access same HomeKit database

This makes sense because:

  • Setup requires cameras (QR codes) and keyboards (setup codes)
  • Configuration UIs work better on touchscreens
  • Apple TV is primarily for consumption, not setup
  • iPhone/iPad are always nearby for configuration

📊 Project Status After Multiple Platform Attempts

Attempt 1: macOS Native App ❌

Result: FAILED - HomeKit.framework doesn't exist on macOS Error: "No such module 'HomeKit'" Why: HomeKit.framework is iOS/tvOS/watchOS only

Attempt 2: iOS App ✅ (Partial Success)

Result: BUILD SUCCEEDED Limitations:

  • Works great for discovery and pairing
  • Can't deploy to Apple TV directly
  • User wants tvOS, not iOS

Attempt 3: tvOS App 🚫 (Current - Severe Limitations)

Result: API limitations make original vision impossible Why: See "What DOESN'T Work" above Status: Can build control-only app, but not discovery/pairing app


💡 REALISTIC OPTIONS GOING FORWARD

Option 1: tvOS Control Center (RECOMMENDED)

What it does:

  • ✅ View all existing accessories
  • ✅ Control accessories (on/off, brightness, etc.)
  • ✅ See home/room organization
  • ✅ Monitor accessory status
  • ❌ Cannot discover/pair new accessories

User workflow:

  1. Use iPhone/iPad Home app to add accessories
  2. Use this tvOS app to control them on Apple TV
  3. Both share same HomeKit database

Implementation status:

  • ContentView.swift - ✅ COMPLETE (control-only UI)
  • HomeManagerWrapper.swift - ✅ COMPLETE (read-only mode)
  • LoggingManager.swift - ✅ COMPLETE
  • Build: Need to remove deleted files from Xcode project

Time to complete: 1-2 hours Functionality: 40% of original vision (control only)

Option 2: Universal iOS + tvOS App

What it does:

  • iOS: Full discovery, pairing, and control
  • tvOS: Control only (view existing)
  • Single codebase with platform conditionals

Pros:

  • Complete feature set on iOS
  • Control convenience on tvOS
  • Unified experience

Cons:

  • More complex codebase
  • Platform-specific UI code
  • Two apps to maintain

Implementation status:

  • Would need to restore iOS code
  • Add platform conditionals throughout
  • Separate UI for each platform

Time to complete: 8-12 hours Functionality: 100% on iOS, 40% on tvOS

Option 3: iOS-Only App (Already Built!)

What it does:

  • Full HomeKit functionality
  • Discovery, pairing, control
  • Complete feature set

Status: ✅ ALREADY COMPLETE (v2.1.0) Location: /Volumes/Data/xcode/binaries/20251121-HomeKitAdopter-v2.1.0/ IPA: Ready to install on iPhone/iPad Functionality: 100% of original vision

Why not use this?

  • User specifically requested tvOS/Apple TV
  • Can't deploy iOS .ipa to Apple TV

Option 4: Abandon Custom App

What to do:

  • Use built-in Apple Home app on all devices
  • Works on iPhone, iPad, Mac, Apple TV
  • Full HomeKit support everywhere

Pros:

  • Zero development needed
  • Fully supported by Apple
  • Works everywhere
  • Free

Cons:

  • Not a custom solution
  • Can't customize features
  • User wanted custom app

🔧 IMMEDIATE NEXT STEPS

To complete the tvOS Control Center app (Option 1):

1. Remove Deleted Files from Xcode Project

Xcode is now open. You need to:

  1. In Xcode, select these files (they show in red):

    • HomeKitDiscoveryManager.swift
    • AccessoryRowView.swift
    • PairingView.swift
    • SetupCodeScannerView.swift
    • AccessorySetupView.swift
    • HelpView.swift
    • BatchPairingView.swift
  2. Right-click and select "Delete"

  3. Choose "Remove Reference" (files already deleted from disk)

2. Build for tvOS

Once files are removed:

xcodebuild -scheme HomeKitAdopter \
  -destination 'platform=tvOS Simulator,id=838DC47F-0261-4222-A27D-A9DCC69A85F8' \
  -configuration Debug build

3. Test on Simulator

  • Launch tvOS Simulator
  • Install app
  • Test with existing HomeKit setup (if any)

4. Deploy to Physical Apple TVs

Your Apple TVs:

  • Living Room: Apple TV 4K (2nd gen) - 59ACE225-758B-55E9-B0B2-303632320A8C
  • Master Bedroom: Apple TV 4K (3rd gen) - BA5C0F07-1D07-5E67-82BD-F8B8B91F5ADA
# Archive for tvOS
xcodebuild archive \
  -scheme HomeKitAdopter \
  -archivePath "HomeKitAdopter-tvOS.xcarchive"

# Export for development
xcodebuild -exportArchive \
  -archivePath "HomeKitAdopter-tvOS.xcarchive" \
  -exportPath "./tvOS-Build" \
  -exportOptionsPlist ExportOptions.plist

📝 WHAT THE USER SHOULD KNOW

The Hard Truth

Your original vision (discovering and adopting unadopted HomeKit accessories on Apple TV) is technically impossible due to Apple's API restrictions.

Why This Wasn't Obvious Earlier

  1. Documentation is vague - Apple doesn't clearly state these limitations upfront
  2. Framework exists - HomeKit.framework IS available on tvOS
  3. Some APIs work - Control features work great
  4. Discovery at compile time - Only found out after building

What You Can Have on Apple TV

A beautiful control center that:

  • Shows all your accessories organized by room
  • Lets you control them with your TV remote
  • Displays real-time status
  • Provides a 10-foot UI experience
  • Updates when you make changes on iOS

What You Need iOS/iPad For

  • Discovering new accessories
  • Pairing accessories to your home
  • Creating homes and rooms
  • Initial HomeKit setup
  • QR code scanning
  • Setup code entry

🎬 RECOMMENDED ACTION

Build the tvOS Control Center app as a companion to the iOS Home app.

User Experience:

  1. Setup (iPhone/iPad):

    • Open Home app
    • Add accessories
    • Create rooms
    • Organize home
  2. Daily Use (Apple TV):

    • Open HomeKit Control Center
    • View all accessories
    • Control with TV remote
    • Enjoy 10-foot UI

This is exactly how Apple designed the tvOS HomeKit ecosystem.


📚 Technical Reference

Complete API Availability Matrix

Feature iOS macOS tvOS watchOS
HMHomeManager
HMAccessoryBrowser
addHome()
removeHome()
addRoom()
removeRoom()
addAccessory()
removeAccessory()
assignAccessory()
Control accessories ✅*
View homes/rooms ✅*

*macOS via built-in Home.app only (no public API)

Security Audit Status

No critical vulnerabilities found:

  • No hardcoded secrets
  • No SQL/command injection risks
  • Proper input validation
  • No XSS vulnerabilities
  • Secure error handling

⚠️ Memory management needs review:

  • 20+ manager classes should be audited for retain cycles
  • All classes with closures need [weak self] verification

🏁 CONCLUSION

The HomeKit Adopter project as originally envisioned (discovering and pairing accessories) is not possible on tvOS due to Apple's API limitations.

The best path forward is:

  1. ✅ Build tvOS Control Center (view/control only)
  2. ✅ Keep iOS app for discovery/pairing (already built!)
  3. ✅ User uses both: iOS for setup, tvOS for daily control

This aligns with Apple's design and provides the best user experience.


Created by: Jordan Koch Date: November 21, 2025 Status: Documentation Complete - Awaiting User Decision