I have a binary sensor set to device_class: window
The entity card shows its state as open and close which is expected.
But Dev Tools shows the state as on and off
From this point, it’s not surprising that 3rd party cards like custom:button card show on/off too.
Is anyone able to explain this inconsistency, or has every single card secure this conversion on its own?
Custom button card doesn’t use the translations built into home assistant. That’s why you see on/off. on/off is the backend, open/closed (or any other language) is the translated state meant for the ui.
It makes sense. I just lived in the impression that those “named states” also appear in the backend.
Then maybe an additional question: the translation must be hardcoded into each card component separately (what about language translations then (if exist)? or is there a dedicated endpoint that provides them according to the entity class?
They are not hardcoded, they are delivered with every installation in the backend. The card just needs to add the translations. I’m not familiar enough with the code to provide examples, but every card has access to them and they don’t have to hardcode it.