How can I programatically list entities and their attributes?

I need to retrieve, programatically(*), the list of all entities and their attributes (notably its label(s)). I will then filter for specific labels and inquire about their state.

After having gone though Entities: integrating devices & services | Home Assistant Developer Docs, Config Entries | Home Assistant Developer Docs, Hass object | Home Assistant Developer Docs and other docs I cannot find THE place to query in order to get both the entities list and their attributes (I found how to get a bare list of entities, that’s all).

What is the proper way to access them?


(*) I will be using pyscript for that

I found it in the code for the frontend at frontend/src/data/entity_registry.ts at 6421a9443dae28f1d10eee923623d9fc75a7572c · home-assistant/frontend · GitHub

You need to send to the WebSockets API the message

ws.send(
            json.dumps(
                {
                    "id": 10,
                    "type": "config/entity_registry/list",
                }
            )
        )

It looks like there are plenty of API calls that are not documented.