Template select Exposed entities

Would really appreciate a way to retrieve in template a list of entities exposed to Assist. Even if exposed status could be available as an attribute, this would be helpful. Especially with the push to Assist / LLM, custom / spec functions to LLMs will absolutely need access to this kind of information. A good example of this is a template_value function that returns a current list of exposed entities for an LLM to update its understanding of the smart home.

Thanks in advance!

looking for the same, have you found a solution?

No solution yet.

looking for the same,any update?

Yup - this is CRITICAL to understanding context load.

I’m pretty sure [state_data] in the context, currently hard limited to 200000 tokens by Open AI in their largest models (ask me how I know - read Friday’s Party. Context is our current issue)

Yes my install is artificially bloated for a reason - but it points out I have no tools to understand what’s going on inside the state data.

expand(exposed_entites)

How big is it, how close am I to redline?

length(expand(exposed_entites))

(Yeah, it really is that simple then /4 for a rough token estimate.)

Or then you could then also take the entire length of the prompt do the calc,

add approximately 10000 tokens for a tools estimate.

Then you have an overall context load estimate. (But we NEED exposed_entities, especially with 2025.4 coming giving us start conversation and continued conversation what you can do with these will quickly gain speed, stay ahead of it with the tools…

2 Likes

vote for this feature

1 Like

This can be done with a command line sensor
Took me a while to learn how, but this works…

# ------------------------------------------------------------------------
# sensor_command_line_exposed_entities.yaml << This is a package
# ------------------------------------------------------------------------

command_line:
# ------------------------------------------------------------------------
# This sensor queries the .storage/core.entity_registry
# 1. It gathers all entities exposed to 'assist'
# 2. It deliberately excludes any entities that have been
#   disabled which have options.conversation.should_expose==true
# ------------------------------------------------------------------------
- sensor:
    name: exposed_entities
    unique_id: exposed_entities
    command: >
      jq '{
      entities: (
        [
          .data.entities[] 
          | select(.options.conversation.should_expose==true) 
          | select(.disabled_by? == null)
          | .entity_id
        ]  
      | sort
      ) 
      }' /config/.storage/core.entity_registry
    value_template: "{{ value_json.entities | length }}"
    json_attributes:
    - entities

recorder:
  exclude:
    entities:
    - sensor.exposed_entities
1 Like