Closed strikeir13 closed 3 years ago
I just dumped the result from the API and it appears that it does provide the unit in the response:
...
"currentSensorValues": [
{
"type": "radonShortTermAvg",
"value": 5.19,
"providedUnit": "pci",
"preferredUnit": "pci",
"isAlert": true,
"thresholds": [
2.7,
4
]
},
...
Right now this componenet is hardcoded as "radonshorttermavg": ["Bq/m³", None],
but I could not figure out in the Home Assistant developer documentation how you are supposed to properly set the values for metric/imperial such that Home Assistant is able to do the conversions based on what the user has selected for the frontend. I think a kludge for the moment is to just set the unit to whatever is returned from the Airthings API and it will potentially not be in sync with the metric/imperial setting in Home Assistant.
I'm located in USA and the radon units on my Airthings Dashboard are pCi/L.![image](https://user-images.githubusercontent.com/688283/98265642-f3047d80-1f4e-11eb-94a0-431c56111a12.png)
I'm not sure if the displayed units are different for different countries, but the units are incorrect for me (though the numerical value is correct). Per https://www.ncbi.nlm.nih.gov/books/NBK230646/, "1 pCi/L is equal to 37 Bq/m3" so maybe a simple conversion could be added based on location, sourced either from Home Assistant or perhaps based on the units selected in the Airthings Dashboard (I don't know what's available).