-
Notifications
You must be signed in to change notification settings - Fork 403
Add display text override parameter to Control Center controls #4104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: bgoncal <[email protected]>
Co-authored-by: bgoncal <[email protected]>
|
@copilot fix lint issues
|
Co-authored-by: bgoncal <[email protected]>
Fixed in commit bf7b925. Wrapped long lines in the following files to meet the 120 character limit:
All function calls with multiple parameters now use multi-line formatting per SwiftFormat configuration. |
There was a problem hiding this 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 ?? defaultTextpattern 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" |
...xtensions/Widgets/Controls/OpenEntity/ControlOpenSensor/ControlOpenSensorValueProvider.swift
Outdated
Show resolved
Hide resolved
…or/ControlOpenSensorValueProvider.swift Co-authored-by: Copilot <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
## 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?
>
>
</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]>
Add display text parameter to Control Center controls
Summary
Successfully added an optional
displayTextparameter 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):
Pattern Applied:
@ParameterfordisplayText: String?in each Configuration structdisplayText: String?field to each Item structdisplayText ?? defaultTextpattern for labelsFiles Modified: 28 files total
All changes maintain backward compatibility - existing controls will continue to work without modification.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.