How can I get entity_id list to iterate them in templating?

Hi all,

How can I get entity_id list of all devices to iterate them in jinja templating?
I can already add/remove a zwave device by using template sensor/switch.
I also need rename a zwave device after adding it to zwave network.
To achieve this goal, I should handle the last added entity_id.
I am now reading home-assistant.log file to handle last added entity_id, but I dont like it.
Does anyone know that there is a builtin way to do this in HA?

If you select the States menu ā€œ<>ā€ under developer tools, you will see all of your entities listed.

You can get a full list of all your entity_ids and iterate it as follows:

{% for device in states %}
  {{ device.entity_id }}
{%- endfor %}

Although Iā€™m not sure if/how you can use this instead of the current solution you have in place.

1 Like