States case sensitive?

This may be by design and something I’ve missed but I seem to have found out that an entities state is case sensitive especially when it comes to Lovelace.

I have a device_tracker entity with the state of home and it displays great in the standard UI but doesn’t display in Lovelace UNLESS I change its state to Home.

I found that the case and the state doesn’t matter in standard UI I can have it as home or Home and it still displays.

Have I found a bug or is this by design?

Everything in HA is case sensitive.

How come it works fine in normal UI then?

If home works in the old UI then Home wont (or shouldn’t).

Why is the case is swapped in Lovelace?

I don’t know.

This is why I posted. Trying to get to the bottom of it.

Might be woth asking over on the Lovelace discord channel.

1 Like

maybe try to post your code here that you are referencing so we can see exactly what you’re talking about.

I don’t think this is a code issue as such, Try it yourself. Change the state of entity from lowercase to uppercase in Developer Tools>States and see if the entity still working in standard UI and then Lovelace UI.

I see what you are saying now but it works exactly the opposite for me…

If the device tracker is in state ‘home’ it works in both UI. If it’s ‘Home’ then it works in the legacy UI but not in Lovelace.

So, at least in my case, the default way the device tracker states get created (home. not_home) work fine in mine in both legacy and Lovelace. I’m not sure why yours would be different. Do you have any type of customization?

I think I’ve found the issue. The state filters in Lovelace had there first letters capitialised which is why they weren’t being picked in the UI. Set all to lowercase and now working in both UI’s.

in my case i see “Home” , and then other times “home”. Its very random, the state comes from nmap tracker and its always home, or not_home.

Also happens in the moon sensor. It shows “Waxing crescent”, but other times “waxing_crescent”, Same with the sun “Below horizon” vs below_horizon.

1 Like

Update: Its fixed now. I’m running 0.84.6 and my guess this was related to some translation bug in Lovelace, anyway, it’s working now.

1 Like

Seems to be for me too :slight_smile: