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

VOC sensor using incorrect device_class - reported in HA logs #23

Open
spikeygg opened this issue Jun 11, 2023 · 2 comments
Open

VOC sensor using incorrect device_class - reported in HA logs #23

spikeygg opened this issue Jun 11, 2023 · 2 comments

Comments

@spikeygg
Copy link
Collaborator

I have noticed in the Home Assistant system logs that my blueair VOC sensor shows up because the units are ppb instead of µg/m³. The log entries look like this:

Entity sensor.blueair_office_voc (<class 'custom_components.blueair.sensor.BlueairVOCSensor'>) is using native unit of measurement 'ppb' which is not a valid unit for the device class ('volatile_organic_compounds') it is using; expected one of ['µg/m³']; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.

I have had this same warning on a few ESPHome devices that I created with a ccs811 sensor and I fixed those by assigning the device_class to volatile_organic_compound_parts (which allows for ppm or ppb units) instead of the default: volatile_organic_compound (which only has the µg/m³ units).

See the valid Home Assistant device_classes here: https://www.home-assistant.io/integrations/sensor/

@SoccerCore11
Copy link

@spikeygg how/where did you make this change to stop getting the errors in the log?

@spikeygg
Copy link
Collaborator Author

@spikeygg how/where did you make this change to stop getting the errors in the log?

It was in the ESPHome YAML file. When you describe the hookup of the sensors to the ESP32/ESP8266 you can also set the device_class of the sensor entities. If you set the device_class of them properly, the error will go away. This is a problem in the definition of the sensors in the BlueAir component source code. If the device_class was set to volatile_organic_compound_parts it would make the error message go away because the units would be fixed.

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

No branches or pull requests

2 participants