Template to return a list of entities

Heya! I need a list of entities for ZHA integration.
I used

{{ integration_entities('zha') }}

but this returns only entity id’s - how can I have id and friendly name in format:

entity_id1, friendly_name1
entity_id2, friendly_name2

entity_id10, friendly_name10

Something like this?

{% for entity in integration_entities('zha') -%}
  {{ entity }}, {{ state_attr(entity, 'friendly_name') }}
{% endfor %}
1 Like

omg! this is what I needed! Thank you!

so the script was happy for a long time till a recent update :frowning_face:

Migrate legacy File notify service for domain `file`
The File notify.print_export service is migrated, but it seems the old notify service is still being used.

A new notify entity is available now to replace each legacy notify service.

Update any automations or scripts to use the new notify.send_message service exposed with this new entity. When this is done, select Submit and restart Home Assistant.

and a file is just full of brackets


1517 lines of brackets

Are you hoping that we’ll be able to help without seeing your script?

1 Like

omg I thought I put it already :face_with_open_eyes_and_hand_over_mouth:

export:
  alias: print_entity_attributes
  sequence:
    - service: notify.print_export
      data_template:
        message: |
           {% for state in states %}{{ integration_entities('Zigbee Home Automation') }}
           {% endfor %}
  mode: single
  icon: mdi:cloud-print-outline
  

configuration.yaml:

- name: print_export
  platform: file
  filename: /config/www/export.txt
  timestamp: false

Bizarre. That iterates through every State object in the system, and for each one, prints the list of entities associated with “Zigbee Home Automation”. That list is empty, probably because that’s not the backend name of the integration.

Surely your message template should be as per @pjcrosier’s post above?

{% for entity in integration_entities('zha') -%}
  {{ entity }}, {{ state_attr(entity, 'friendly_name') }}
{% endfor %}

It was working just as I used it a few times.
Also, the integration name is correct

weird

It really wasn’t; not using that template, at least.

No it isn’t. The backend name is as in the URL when you go to the integration screen (I’m using FKB as I don’t have any ZHA stuff):

Try your template out in Developer Tools / Template:

that is even more bizarre! I already had there zha instead of Zigbee (…) nd it works perfectly fine! Thank you for pointing me in the right direction. But how on earth my script code has been changed? no idea :stuck_out_tongue:

1 Like

all works as expected

export:
  alias: print_entity_attributes
  sequence:
    - service: notify.print_export
      data_template:
        message: |
           {% for entity in integration_entities('zha') -%}
           {{ entity }}, {{ state_attr(entity, 'friendly_name') }}
           {% endfor %}
  mode: single
  icon: mdi:cloud-print-outline
1 Like

I am seeing that integration_entities() does not return entities in “unavailable” state… is that expected?

I just performed a test, using the Ambient Weather integration, and integration_entities() reported all of the integration’s entities, including entities whose current state is unavailable.

The test was performed with version 2025.5.1.

fwiw, I am testing with browser_mod. Hmm… taking a closer look, what’s actually missing is “not provided”… although if I click into the entity, it shows “Unavailable”

What I am after is getting a list of “not provided” entities via the rest api…

Review the displayed warning message.

The entity is no longer being provided by the google_assistant integration.

If the integration no longer provides it, then it is not accessible to integration_entities() because it’s designed to report enabled entities.

It’s visible in the Entities view because it offers a broad range of entity filters, including “Not Provided”.

So how can I, for example using the websockets api, get a list of all such entities that are no longer being provided? How does the frontend decide this?

What does " it offers a broad range of entity filters" mean?

Sorry for the newbie questions.

Thank you
Dan

The list of filter options displayed along the left side of the screenshot you posted.

Have you seen anything in the Websocket API’s documentation that would allow for that? Or the REST API?

Not directly, hence my question here. But the frontend, which I can only assume uses the websocket api, has access to the same information that any websocket client would have.

Somehow the frontend decides what is “not provided”. I am trying to understand how it does that.