Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 17, 2025

Add display text parameter to Control Center controls

  • Explore repository structure and understand Control Center controls
  • Add displayText parameter to ControlButtonConfiguration (Button control)
  • Update ControlButtonValueProvider to use displayText when available
  • Add displayText parameter to ControlSwitchConfiguration (Switch control)
  • Update ControlSwitchValueProvider to use displayText when available
  • Add displayText parameter to ControlLightsConfiguration (Light control)
  • Update ControlLightsValueProvider to use displayText when available
  • Add displayText parameter to ControlCoverConfiguration (Cover control)
  • Update ControlCoverValueProvider to use displayText when available
  • Add displayText parameter to ControlSceneConfiguration (Scene control)
  • Update ControlScenesValueProvider to use displayText when available
  • Update ControlScene to use displayText in Label
  • Add displayText parameter to ControlScriptsConfiguration (Script control)
  • Update ControlScriptsValueProvider to use displayText when available
  • Update ControlScript to use displayText in Label
  • Add displayText parameter to ControlOpenPageConfiguration (OpenPage control)
  • Update ControlOpenPageValueProvider to use displayText when available
  • Update ControlOpenPage to use displayText in Label
  • Add displayText parameter to ControlAssistConfiguration (Assist control)
  • Update ControlAssistValueProvider to use displayText when available
  • Update ControlAssist to use displayText in Label
  • Add displayText parameter to all OpenEntity controls (Entity, Switch, Light, Cover, InputBoolean, Lock, Camera, Sensor)
  • Update all OpenEntity value providers to use displayText when available
  • Update all OpenEntity controls to use displayText in Labels
  • Run code review - No issues found
  • Run security checks - No vulnerabilities detected
  • Fix SwiftFormat lint issues - wrapped long lines to meet 120 character limit

Summary

Successfully added an optional displayText parameter to all Control Center control configurations. This allows users to override the default display text shown on their controls without changing the underlying entity name.

Implementation Details

Controls Updated (19 total):

  1. Button
  2. Switch
  3. Light
  4. Cover
  5. Scene
  6. Script
  7. OpenPage
  8. Assist
  9. OpenEntity
  10. OpenSwitch
  11. OpenLight
  12. OpenCoverEntity
  13. OpenInputBoolean
  14. OpenLock
  15. OpenCamera
  16. OpenSensor

Pattern Applied:

  • Added @Parameter for displayText: String? in each Configuration struct
  • Added displayText: String? field to each Item struct
  • Updated value providers to pass displayText through to items
  • Updated control widgets to use displayText ?? defaultText pattern for labels
  • Parameter is optional, maintaining backward compatibility
  • Fixed SwiftFormat lint issues by wrapping long lines

Files Modified: 28 files total

  • 19 Configuration/ValueProvider files
  • 19 Control widget files (some combined in same file)

All changes maintain backward compatibility - existing controls will continue to work without modification.

Original prompt

To each Control center control that we have, add a new parameter to control configuration where the user can override the display text


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add parameter for overriding display text in control configuration Add display text override parameter to Control Center controls Dec 17, 2025
Copilot AI requested a review from bgoncal December 17, 2025 22:30
@bgoncal
Copy link
Member

bgoncal commented Dec 17, 2025

@copilot fix lint issues

2025-12-17T22:42:11.9631133Z Running SwiftFormat... 2025-12-17T22:42:11.9631636Z (lint mode - no files will be changed.) 2025-12-17T22:42:17.8063026Z /home/runner/work/iOS/iOS/Sources/Extensions/Widgets/Controls/Cover/ControlCoverValueProvider.swift:28:1: warning: (wrap) Wrap lines that exceed the specified maximum width. 2025-12-17T22:42:17.8065498Z /home/runner/work/iOS/iOS/Sources/Extensions/Widgets/Controls/Cover/ControlCoverValueProvider.swift:32:1: warning: (wrap) Wrap lines that exceed the specified maximum width. 2025-12-17T22:42:17.8067847Z /home/runner/work/iOS/iOS/Sources/Extensions/Widgets/Controls/Cover/ControlCoverValueProvider.swift:35:1: warning: (wrap) Wrap lines that exceed the specified maximum width. 2025-12-17T22:42:17.8171430Z /home/runner/work/iOS/iOS/Sources/Extensions/Widgets/Controls/Switch/ControlSwitchValueProvider.swift:22:1: warning: (wrap) Wrap lines that exceed the specified maximum width. 2025-12-17T22:42:17.8173899Z /home/runner/work/iOS/iOS/Sources/Extensions/Widgets/Controls/Switch/ControlSwitchValueProvider.swift:26:1: warning: (wrap) Wrap lines that exceed the specified maximum width. 2025-12-17T22:42:17.8176220Z /home/runner/work/iOS/iOS/Sources/Extensions/Widgets/Controls/Switch/ControlSwitchValueProvider.swift:30:1: warning: (wrap) Wrap lines that exceed the specified maximum width. 2025-12-17T22:42:17.8178537Z /home/runner/work/iOS/iOS/Sources/Extensions/Widgets/Controls/Switch/ControlSwitchValueProvider.swift:33:1: warning: (wrap) Wrap lines that exceed the specified maximum width. 2025-12-17T22:42:17.8288139Z /home/runner/work/iOS/iOS/Sources/Extensions/Widgets/Controls/Button/ControlButtonValueProvider.swift:21:1: warning: (wrap) Wrap lines that exceed the specified maximum width. 2025-12-17T22:42:17.8784642Z /home/runner/work/iOS/iOS/Sources/Extensions/Widgets/Controls/Light/ControlLightsValueProvider.swift:35:1: warning: (wrap) Wrap lines that exceed the specified maximum width. 2025-12-17T22:42:17.8787518Z /home/runner/work/iOS/iOS/Sources/Extensions/Widgets/Controls/Light/ControlLightsValueProvider.swift:39:1: warning: (wrap) Wrap lines that exceed the specified maximum width. 2025-12-17T22:42:17.8789857Z /home/runner/work/iOS/iOS/Sources/Extensions/Widgets/Controls/Light/ControlLightsValueProvider.swift:42:1: warning: (wrap) Wrap lines that exceed the specified maximum width. 2025-12-17T22:42:18.7867944Z SwiftFormat completed in 6.82s. 2025-12-17T22:42:18.7868314Z Source input did not pass lint check.

Copy link
Contributor Author

Copilot AI commented Dec 17, 2025

@copilot fix lint issues

`2025-12-17T22:42:11.9631133Z Running SwiftFormat......

Fixed in commit bf7b925. Wrapped long lines in the following files to meet the 120 character limit:

  • ControlButtonValueProvider.swift
  • ControlSwitchValueProvider.swift
  • ControlCoverValueProvider.swift
  • ControlLightsValueProvider.swift

All function calls with multiple parameters now use multi-line formatting per SwiftFormat configuration.

Copilot AI requested a review from bgoncal December 17, 2025 22:47
@bgoncal bgoncal marked this pull request as ready for review December 18, 2025 12:46
Copilot AI review requested due to automatic review settings December 18, 2025 12:46
@bgoncal bgoncal enabled auto-merge (squash) December 18, 2025 12:46
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 adds an optional displayText parameter to all Control Center control configurations, allowing users to override the default display text shown on their controls without changing the underlying entity name. The implementation maintains backward compatibility as the parameter is optional.

Key Changes

  • Added displayText: String? parameter to 19 control configuration types
  • Updated value providers to pass displayText through the control item structures
  • Modified control widgets to use displayText ?? defaultText pattern for labels, falling back to entity names when displayText is not provided

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ControlScriptsValueProvider.swift Added displayText parameter to ControlScriptItem and ControlScriptsConfiguration; updated value provider methods to pass displayText
ControlScript.swift Updated Label to use displayText with fallback to intentScriptEntity.displayString
ControlScenesValueProvider.swift Added displayText parameter to ControlSceneItem and ControlSceneConfiguration; updated value provider methods to pass displayText
ControlScene.swift Updated Label to use displayText with fallback to intentSceneEntity.displayString
ControlOpenPageValueProvider.swift Added displayText parameter to ControlOpenPageItem and ControlOpenPageConfiguration; updated item creation methods
ControlOpenPage.swift Updated Label to use displayText with fallback to page.panel.title
ControlSwitchValueProvider.swift Added displayText parameter to ControlSwitchConfiguration; updated item() method to use displayText for name field
ControlOpenSwitchValueProvider.swift Added displayText parameter to ControlOpenSwitchItem and ControlOpenSwitchConfiguration; updated item creation
ControlOpenSwitch.swift Updated Label to use displayText with fallback to entity.displayString
ControlOpenSensorValueProvider.swift Added displayText parameter to ControlOpenSensorItem and ControlOpenSensorConfiguration; updated item creation
ControlOpenSensor.swift Updated Label to use displayText with fallback to entity.displayString
ControlOpenLockValueProvider.swift Added displayText parameter to ControlOpenLockItem and ControlOpenLockConfiguration; updated item creation
ControlOpenLock.swift Updated Label to use displayText with fallback to entity.displayString
ControlOpenLightValueProvider.swift Added displayText parameter to ControlOpenLightItem and ControlOpenLightConfiguration; updated item creation
ControlOpenLight.swift Updated Label to use displayText with fallback to entity.displayString
ControlOpenInputBooleanValueProvider.swift Added displayText parameter to ControlOpenInputBooleanItem and ControlOpenInputBooleanConfiguration; updated item creation
ControlOpenInputBoolean.swift Updated Label to use displayText with fallback to entity.displayString
ControlOpenEntityValueProvider.swift Added displayText parameter to ControlOpenEntityItem and ControlOpenEntityConfiguration; updated item creation
ControlOpenEntity.swift Updated Label to use displayText with fallback to entity.displayString
ControlOpenCoverEntityValueProvider.swift Added displayText parameter to ControlOpenCoverEntityItem and ControlOpenCoverEntityConfiguration; updated item creation
ControlOpenCoverEntity.swift Updated Label to use displayText with fallback to entity.displayString
ControlOpenCameraValueProvider.swift Added displayText parameter to ControlOpenCameraItem and ControlOpenCameraConfiguration; updated item creation
ControlOpenCamera.swift Updated Label to use displayText with fallback to entity.displayString
ControlLightsValueProvider.swift Added displayText parameter to ControlLightsConfiguration; updated item() method to use displayText for name field
ControlCoverValueProvider.swift Added displayText parameter to ControlCoverConfiguration; updated item() method to use displayText for name field
ControlButtonValueProvider.swift Added displayText parameter to ControlButtonConfiguration; updated item() method to use displayText for name field
ControlAssistValueProvider.swift Added displayText parameter to ControlAssistItem and ControlAssistConfiguration; updated value provider methods
ControlAssist.swift Updated Label to use displayText with fallback to "Assist"

…or/ControlOpenSensorValueProvider.swift

Co-authored-by: Copilot <[email protected]>
@bgoncal bgoncal merged commit d79ef4d into main Dec 18, 2025
10 checks passed
@bgoncal bgoncal deleted the copilot/add-display-text-parameter branch December 18, 2025 13:28
@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@cd1b11d). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4104   +/-   ##
=======================================
  Coverage        ?   45.66%           
=======================================
  Files           ?      242           
  Lines           ?    13697           
  Branches        ?        0           
=======================================
  Hits            ?     6255           
  Misses          ?     7442           
  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.

bgoncal added a commit that referenced this pull request Dec 18, 2025
## Summary
Adds fan domain support to iOS 18 Control Center controls. Users can now
toggle fan entities directly from Control Center alongside existing
light, switch, and cover controls.

## Screenshots

N/A - Control Center widget requires device testing with configured fan
entities

## Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

## Any other notes

**Implementation:**
- Added `fan` domain to `Domain` enum with on/off states and CarPlay
support
- Created `ControlFan` widget with 4 files following existing control
patterns:
  - Main widget configuration with blue tint
  - Intent handler for toggle/turn_on/turn_off services
- Entity query with async pattern (matching Switch/Cover for
future-proofing)
- Value provider for state management with SF Symbol icons
(`fan`/`fan.fill`) and optional displayText parameter
- Integrated fan domain into system components:
  - `HAAPI.swift` - Added to toggle domain case
  - `HAEntity+CarPlay.swift` - Added fan icon mapping
  - `MagicItem.swift` - Added to toggle domain case
- Registered as `controlFan` in `WidgetsKind` and `WidgetsBundle18`
- Added localization strings following established patterns ("Choose
fan" for consistency)
- Added optional `displayText` parameter to `ControlFanConfiguration`
for custom display names (matching PR #4104 pattern)

**Pattern consistency:**
Mirrors Switch/Cover implementations with async entity queries. Uses
standard on/off toggle model with state-based icons. Includes
displayText override feature for user customization.

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Add "fan" entity type to control center
controls</issue_title>
> <issue_description>
> ### Discussed in
https://github.com/home-assistant/iOS/discussions/3679
> 
> <div type='discussions-op-text'>
> 
> <sup>Originally posted by **haydonryan** June 29, 2025</sup>
> Currently on IOS we have most of the major types except for fans.
Could we add that too please?
> 
>
![image](https://github.com/user-attachments/assets/6bef25db-f706-45f8-92cb-5940b5f0f7c4)</div></issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes #3681

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: bgoncal <[email protected]>
Co-authored-by: Copilot <[email protected]>
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