Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 23, 2025

Basic implementation of a native dashboard - WIP

  • Support more domains toggle action when tapping icon
    • Light
    • Cover
    • Switch
  • Create the equivalent of "more info dialog" for each domain
    • Light
    • Cover
    • Switch
  • Add haptics
  • Add more cards such as a camera card
  • Find a way to display sensors information such as humidity and temperature
  • Allow customizing background
  • Allow opening the native dashboard from iOS controls
  • Allow opening the native dashboard from Shortcuts
  • Add an advanced option somewhere in settings that allow user to see the native dashboard first instead of web UI
  • Add error state
  • Add empty state
  • Add loading state
  • Allow reordering rooms
  • Allow reordering cards
CleanShot 2026-01-05 at 16 19 59@2x

Copilot AI changed the title [WIP] Add HomeView UI for managing entities Add HomeView for native entity control UI Dec 23, 2025
Copilot AI requested a review from bgoncal December 23, 2025 12:58
Copilot AI and others added 12 commits December 23, 2025 21:02
Moved EntityTileView from HomeView.swift to a new EntityTileView.swift file and enhanced it to support displaying entity state and customizable icon color. Updated HomeView toolbar to use ToolbarItemGroup and improved button layout.
HomeView and HomeViewModel now require a Server instance to be passed during initialization, improving dependency management and testability. Updated usages and previews accordingly. Also added @available(iOS 26.0, *) and @observable annotations, and made minor UI adjustments including a new toolbar button and navigation title.
EntityTileView now displays icon color based on entity state and attributes, supporting color modes such as rgb and hs. HomeViewModel subscribes to entity state changes and provides up-to-date state and attributes to EntityTileView, improving real-time UI feedback for entities like lights.
Moved context-aware state description logic into Domain.contextualStateDescription(for:), reducing duplication and improving maintainability. Updated EntityTileView to use HAEntity and Domain for state and icon logic, and adjusted HomeView and CarPlayEntityListItem to use the new API. Added Domain.swift to WebView/Home and made minor CarPlay icon rendering adjustments for platform compatibility.
EntityTileView now wraps the icon in a Button that triggers a LightIntent for light entities, enabling AppIntents-based actions from the UI. The view and its initializer are updated to accept a Server parameter, and HomeView is updated to pass the server. Minor improvements and fixes are included for entity ID usage and LightIntent parameter defaults.
Updated HomeViewModel to include both light and cover domains when filtering entities for the selected server. Also reformatted LightIntent initialization in EntityTileView for readability and fixed minor formatting in LightIntent.swift.
@bgoncal bgoncal force-pushed the copilot/add-homeview-ui branch from 7a3b516 to b154cbe Compare December 23, 2025 20:03
@github-actions
Copy link
Contributor

github-actions bot commented Dec 23, 2025

⚠️ Unused L10n strings detected

Found 1 unused localization strings in the codebase.

Click to see details
Parsing Strings.swift...
Found 1298 L10n strings

Reading all Swift source code...
Read 4913671 characters of Swift code

Checking for unused strings...
Checked 100/1298 strings...
Checked 200/1298 strings...
Checked 300/1298 strings...
Checked 400/1298 strings...
Checked 500/1298 strings...
Checked 600/1298 strings...
Checked 700/1298 strings...
Checked 800/1298 strings...
Checked 900/1298 strings...
Checked 1000/1298 strings...
Checked 1100/1298 strings...
Checked 1200/1298 strings...

================================================================================
UNUSED STRINGS REPORT
================================================================================

Found 1 unused strings:


WATCH:
  - L10n.Watch.Labels.noAction
    Key: watch.labels.no_action
    Line: 3986

================================================================================
Total unused: 1
================================================================================

To clean up these strings, manually remove them from the Localizable.strings files
and regenerate Strings.swift using SwiftGen.

Extracted the animated gradient and orb background from ModernAssistView into a new reusable ModernAssistBackgroundView component. Updated ModernAssistView and HomeView to use the new background view. Also improved EntityTileView with a glass effect and adjusted corner radius, and updated HomeView grid spacing for consistency.
Extended entity intent handling and filtering to support the 'cover' domain alongside 'light'. Updated HomeViewModel to use a shared allowedDomains list and refactored domain filtering logic. Also added specific state string handling for the 'shade' device class in Domain.swift.
@codecov
Copy link

codecov bot commented Dec 23, 2025

Codecov Report

❌ Patch coverage is 11.05263% with 169 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@345f57b). Learn more about missing BASE report.

Files with missing lines Patch % Lines
Sources/Shared/Domain/Domain.swift 0.00% 81 Missing ⚠️
Sources/Shared/AreasService.swift 3.44% 28 Missing ⚠️
Sources/Shared/HAAppEntity.swift 10.00% 18 Missing ⚠️
Sources/Shared/DeviceClassProvider.swift 0.00% 13 Missing ⚠️
Sources/Shared/EntityRegistryListForDisplay.swift 0.00% 7 Missing ⚠️
Sources/Shared/HAAreasRegistryResponse.swift 30.00% 7 Missing ⚠️
Sources/Shared/HATypedRequest+App.swift 0.00% 7 Missing ⚠️
Sources/Shared/Environment/AppConstants.swift 0.00% 6 Missing ⚠️
Sources/Shared/Environment/AppArea.swift 0.00% 1 Missing ⚠️
...ources/Shared/Environment/AppDatabaseUpdater.swift 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4142   +/-   ##
=======================================
  Coverage        ?   45.07%           
=======================================
  Files           ?      244           
  Lines           ?    13903           
  Branches        ?        0           
=======================================
  Hits            ?     6267           
  Misses          ?     7636           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dnestico
Copy link

dnestico commented Dec 23, 2025

Wow this is awesome and beats a webview... I hope the Android team is looking at this and making thier own native UI too, would be great.

@bgoncal
Copy link
Member

bgoncal commented Dec 24, 2025

For now it's just an experiment, it's a long run until having enough implemented for a fully functional native dashboard hahaha but thanks for the feedback! 💪🏻

CC: @TimoPtr

@bgoncal bgoncal changed the title Add HomeView for native entity control UI Experiment: Native HomeView/dashboard Dec 24, 2025
Introduces a toolbar menu allowing users to filter displayed sections in HomeView, with support for single or multiple section selection. Adds state management for selected sections and updates the view to show only filtered sections. Includes UI for toggling multi-selection and clearing filters.
Introduces HomeSectionsReorderView for reordering room sections in the Home view. Removes Domain.swift, updates HomeView and HomeViewModel to support section order persistence, filtering, and toggling selection logic. Section order is now saved per server and can be modified via a new UI.
bgoncal added 22 commits January 5, 2026 15:05
Extracted the RoomIdentifier struct from HomeView.swift and placed it in a new RoomIdentifier.swift file under the Room directory. Updated the Xcode project to include the new file.
Added observation of HomeViewConfiguration changes using ValueObservation. The configuration property now saves cached data on update, and the initializer sets up observation instead of directly loading the configuration. This ensures the view model stays in sync with configuration changes in the database.
Simplifies the observeConfigChanges method by removing the do-catch block and directly initializing the ValueObservation. Updates error logging message for clarity.
HomeViewConfiguration now conforms to Equatable, enabling comparison. RoomView now updates cached entities when the configuration changes, improving data consistency.
HomeView and HomeViewModel now manage entity subscriptions based on app lifecycle events. Subscriptions are started when the app becomes active and stopped when entering the background, improving resource management and ensuring up-to-date data.
Introduces ValueObservation-based listeners for appEntities and registryEntities, ensuring the HomeViewModel updates its data and subscriptions reactively when underlying database entities change. This improves data consistency and removes the need for initial synchronous entity loading.
Refactors the HomeView toolbar by splitting it into smaller components and reworking the filter menu to use buttons instead of toggles. Moves section filtering and selection logic into dedicated view properties. Updates HomeViewModel to improve entity filtering, section building, and state management, and removes unnecessary calls to save and rebuild sections after configuration changes.
Introduces a debounced save mechanism using a cancellable Task to prevent frequent database writes when saving the Home view configuration. Removes the rebuildSections method and ensures sections are rebuilt after saving. This improves performance and reliability when updating configuration state.
Added guards in appEntities and registryEntities didSet observers to avoid calling buildSectionsFromEntityStates when the lists are empty. This prevents unnecessary processing and potential errors when entity arrays are empty.
Changed RoomSection to store entityIds instead of HAEntity objects and updated grouping, sorting, and filtering logic to operate on entity IDs. Updated HomeView, RoomView, and EntityTileView to use the new structure and improved tile rendering. This refactor streamlines entity management and prepares for more efficient state updates.
Replaces immediate section building with a debounced async approach to avoid redundant executions. Caches area and entity-to-area mapping, optimizes entity filtering and grouping, and improves error handling. This enhances performance and responsiveness when entity or registry data changes.
Moved entity filtering logic from HomeViewModel to HomeView for improved clarity and separation of concerns. Replaced debounced async section building with direct area observation and synchronous room section construction, simplifying state management and improving UI responsiveness.
Refactored visibleEntitiesForSection to use lookup dictionaries and sets for faster filtering of entities, reducing repeated O(n) searches. Improved sorting logic to use custom order if available, falling back to alphabetical order, and streamlined the filtering process for clarity and efficiency.
RoomView now receives a RoomSection and HomeViewModel instead of server, roomId, and roomName. Entity filtering and sorting logic has been moved into computed properties, improving performance and code clarity. HomeView updated to pass RoomSection to RoomView, aligning with the new data model.
Standardized variable names in conditional bindings within HomeView.swift for improved clarity and consistency. No functional changes were made.
Swapped ModernAssistBackgroundView for Color.secondaryBackground in HomeView to update the background styling.
Moved the light mode toggle buttons into the control bar and refactored their appearance for better UI consistency. Updated background views in HomeView and RoomView to use Color.secondaryBackground instead of ModernAssistBackgroundView. Improved section rendering logic in HomeView to avoid empty sections.
Refactored VerticalToggleControl to use a taller, rectangular thumb with updated icon sizing and padding, and removed the glass effect from the track. Added a new toggle button to SwitchControlsView for direct switch toggling, improving accessibility and user interaction.
Moved the reorder button and divider to the top of the filter menu. Updated section filter button to show a label with a checkmark or circle only when multiple selection is allowed or the section is visible; otherwise, display just the section name.
@bgoncal
Copy link
Member

bgoncal commented Jan 5, 2026

Merging as a debug feature, control will not be available in prod yet.

@bgoncal bgoncal marked this pull request as ready for review January 5, 2026 22:10
Copilot AI review requested due to automatic review settings January 5, 2026 22:10
@bgoncal bgoncal enabled auto-merge (squash) January 5, 2026 22:10
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 PR introduces an experimental native dashboard feature that provides a native Swift UI alternative to the WebView-based interface. The implementation includes support for lights, covers, switches, and fans with interactive controls, entity management, and room-based organization.

Key changes:

  • Database schema extensions for tracking entity visibility/disabled states and home view configuration
  • Refactored API request methods with clearer naming (configAreasRegistry, configEntityRegistryList, etc.)
  • New native views for home dashboard, rooms, and entity controls with domain-specific implementations
  • iOS 26.0+ requirement for the experimental feature with Control Widget integration

Reviewed changes

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

Show a summary per file
File Description
Sources/Shared/HAAreasRegistryResponse.swift Renamed response types and added hiddenBy/disabledBy tracking for entities
Sources/Shared/HATypedRequest+App.swift Renamed API request methods for better clarity
Sources/Shared/AreasService.swift Added entity property synchronization and refactored type names
Sources/Shared/HAAppEntity.swift Added filtering capabilities and hidden/disabled state tracking
Sources/Shared/Environment/HomeViewConfigurationTable.swift New database table for storing user's dashboard configuration
Sources/App/WebView/ExperimentalSpace/* Complete native dashboard implementation with views, view models, and controls
Tests/App/Area/AreasService.test.swift Updated tests for new entity registry parameters
Localization files Added strings for new UI elements
Dependency files Updated HAKit from 0.4.8 to 0.4.9

@bgoncal bgoncal merged commit 8cdfb4f into main Jan 5, 2026
23 checks passed
@bgoncal bgoncal deleted the copilot/add-homeview-ui branch January 5, 2026 22:38
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.

4 participants