nielstron / ha_bayernluefter

Custom component for the Bayernluefter
Apache License 2.0
8 stars 4 forks source link

convert grams per cubic meter to milligrams is not correct #11

Closed MaxiKingXXL closed 1 year ago

MaxiKingXXL commented 1 year ago

The current "grams per cubic meter concerts" code concerts into kilograms:

convert grams per cubic meter to milligrams per cubic meter

    try:
        self._state = self._bayernluefter.raw_converted()[self._type] / 1000

The correct conversion into milligrams should be:

        self._state = self._bayernluefter.raw_converted()[self._type] * 1000

Nevertheless my preference would be to show "grams per cubic" as in the source

nielstron commented 1 year ago

The reason that it is milligrams per cubic meter is that I used a constant from the home-assistant defaults (CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER) for the unit and it seemed at the time of writing sensible to also covert to this value when the constant exists.

However it was written years ago, there may be sensible reasons to move to g/m³ (ideally the reason is that HA per default now measures in g/m³ or that it is the default for humidity measuremtn)

nielstron commented 1 year ago

Btw did you check if just the comment is incorrect or that the output is incorrect? Might be that the bayernlüfter package just returns kg/m³ and I messed up the documentation. I don't have a BL running currently to check it myself.

nielstron commented 1 year ago

Looking at my own image provide in README this number actually looks totally wrong. Thanks for spotting this!

nielstron commented 1 year ago

Fixed in 70b2741fd771e5c0290931a0a89474495f75b0ca