Determine UOM for HA on integration setup

I am building a climate integration. The API to the device returns data in both Celsius and Fahrenheit. Celsius is in 0.5 degree increments, F is in 1 degree increments. I’d like to report the data in whatever units HA is set to use, because this will avoid conversion issues that will cause the data not to match what is on the thermostat.

I could add a config parameter and have the user set it. But it would be better to just detect what is enabled. Is there an API call in HA to get this setting?

You could read it from config data store. This is where it is saved into hass data storage.

hass.config.units.is_metric is what you probably want.

For example:
this line

Perfect! Thank you