Add slugify websocket command - #177623
Conversation
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
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. |
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
erwindouna
left a comment
There was a problem hiding this comment.
Looks good, thanks @piitaya!
arturpragacz
left a comment
There was a problem hiding this comment.
Actually should it be part of config/core?
I think it's generic enough to add it in websocket_api at the top level?
|
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. |
Let's make it a generic endpoint then (just |
Proposed change
Adds a
slugifyWebSocket command that returns the slug for a given text, using the sameslugifyutil as entity ID generation. This lets the frontend show an accurate entity ID preview when changing entity id format.Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: