Use entity status enabled/hidden/disabled programatically

I’d like to read the entity status that can be enabled/hidden/disabled.
For context I want to use this in a card like this:


The card lists all binary sensors that are open. I have multiple windows in a room and usually group them for simplicity. The problem is I am getting the group and the hidden entity that is already part of the same group as open entities.

The only thing that I can think of that distinguishes the individual entity is that it’s hidden. Can I access that hidden status somehow?

It doesn’t appear as an entity’s attribute so it can’t be read using state_attr and there’s no other function available to read it.

This might be a solution:

hidden_by in entity registry: Entities can now be hidden via the entity registry. These entities should default to not be included when exposing entities to an external UI like voice assistants.

The entity registry is where an entity’s properties are recorded. It includes properties that can’t currently be changed via an automation/script (like an entity’s UI visibility).