Skip to content

Conversation

@nstefanelli
Copy link

Summary

Part 7 of 7 - Camera popup and complete settings UI. Final PR in the series.

⚠️ Depends on: PRs #4197-#4202

Files Added (~4,500 lines)

Camera:

File Lines Purpose
CameraMotionDetector.swift ~300 Frame-by-frame motion detection
CameraOverlayView.swift ~920 Camera popup UI with actions
CameraStreamViewController.swift ~550 HLS stream player
PresenceDetector.swift ~370 Vision framework person detection

Settings UI:

File Lines Purpose
KioskSettingsView.swift ~830 Main kiosk settings page
ScreensaverConfigView.swift ~270 Screensaver mode configuration
DashboardConfigurationView.swift ~390 Dashboard selection UI
EntityTriggersView.swift ~380 Wake trigger entity config
PhotoAlbumPickerView.swift ~350 Photo album selection

App Launcher:

File Lines Purpose
QuickLaunchPanelView.swift ~270 Quick launch panel UI

Camera Popup Features

  • Shows camera stream on doorbell ring or notification command
  • Action buttons: Unlock door, Talk, Dismiss
  • Auto-dismiss after configurable timeout
  • Configurable size and position
  • Wakes screen and dismisses screensaver

Settings UI

  • Complete kiosk mode configuration
  • Dashboard picker with HA integration
  • Screensaver mode selection and options
  • Wake trigger configuration (entities, motion, presence)
  • Security settings (PIN, FaceID, tamper detection)
  • App shortcuts configuration

Test Plan

  • Camera popup appears on notification command
  • Camera stream plays correctly
  • Action buttons work (unlock, dismiss)
  • Auto-dismiss works after timeout
  • All settings pages load correctly
  • Settings persist after app restart
  • Dashboard picker shows HA dashboards
  • Photo album picker shows device albums

Complete PR Series

# PR Description Lines
1 #4197 Foundation ~1,600
2 #4198 Core Manager ~3,300
3 #4199 Screensaver ~1,700
4 #4200 Lockdown ~1,200
5 #4201 Security ~2,000
6 #4202 Commands ~430
7 This UI ~4,500
Total ~14,730

🤖 Generated with Claude Code

Part 1 of Kiosk Mode implementation.

This PR adds the foundation for Kiosk Mode:

## KioskSettings.swift
- Complete settings model with all configuration options
- Codable for persistence
- Includes enums for screensaver modes, clock styles, photo sources, etc.
- Entity trigger configurations
- Dashboard rotation settings

## KioskConstants.swift
- Centralized constants for animations, timing, notifications
- Notification names for kiosk events

## Utilities
- IconMapper: Converts MDI icons to SF Symbols
- TouchFeedbackManager: Haptic and audio feedback
- AnimationUtilities: Shared animation helpers

These types form the foundation that subsequent PRs will build upon.
Part 2 of Kiosk Mode implementation. Depends on PR home-assistant#4197.

## KioskModeManager (~970 lines)
Central coordinator for all kiosk functionality:
- Enable/disable kiosk mode
- Screen state management (on, dimmed, screensaver)
- Brightness control with day/night scheduling
- Idle timer and activity tracking
- Dashboard navigation
- Entity trigger subscriptions
- HA WebSocket integration

## Security (~760 lines)
- SecurityManager: PIN and biometric authentication
- SettingsManager: Settings persistence

## Dashboard (~360 lines)
- DashboardManager: Dashboard rotation and scheduling

## Camera Detection (~320 lines)
- CameraDetectionManager: Motion and presence detection using front camera

## App Launcher (~360 lines)
- AppLauncherManager: Launch external apps, return handling

## WebViewController Integration (~565 lines)
- WebViewController+Kiosk: Kiosk overlay management
- Modified WebViewController: Made properties internal for kiosk access
Part 3 of Kiosk Mode implementation. Depends on PRs home-assistant#4197 and home-assistant#4198.

Adds screensaver functionality with multiple display modes:

Files added (~52K):
- ClockScreensaverView.swift: Clock display with multiple styles (large, minimal, digital, analog)
- CustomURLScreensaverView.swift: Display custom HA dashboard as screensaver
- EntityStateProvider.swift: Fetches and formats entity states for display
- PhotoManager.swift: Manages photo loading from device, iCloud, and HA media
- PhotoScreensaverView.swift: Photo slideshow with transitions
- ScreensaverViewController.swift: UIKit controller coordinating screensaver presentation

Features:
- Multiple screensaver modes: clock, photos, dim, blank, custom URL
- Clock styles: large, minimal, digital, analog with entity display
- Photo sources: device albums, iCloud, Home Assistant media
- Pixel shift for burn-in prevention
- Day/night brightness scheduling
Part 4 of Kiosk Mode implementation. Depends on PRs home-assistant#4197, home-assistant#4198, home-assistant#4199.

Adds navigation lockdown and overlay UI components:

Files added (~39K):
- EdgeProtectionView.swift: Invisible edge barriers preventing swipe gestures
- QuickActionsView.swift: Quick launch panel for third-party apps
- SecretExitGestureView.swift: Hidden gesture sequence to exit kiosk mode
- StatusOverlayView.swift: Connection status, battery, and time display

Features:
- Edge protection blocks iOS system gestures (Control Center, notifications)
- Configurable secret tap pattern for secure kiosk exit
- Quick actions panel with app shortcuts
- Status bar overlay with connection indicator
Part 5 of Kiosk Mode implementation. Depends on PRs home-assistant#4197-home-assistant#4200.

Files added (~51K):
Security:
- BatteryManager.swift: Battery monitoring, low battery alerts
- CrashRecoveryManager.swift: Automatic crash recovery and restart
- GuidedAccessManager.swift: iOS Guided Access integration
- TamperDetectionManager.swift: Motion-based tamper detection

Audio:
- AmbientAudioDetector.swift: Ambient sound level monitoring for wake triggers
- AudioManager.swift: Audio playback and TTS support

Features:
- Battery level monitoring with critical level alerts
- Automatic crash recovery to restore kiosk state
- Guided Access API integration for enterprise deployments
- Motion-based tamper detection (device moved while in kiosk)
- Ambient audio detection for sound-triggered wake
- Text-to-speech announcements via notification commands
Part 6 of Kiosk Mode implementation. Depends on PRs home-assistant#4197-home-assistant#4201.

Files added:
- KioskCommandHandlers.swift (~500 lines): Handlers for all kiosk notification commands

Supported commands (14 total):
- command_screen_on: Wake screen
- command_screen_off: Start screensaver
- command_brightness: Set screen brightness
- command_screensaver: Control screensaver mode
- command_navigate: Navigate to URL/path
- command_refresh: Reload current page
- command_kiosk_mode: Enable/disable kiosk mode
- command_volume: Set device volume
- command_tts: Text-to-speech announcement
- command_play_audio: Play audio file
- command_launch_app: Launch third-party app
- command_return: Return to HA app
- command_show_camera: Show camera popup
- command_dismiss_camera: Dismiss camera popup
Part 7 of Kiosk Mode implementation. Final PR. Depends on PRs home-assistant#4197-home-assistant#4202.

Camera files added:
- CameraMotionDetector.swift: Frame-by-frame motion detection
- CameraOverlayView.swift: Camera popup UI with actions
- CameraStreamViewController.swift: HLS stream player
- PresenceDetector.swift: Vision framework person detection

Settings UI files added:
- KioskSettingsView.swift: Main kiosk settings page
- ScreensaverConfigView.swift: Screensaver mode configuration
- DashboardConfigurationView.swift: Dashboard selection
- EntityTriggersView.swift: Wake trigger entity configuration
- PhotoAlbumPickerView.swift: Album selection for photo screensaver

AppLauncher files added:
- QuickLaunchPanelView.swift: Quick launch panel UI

Features:
- Camera popup with doorbell integration
- Action buttons (unlock door, dismiss, etc.)
- Auto-dismiss after configurable timeout
- Motion detection via frame differencing
- Person/face detection via Vision framework
- Complete kiosk settings UI
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This is the final PR (7/7) in the Kiosk Mode feature series, adding camera popup functionality and a comprehensive settings UI with ~4,500 lines of code. The PR integrates kiosk mode into the WebViewController, adds utility managers for feedback and animations, implements settings screens for dashboard/screensaver/entity configuration, provides security features (PIN/biometric auth, tamper detection, crash recovery), creates multiple screensaver views (clock, photos, custom URL), and builds overlay components for status display and gesture-based controls.

Key changes:

  • WebViewController integration with kiosk mode manager and overlay controllers
  • Settings UI with 9+ configuration screens for dashboards, screensaver, triggers, security
  • Security managers for authentication, tamper detection, battery monitoring
  • Screensaver system with multiple modes (clock, photos, custom URL, entity display)
  • Overlay system for status display, secret exit gesture, quick actions, edge protection

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated no comments.

Show a summary per file
File Description
WebViewController.swift Changed properties to internal for kiosk integration; added kiosk-aware status bar/home indicator hiding
WebViewController+Kiosk.swift Extension integrating kiosk managers with WebView through callbacks and observers
TouchFeedbackManager.swift Manages haptic/sound feedback with system sound IDs and UIKit integration
IconMapper.swift Maps Material Design Icons to SF Symbols for UI consistency
AnimationUtilities.swift Pre-defined animations, transitions, and view modifiers
KioskSettingsView.swift Main settings screen with 10+ sections and authentication flow
ScreensaverConfigView.swift Screensaver configuration with mode-specific options
PhotoAlbumPickerView.swift Photo library browser with permissions and album selection
EntityTriggersView.swift Configuration UI for HA entity-based wake/sleep triggers
DashboardConfigurationView.swift Dashboard selection and rotation configuration
TamperDetectionManager.swift Motion/orientation monitoring for device security
SettingsManager.swift Settings import/export with versioning
SecurityManager.swift Biometric/PIN authentication and remote lock management
GuidedAccessManager.swift iOS Guided Access integration for enhanced security
CrashRecoveryManager.swift Crash detection and automatic recovery
BatteryManager.swift Battery/thermal monitoring with health reporting
ScreensaverViewController.swift Container managing multiple screensaver modes
PhotoScreensaverView.swift Photo slideshow with transitions and clock overlay
PhotoManager.swift Photo fetching from device/iCloud/HA Media
EntityStateProvider.swift Real-time HA entity state subscription
CustomURLScreensaverView.swift WebView-based screensaver for custom dashboards
ClockScreensaverView.swift Multiple clock styles with entity display
StatusOverlayView.swift Floating status bar with connection/battery/time
SecretExitGestureView.swift Corner tap gesture for accessing settings when locked
QuickActionsView.swift Slide-out panel for HA service calls
EdgeProtectionView.swift Blocks accidental edge touches
KioskSettings.swift Complete settings model (794 lines) with all configuration
KioskConstants.swift Centralized constants for animations, timing, UI

nstefanelli and others added 2 commits January 9, 2026 14:18
- Renamed isEnabled to isKioskModeEnabled for clarity
- Removed exitPIN (using device-based authentication only)
- Changed allowDevicePasscodeExit default to true
- Updated all settings.isEnabled references in Security managers

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add setFrontendKioskMode() for HA 2026.1+ kiosk_mode/set WebSocket command
- Replace NavigationStack with NavigationView (iOS 16 → iOS 13+)
- Replace ContentUnavailableView with custom VStack (iOS 17 → iOS 15+)
- Fix onChange() to use single-parameter version (iOS 17 → iOS 14+)
- Fix onTapGesture to use basic version without location (iOS 17 → iOS 13+)
- Add @available(iOS 17.0, *) to #Preview macros
- Fix isEnabled → isKioskModeEnabled in CrashRecoveryManager
- Remove PIN-related code (device authentication only)
- Simplify SecurityManager using device authentication

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@nstefanelli
Copy link
Author

All review feedback has been addressed:

  • Renamed isEnabled to isKioskModeEnabled for clarity
  • Removed PIN-based authentication in favor of device-level authentication (Face ID/Touch ID/Device Passcode)
  • Fixed iOS 15+ compatibility (replaced NavigationStack, ContentUnavailableView, etc.)
  • Added kiosk_mode/set WebSocket command support for HA 2026.1+
  • All Copilot review threads resolved

Ready for re-review. 🙏

The localPush subscription was using the default retryDuration of 10
seconds, causing the subscription to be removed (instead of retried)
when the WebSocket disconnects more than 10 seconds after creation.

Set retryDuration to nil for unlimited retries since this is a
long-lived subscription that should persist for the entire app session.

Fixes home-assistant#34
Issue home-assistant#35 fixes:

1. Secret exit gesture default changed from topLeft to topRight
   - Prevents conflict with hamburger menu for HA sidebar

2. Added native Dashboard Kiosk Mode (HA 2026.1+)
   - Sends kiosk_mode/set command to hide sidebar/header natively
   - No URL manipulation needed

3. Renamed existing kiosk URL setting for clarity
   - appendKioskParameter -> appendHACSKioskParameter
   - UI now shows "HACS Kiosk Mode URL" to distinguish from native

Settings UI now has two separate toggles:
- Dashboard Kiosk Mode: Uses HA 2026.1 native kiosk_mode/set command
- HACS Kiosk Mode URL: Appends ?kiosk for HACS kiosk-mode integration
@nstefanelli nstefanelli marked this pull request as draft January 11, 2026 20:25
@nstefanelli nstefanelli marked this pull request as ready for review January 11, 2026 20:25
Copy link
Member

@bgoncal bgoncal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since a camera will be presented it is better to improve WebRTCPlayerView that already exists to become "CameraPlayerView" and handle all types of streams.

Or if you want to have a dedicated camera player for this view, at least you need to consider webrtc as well

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft January 12, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants