home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.93k stars 30.16k forks source link

Sluggified camera entity name from the host name alone is insufficient #125990

Open rainwoodman opened 2 weeks ago

rainwoodman commented 2 weeks ago

The problem

  1. The UI does not offer a way to customize entity name.
  2. The UI generates an entity name from the host name.
  3. With wyze bridge all of the cameras are from 127.0.0.1 (URL is like 127.0.0.1:8554/living-room-cam
  4. a wyze bridge camera gets a cryptic name of 127_0_0_1, and there is no clear way how to rename it later. (it appears to always referred to as camera.127_0_0_1.

What was the rationale for not allowing customization of the generic camera entity name? Can we add a new text box in the integration dialog to allow customizing the entity name? Or improve the slug function to pick a higher-entropy part of the URL instead of just using the host name?

the corresponding logic is roughly at https://github.com/home-assistant/core/blob/b1b7c3f7c1b1d51ba02dbcf47e22f2dffe538020/homeassistant/components/generic/config_flow.py#L229

What version of Home Assistant Core has the issue?

2024.9.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

generic camera

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 2 weeks ago

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

Code owner commands Code owners of `generic` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign generic` Removes the current integration label and assignees on the issue, 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 issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


generic documentation generic source (message by IssueLinks)

davet2001 commented 15 hours ago

Hi @rainwoodman

1. The UI does not offer a way to customize entity name.

On my HA, I can customize the entity name of camera entities. I can get to this by clicking on the gear icon after clicking the camera in the entities list within settings.

image

Also I don't see a problem with duplicate entity names.

I just tried it by creating cameras referring to two wikipedia images, and got camera.upload_wikimedia_org and camera.upload_wikimedia_org_2

It is possible to rename the device or the individual camera entities via the usual controls on the UI.

Note: An early version config flow for generic camera had the ability to change the name, but this was removed once it was known that the rename feature was already built in.