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
73.99k stars 31.03k forks source link

Sensor: Duplicate "VOC" sensor types create confusion in the UI #129323

Open NoRi2909 opened 4 weeks ago

NoRi2909 commented 4 weeks ago

The problem

There are two sensor types for VOC:

https://github.com/home-assistant/core/blob/b1470fd9b8b7fe78589f58eb6f4ed4de62591bb1/homeassistant/components/sensor/strings.json#L263-L267

As the second, actually called "volatile_organic_compounds_parts" in the documentation, simply references the name of the first this results in duplicate menu items in several places. Here when creating a sensor Helper:

380518122-1d3f239b-f0c3-4a7b-bd14-46a556967e45

To fix this we simply need a separate short name for the second and replace all references to the first.

The first needs no addendum as it is measured in µg/m³ like all other concentrations (PM1, PM2.5, PM10, NO, NO₂, NOₓ, SO₂, ozone). The second is in ppm/ppb which are only used for CO and CO₂ as well.

I suggest we pick VOC parts for the second which matches the documentation, too.

So the first step is to replace the three occurrences in the Sensor component:

Name:

https://github.com/home-assistant/core/blob/b1470fd9b8b7fe78589f58eb6f4ed4de62591bb1/homeassistant/components/sensor/strings.json#L267

 VOC parts

Condition:

https://github.com/home-assistant/core/blob/b1470fd9b8b7fe78589f58eb6f4ed4de62591bb1/homeassistant/components/sensor/strings.json#L46

  Current {entity_name} volatile organic compounds parts level

Trigger:

https://github.com/home-assistant/core/blob/b1470fd9b8b7fe78589f58eb6f4ed4de62591bb1/homeassistant/components/sensor/strings.json#L96

  {entity_name} volatile organic compounds parts level changes

Once this is done we can fix the name references from four other components to use the "VOC_parts" name instead of copying the "VOC" name:

https://github.com/home-assistant/core/blob/9bf0cbd65937f9cf7abdd08a8e7c81972c52a0c8/homeassistant/components/random/strings.json#L128

https://github.com/home-assistant/core/blob/9bf0cbd65937f9cf7abdd08a8e7c81972c52a0c8/homeassistant/components/scrape/strings.json#L185

https://github.com/home-assistant/core/blob/9bf0cbd65937f9cf7abdd08a8e7c81972c52a0c8/homeassistant/components/sql/strings.json#L117

https://github.com/home-assistant/core/blob/9bf0cbd65937f9cf7abdd08a8e7c81972c52a0c8/homeassistant/components/template/strings.json#L334

All four above need to be changed to:

  [%key:component::sensor::entity_component::volatile_organic_compounds_parts::name%]

If that's done there will be no more duplicate "VOC" items in the UI.

What version of Home Assistant Core has the issue?

2024.10.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Sensor

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sensor/

home-assistant[bot] commented 4 weeks ago

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

Code owner commands Code owners of `sensor` 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 sensor` 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)


sensor documentation sensor source (message by IssueLinks)