mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Keep the provided name when creating a tag (#128240)
* Keep the name * Add patch * Update homeassistant/components/tag/__init__.py Co-authored-by: G Johansson <goran.johansson@shiftit.se> --------- Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
parent
d66d87d271
commit
f9cbf1b30c
@ -84,7 +84,9 @@ def _create_entry(
|
||||
original_name=f"{DEFAULT_NAME} {tag_id}",
|
||||
suggested_object_id=slugify(name) if name else tag_id,
|
||||
)
|
||||
return entity_registry.async_update_entity(entry.entity_id, name=name)
|
||||
if name:
|
||||
return entity_registry.async_update_entity(entry.entity_id, name=name)
|
||||
return entry
|
||||
|
||||
|
||||
class TagStore(Store[collection.SerializedStorageCollection]):
|
||||
|
@ -294,6 +294,10 @@ async def test_entity_created_and_removed(
|
||||
assert item["id"] == "1234567890"
|
||||
assert item["name"] == "Kitchen tag"
|
||||
|
||||
await hass.async_block_till_done()
|
||||
er_entity = entity_registry.async_get("tag.kitchen_tag")
|
||||
assert er_entity.name == "Kitchen tag"
|
||||
|
||||
entity = hass.states.get("tag.kitchen_tag")
|
||||
assert entity
|
||||
assert entity.state == STATE_UNKNOWN
|
||||
|
Loading…
x
Reference in New Issue
Block a user