aijayadams / hass-blueair

BlueAir sensor integration for HomeAssistant
34 stars 15 forks source link

[question] Are non-ascii characters home-assistant best practice? #7

Closed aijayadams closed 2 years ago

aijayadams commented 3 years ago

I don't know the answer, so please don't interpret the question as being opposed to the correct units, I just noticed that there is some translation to ascii happening in other components and couldn't quickly find guidance on the homeassistant developer page.

eg, µg/m³ becomes u0xb5g_per_mu0xb3 on export through the Prometheus integration (presumably because on the Prometheus side the Unicode characters arn't supported?)

image

spikeygg commented 3 years ago

wow, I see what you mean from your screenshot. I don't use Prometheus but that doesn't look right. To be honest, I was looking for a constant that was pre-defined like the TEMP_CELSIUS and PERCENTAGE for those other air quality sensors and I came up empty handed so I just hard-coded them. TBH, I find the Home Assistant docs very difficult to use. I know, however, that Home Assistant has support for the unicode units by default because I saw them previously with built-in sensor data. For that matter, all temperatures have unicode... how does Prometheus handle °F or °C because the degree symbol is another unicode character.

aijayadams commented 3 years ago

image

It looks like the Prometheus exporter for HASS is smart enough to use the full word. I think I'll probably have to go look at how that built in unit intelligently uses the °C form in Lovelace, and "celsius" on export.