Skip to content

Conversation

@joostlek
Copy link
Member

@joostlek joostlek commented Dec 28, 2025

Proposed change

So some integrations are considered a service or hub and the frontend will show "Add service" or "Add hub". While in reality, for example in the case of Spotify, it's not a service they add, but rather an account, so this PR allows integrations to overwrite this button's text, so you can change it to "Add account" to make it more user friendly :)

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

Copilot AI review requested due to automatic review settings December 28, 2025 16:19
@joostlek joostlek requested review from a team and frenck as code owners December 28, 2025 16:19
@home-assistant
Copy link

Hey there @frenck, mind taking a look at this pull request as it has been labeled with an integration (spotify) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of spotify can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign spotify Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

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 enables integrations to customize the "Add entry" button text in the frontend. Instead of showing generic text like "Add service" or "Add hub", integrations can now specify more contextually appropriate text like "Add account" for account-based services like Spotify.

Key changes:

  • Extended the translation schema to support optional initiate_flow configuration for regular config flows (previously only available for subentry flows)
  • Added a common translation string for "account" in the global strings.json
  • Updated Spotify integration to use "Add account" instead of the default button text

Reviewed changes

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

File Description
script/hassfest/translations.py Added schema validation for optional initiate_flow in regular config flows with required "user" key
homeassistant/strings.json Added common translation string "account" under config_flow.initiate_flow
homeassistant/components/spotify/strings.json Configured Spotify to use "Add account" button text by referencing the common translation

@epenet epenet added ci-full-run Marks a PR to trigger a full CI run (instead of partial) and removed ci-full-run Marks a PR to trigger a full CI run (instead of partial) labels Dec 28, 2025
@arturpragacz arturpragacz added the second-opinion-wanted Add this label when a reviewer needs a second opinion from another member. label Dec 28, 2025
"create_entry": {
"default": "Successfully authenticated with Spotify."
},
"initiate_flow": {
Copy link
Member

Choose a reason for hiding this comment

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

initiate_flow is too generic, we also have options flow.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, so for the subentries we have initiate_flow, this just reuses it
https://github.com/home-assistant/core/blob/dev/homeassistant/components/google_weather/strings.json#L48-L50

"default": "Successfully authenticated with Spotify."
},
"initiate_flow": {
"user": "[%key:common::config_flow::initiate_flow::account%]"
Copy link
Member

Choose a reason for hiding this comment

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

it's only user facing strings, any reason to have a dictionary underneath?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just because reusing the existing logic, no other reason.

Comment on lines +218 to +219
schema[vol.Optional("initiate_flow")] = {
vol.Required("user"): translation_value_validator,
Copy link
Member

Choose a reason for hiding this comment

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

I wish we could enforce the use of references because there probably won't be more than like 5-10 unique strings.

Copy link
Member

Choose a reason for hiding this comment

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

Re-use is always encouraged (and generally works), but locking it down I'm not a fan of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

by-code-owner cla-signed core integration: spotify new-feature Quality Scale: No score second-opinion-wanted Add this label when a reviewer needs a second opinion from another member. small-pr PRs with less than 30 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants