Limych / ha-iaquk

Indoor Air Quality Sensor Component for Home Assistant
MIT License
105 stars 15 forks source link

Wrong index with TS0601 with init µg/m³ #111

Closed diveschumi closed 4 months ago

diveschumi commented 1 year ago

Hello,

could it be that I get a wrong index with my smart air house keeper TS0601, which has the following sensors: CO2: ppm Formaldehyd: µg/m³ Pm25: µg/m³ Voc: ppm Temperature and Humidity

I think, the unit µg/m³ and ppm at Voc is the problem. When I generate new sensors with recalculation µg/m³ to mg/m³ and voc to mg/m³ the index seems to be right.

Limych commented 11 months ago

@diveschumi How do you do the calculation? By simply replacing the units with new ones or by mathematically converting the values into new units?

It will be useful if you enable debugging mode and publish logs here with the correct calculation and the incorrect one. How to enable debug mode — see at the end of the README.

himekifee commented 8 months ago

From the pdf in repo, the unit for TVOC and Formaldehyd seems to be mg/m^3. However, the default and only available unit for both device classed are ug/m^3. If manual set to mg/m^3, an error would be reported as follows

WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.tvoc (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'mg/m³' 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 create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22
WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.hcho (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'mg/m³' 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 create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22

So ideally, the calculation in the component needs to do a conversion first from ug/m^3 to mg/m^3.

himekifee commented 4 months ago

Is this fixed? Seems still wrong to me. The sensor unit is ug/m^3.

Limych commented 4 months ago

I haven't fixed this issue. I just closed it. The author of the issue complained that units were being converted incorrectly. New tests have been added to the code. It guarantee that the conversion will now always be physically correct. This means that this issue no longer makes sense.