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
70.46k stars 29.39k forks source link

CCS 811 sensor warning about unit ppb for tvoc #85370

Closed commentsonly closed 1 year ago

commentsonly commented 1 year ago

The problem

Entity sensor.esp8266xxxxx_ccs811_tvoc (<class 'homeassistant.components.esphome.sensor.EsphomeSensor'>) is using native unit of measurement 'ppb' which is not a valid unit for the device class ('volatile_organic_compounds') it is using; Please update your configuration if your entity is manually configured, otherwise create a bug report

Well dead easy: ESPhome.io says: tvoc (Required): The information for the total volatile organic compound sensor in parts per billion (ppb).

And I'm well aware that ppb is an as legitimate unit as ppm, but tvocs are normally using ppb since that fits best.

What version of Home Assistant Core has the issue?

2023.1.1

What was the last working version of Home Assistant Core?

the one before

What type of installation are you running?

Home Assistant OS

Integration causing the issue

ESPhome

Link to integration documentation on our website

https://esphome.io/components/sensor/ccs811.html

Diagnostics information

No response

Example YAML snippet

# CCS811v1
# first start with baseline disabled
# read the baseline value after 20-30min operation
# enable the baseline with the new value and recompile
- platform: ccs811
  address: ${vaddr}
  update_interval: ${vupdate}
  baseline: 0xC481
  temperature: t # requires an additional t sensor
  humidity: h    # requires an additional h sensor
  eco2:
    name: ${vprefix}eco2
    state_topic: ${vprefix}eco2
    unit_of_measurement: 'ppm'
    accuracy_decimals: 2
    filters:
      - sliding_window_moving_average:
          window_size: 16
          send_every: ${vsendevery}
  tvoc:
    name: ${vprefix}tvoc
    state_topic: ${vprefix}tvoc
    unit_of_measurement: 'ppb'
    accuracy_decimals: 2
    filters:
      - sliding_window_moving_average:
          window_size: 16
          send_every: ${vsendevery}

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year 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` Change the title of 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.

(message by CodeOwnersMention)


sensor documentation sensor source (message by IssueLinks)

xconverge commented 1 year ago

https://github.com/esphome/issues/issues/4012 https://github.com/home-assistant/core/issues/85170

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

jamesmyatt commented 1 year ago

@jesserockz , Can this be re-opened please? Either the CCS811 sensor needs to be fixed to output valid units, or Home Assistant needs to be updated to allow ppb.

xconverge commented 1 year ago

I disagree, the CCS811 outputs valid units. I think my adjustment in this issue makes sense and perhaps we could just update the esphome docs?

https://github.com/esphome/issues/issues/4012

jamesmyatt commented 1 year ago

ESPHome components should always use one of the unit_of_measurement that Home Assistant considers valid for the device_class. This component (and others) don't meet that requirement, so either the ESPHome component needs to be fixed (b changing unit_of_measurement or device_class) or Home Assistant needs to be fixed.

You solution is fine, i.e. multiplying to get "ug/m3", but it's not acceptable that you have to fix it manually. It needs to be valid and consistent out-of-the-box.

If the solution is to change the output to "ug/m3", then there could be a separate output in "ppb", but the device class would have to be different.

xconverge commented 1 year ago

ESPHome components should always use one of the unit_of_measurement that Home Assistant considers valid for the device_class. This component (and others) don't meet that requirement, so either the ESPHome component needs to be fixed (b changing unit_of_measurement or device_class) or Home Assistant needs to be fixed.

You solution is fine, i.e. multiplying to get "ug/m3", but it's not acceptable that you have to fix it manually. It needs to be valid and consistent out-of-the-box.

If the solution is to change the output to "ug/m3", then there could be a separate output in "ppb", but the device class would have to be different.

I dont think the 2 projects are as coupled as you are implying them to be. What about someone using esphome who doesnt care about or use homeassistant? (I know about who "owns" the project but my point is still valid)

jamesmyatt commented 1 year ago

Sure. There's no hard dependency between the projects so you can use them separately, but they should follow the same specification.

dxmnkd316 commented 1 year ago

Aside from the fuzziness of assuming a generalized molar mass for VOCs, 4.5 is probably going to be on the high side for your average home VOC. A conversion of 4.5 indicates a pretty beefy molecule as far as the most common VOCs are concerned. The most common VOCs are going to be fuels, monocyclic aromatics, acetone and other paint-related chemicals, NOx, SOx, etc.

For instance, if your house or water heater use natural gas and you're measuring near your furnace or water heater, I'd be much more concerned with methane (and to a lesser extent, ethane and propane). These have molar masses significantly lower (16-44 g/mol, with the vast majority in the 16-20 g/mol range) than the ~100 g/mol a conversion factor of 4.5 assumes. NOx and SOx given off by a gas range or gas-fueled furnace or water heater will be closer to (45-65 g/mol).

That is to say, all of this is going to depend on what you're expecting to encounter. If you're in the garage, maybe you will be closer to the 100 g/mol range given the chemicals often found there. If you're in the kitchen, basement, or near the utility room, you're probably going to be closer to the 20-40 g/mol range.

Reading into the documentation of these sensors, these are all highly correlated with the calibration gas and how (or if) the sensor self-calibrates over time. For instance, the Airthings Wave Plus uses a metal-oxide sensor which basically self-calibrates to whatever the background VOC concentration is because of how the (their?) MOX sensor works. Over time it will use the background concentration of VOCs as your reference point. I wouldn't use a raw ppb or ug/m3 reading and make decisions based on action levels established by the EPA or other governmental agencies.

That said, I'd still suggest adopting ppb/ppm as valid units in Home Assistant. Both these and ug/m3 are valid measurements depending on how the sensor measures VOCs, how its calibrated, and how it reports back to the end user. Adopting ppb/ppm would also remove any additional error introduced by assuming a molar mass.

My $0.02.