Skip to content

Add slugify websocket command - #177623

Merged
MindFreeze merged 3 commits into
devfrom
slugify_websocket
Jul 31, 2026
Merged

Add slugify websocket command#177623
MindFreeze merged 3 commits into
devfrom
slugify_websocket

Conversation

@piitaya

@piitaya piitaya commented Jul 30, 2026

Copy link
Copy Markdown
Member

Proposed change

Adds a slugify WebSocket command that returns the slug for a given text, using the same slugify util as entity ID generation. This lets the frontend show an accurate entity ID preview when changing entity id format.

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 diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@piitaya piitaya added this to the 2026.8.0 milestone Jul 30, 2026
Copilot AI review requested due to automatic review settings July 30, 2026 08:12
@piitaya
piitaya requested a review from a team as a code owner July 30, 2026 08:12
@home-assistant

Copy link
Copy Markdown
Contributor

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (config) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of config can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign config Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a WebSocket command for frontend-consistent slug generation.

Changes:

  • Registers config/core/slugify.
  • Adds WebSocket coverage for slug generation.

Reviewed changes

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

File Description
homeassistant/components/config/core.py Implements and registers the command.
tests/components/config/test_core.py Tests the command response.

Comment thread tests/components/config/test_core.py Outdated
Comment thread tests/components/config/test_core.py Outdated
@home-assistant

Copy link
Copy Markdown
Contributor

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 July 30, 2026 08:24
Copilot AI review requested due to automatic review settings July 30, 2026 08:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

@piitaya
piitaya marked this pull request as ready for review July 30, 2026 09:06
@home-assistant
home-assistant Bot requested a review from erwindouna July 30, 2026 09:06

@erwindouna erwindouna left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, thanks @piitaya!

@arturpragacz arturpragacz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually should it be part of config/core?
I think it's generic enough to add it in websocket_api at the top level?

@home-assistant
home-assistant Bot marked this pull request as draft July 30, 2026 09:16
@piitaya

piitaya commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

I was also thinking to create a preview entity id endpoint. I'm ok with both solution.

Also, in frontend, we are generating slug for dashboard path. I guess we can re-use that endpoint for that too.

@piitaya
piitaya marked this pull request as ready for review July 30, 2026 13:28
@arturpragacz

arturpragacz commented Jul 30, 2026

Copy link
Copy Markdown
Member

Also, in frontend, we are generating slug for dashboard path. I guess we can re-use that endpoint for that too.

Let's make it a generic endpoint then (just slugify probably?).

@arturpragacz
arturpragacz marked this pull request as draft July 30, 2026 13:48
Copilot AI review requested due to automatic review settings July 30, 2026 13:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread homeassistant/components/websocket_api/commands.py
@arturpragacz arturpragacz changed the title Add config/core/slugify websocket command Add slugify websocket command Jul 30, 2026
@piitaya
piitaya marked this pull request as ready for review July 30, 2026 14:05
@MindFreeze
MindFreeze merged commit 369930e into dev Jul 31, 2026
86 of 87 checks passed
@MindFreeze
MindFreeze deleted the slugify_websocket branch July 31, 2026 06:39
bramkragten pushed a commit that referenced this pull request Jul 31, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants