Closed ChrisRomp closed 2 years ago
Thanks for letting me know. I'll look into making the change soon.
I added the workaround but would like to use the translated states of these sensors eventually. I'll keep the issue open until I find a resolution.
@ChrisRomp , do you know how to pull the translated value instead of the key?
They've switched to using keys to facilitate translation/localization.
Oh sorry I misread your question. I don't know how to pull the translated value from the front-end, no.
Managed to getting the translated state values after a lot of digging.
Calling hass.localize()
and passing the translation key based on the component translation: sensor.en.json
Explanation of how you can find the translation key can be found here: frontend-translations
Thank you for figuring this out and providing links. I will also update the code to translate the pollutant label.
HA Core recently updated the AirVisual component state descriptions to use keys to facilitate translation. This means that the output of the state is now (for example)
unhealthy_sensitive
instead ofUnhealthy for Sensitive Groups
.Ref: home-assistant/core/pull/53133
As a workaround, this AirVisual Card configuration can be changed in Lovelace so the
air_pollution_level
parameter is mapped to thesensor.u_s_air_quality_index
sensor since you already have an array calledAPLDescription
with these values (ref).I'm unsure if you want to fix this in code to translate the state keys, or just update the docs and/or remove the
air_pollution_level
parameter altogether and just useair_quality_index
instead.