home-assistant / home-assistant.io

:blue_book: Home Assistant User documentation
https://www.home-assistant.io
Other
4.76k stars 7.18k forks source link

Radon unit of measure conversion #31751

Open ch0gan opened 6 months ago

ch0gan commented 6 months ago

Feedback

It would be great if this documentation included the steps needed to convert radon Bq/m³ to pCi/L. Even better if the integration itself offered the option to select a unit of measure. pCi/L is the standard in the United States.

URL

https://www.home-assistant.io/integrations/airthings/

Version

2024.2.5

Additional information

No response

home-assistant[bot] commented 6 months ago

Hey there @danielhiversen, @lastrada, mind taking a look at this feedback as it has been labeled with an integration (airthings) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `airthings` can trigger bot actions by commenting: - `@home-assistant close` Closes the feedback. - `@home-assistant rename Awesome new title` Renames the feedback. - `@home-assistant reopen` Reopen the feedback. - `@home-assistant unassign airthings` Removes the current integration label and assignees on the feedback, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information) to the feedback. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information) on the feedback.
LaStrada commented 6 months ago

Thanks for reporting! Just to clarify, you don't get the correct unit and value with the Airthings cloud integration when setting Home Assistant to use imperial units?

I've not tested this my self, but I cannot see any code that does this conversion from metric to imperial, like we do in the Airthings BLE integration. I'm actually planning on working on something (almost) related later this week, so I can look into this as well.

For reference, here is how it's done in the BLE framework: https://github.com/Airthings/airthings-ble/blob/main/airthings_ble/parser.py#L584

ch0gan commented 6 months ago

So, the value is coming through, but it's coming through in metric (Bq/m³).  Looking at line 471, metric is hard coded in as opposed to looking at the HA settings.  Is it possible to pull the Unit System value from the HA settings?  That would be much better than the work around people are using...  templates and other things I just can't figure out. Thanks


Chuck Hogan @.***

On Tuesday, March 5, 2024 at 05:32:44 PM EST, Ståle Storø Hauknes ***@***.***> wrote:  

Thanks for reporting! Just to clarify, you don't get the correct unit and value with the Airthings cloud integration when setting Home Assistant to use imperial units?

I've not tested this my self, but I cannot see any code that does this conversion from metric to imperial, like we do in the Airthings BLE integration. I'm actually planning on working on something (almost) related later this week, so I can look into this as well.

For reference, here is how it's done in the BLE framework: https://github.com/Airthings/airthings-ble/blob/main/airthings_ble/parser.py#L584

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ch0gan commented 6 months ago

I now realize you sent the link to the BLE integration - which I'm not familiar with.  But yes the conversion code there seems like is what's needed in the default HA integration I'm not a python programmer so I'm not able to propose new code.  What's the process to request changes?


Chuck Hogan @.***

On Tuesday, March 5, 2024 at 06:26:49 PM EST, Chuck Hogan ***@***.***> wrote:  

So, the value is coming through, but it's coming through in metric (Bq/m³).  Looking at line 471, metric is hard coded in as opposed to looking at the HA settings.  Is it possible to pull the Unit System value from the HA settings?  That would be much better than the work around people are using...  templates and other things I just can't figure out. Thanks


Chuck Hogan @.***

On Tuesday, March 5, 2024 at 05:32:44 PM EST, Ståle Storø Hauknes ***@***.***> wrote:  

Thanks for reporting! Just to clarify, you don't get the correct unit and value with the Airthings cloud integration when setting Home Assistant to use imperial units?

I've not tested this my self, but I cannot see any code that does this conversion from metric to imperial, like we do in the Airthings BLE integration. I'm actually planning on working on something (almost) related later this week, so I can look into this as well.

For reference, here is how it's done in the BLE framework: https://github.com/Airthings/airthings-ble/blob/main/airthings_ble/parser.py#L584

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

LaStrada commented 6 months ago

I can do a fix later this week

ch0gan commented 6 months ago

Great. I’m happy to test when ready. 

Sent from Yahoo Mail for iPhone

On Wednesday, March 6, 2024, 1:59 AM, Ståle Storø Hauknes @.***> wrote:

I can do a fix later this week

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ch0gan commented 5 months ago

Have you had a chance to look at this? Looks like it was reported as an issue in January as well, but went stale. https://github.com/home-assistant/core/issues/83015#issue-1470268735

LaStrada commented 5 months ago

Yes, looked into this one, but found out there is an architectural discussion around this: https://github.com/home-assistant/architecture/discussions/732

This could be fixed in the integration, but the best way would be to have a built in unit converter.

LaStrada commented 5 months ago

But there are other ways of fixing this. It seems that it's hard to decide on what units to be supported etc for the converter.

So just to be clear, I haven't forgotten this issue ticket! There are some work going on as we speak, and hopefully we'll have a working solution in either the integration itself or in the cloud/framework (pyAirthings).

ch0gan commented 5 months ago

Okay to the idea is to fix it in in the core system correct? Looks like that conversation died two years ago. Is it possible for me to modify the integration code locally? I have no idea where the python files are stored locally or if they are stored locally.

I also noticed pressure has the same issue. IMG_5857 IMG_5856

LaStrada commented 5 months ago

You can change the unit of pressure by:

Radon can be fixed by creating a template sensor here and choose "Template a sensor"

image
{{ states('sensor.airthings_basement_wave_radon') | float / 37 }}

Number of decimals can be changed by pressing the newly created entity, pressing the cog, and then changing the "Display precision".

ch0gan commented 5 months ago

Thanks. To be clear, this effectively creates a new "sensor" to be placed on dashboards in place of the default one created by the integration. Is this correct?

LaStrada commented 5 months ago

Yes, you will then have 2 radon sensors (Bq/m³ + pCi/L). Only the sensor provided by the integration will be visible in the Airthings integration (devices & services -> Airthings -> device), the other one will be under helpers (devices & services -> helpers)