Major inconsistency in letter case - HA bug?

I use integration: GitHub - ollo69/ha-smartthinq-sensors: HomeAssistant custom integration for SmartThinQ LG devices configurable with Lovelace User Interface.
This integration has a sensor that collects data from HA: core/homeassistant/const.py at 85610901e05d110c635d0f3d4db51c760d7f2c3c · home-assistant/core · GitHub
for example strings “off” and “on”.
But on UI i always see “Off” and “On”.
And now, when I try use any logic (for example card visibilty) based on this sensor I have big problem.
Instead of using a “On” that I see everywhere on HA, i need to use “on”.
I only know this because I looked at the code.
A normal user won’t know why it doesn’t work for him (when use “On”).

image

The state value is always 'on' or 'off' (lower-case), you must always use these lower-case state values when writing YAML. However…

The frontend (dashboard cards, editors, etc…) translate these values into a ‘nice’ version with capital letters.

This is intended behaviour, not a bug.

This does tend to confuse new users and was mentioned to the developers when they decided to only show the translated value in the automation editor. Unfortunately it was not changed.

To see the real state of any entity you have to look in Developer Tools → States.

3 Likes