Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VOC and CO2 string sensors #48

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

iomartin
Copy link

@iomartin iomartin commented Nov 3, 2024

It is very convenient to have the radon sensors that translate the numeric value into a string ("very low", "low", etc.). As an user, I not necessarily know what are reasonable ranges for the measurements and having these strings makes it easy to know at a glance if I should take action or not.

This is true for VOC and CO2 as well, but the library (and HA) do not have string states for them, only the numeric values. So this PR adds two new sensors (for devices that support it), which are string states for VOC and CO2. The ranges were obtained directly from the Airthings website (CO2, VOC). I copied them almost verbatim, except for the CO2 ranges 0-249 and 5000-39999, which are missing from the Airthings website (I just extrapolate to names that seemed reasonable). I want to make clear that this PR is not my personal endorsement for these ranges, I know nothing about what constitutes good and bad VOC and CO2 levels.

Also, I did not test the part that goes through _get_service_characteristics(), as the pytests do not go through that function, I just followed what is done for the radon levels. If the maintainers can easily check that this is correct, that would be great.

If this gets approved and merged, then I will work in the HA part to expose these them as new entities.

The next commit will add new level names for CO2 and VOC, so make
clear that these ranges are specific to radon levels.
This is similar to the Radon level strings, but for VOC.

The levels and descriptions were taken from [1]. I merely copied the
ranges provided by Airthings and do not claim that they are reasonable,
accurate or otherwise.

This is convenient as an end-user has no idea what are acceptable
measurements, giving them a text sensor makes it easier to spot
problems.

[1]: https://www.airthings.com/en-ca/contaminants/what-is-voc
This is similar to the Radon level strings, but for CO2.

The levels and descriptions were taken from [1]. I merely copied the
ranges provided by Airthings and do not claim that they are reasonable,
accurate or otherwise.

This is convenient as an end-user has no idea what are acceptable
measurements, giving them a text sensor makes it easier to spot
problems.

[1]: https://www.airthings.com/en-ca/contaminants/what-is-carbon-dioxide
@baudneo
Copy link

baudneo commented Feb 4, 2025

I vote for this. This is the first thing I did after adding the airthings devices. I had to use template sensors, having them from source would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants