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
56e550f136
commit
866912d3f7
2 changed files with 7 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue