Is there a way to export the list of Entities from your HA to a file?
It would be nice to be able to get a list of all your entities to import into an Excel file, database, etc., so that you can organize them outside of HA.
Is there a way to export the list of Entities from your HA to a file?
It would be nice to be able to get a list of all your entities to import into an Excel file, database, etc., so that you can organize them outside of HA.
there are probably several ways, but you can try directly through the browser. Open the console in developer tools. Enter this command
const hass = document.querySelector('home-assistant').hass;
hass.entities
You will see the whole entities object in hass
To avoid confusion:
There is no console in Home Assistant’s Developer Tools.
They mean in the Web Browser Inspector. Which does not work for me:
Another way is to use the actual Home Assistant Developer Tools → Template editor and enter:
{{ states|map(attribute='entity_id')|list }}
it has to work… open Home Assistant in your browser (e.g., http://homeassistant.local:8123), go to console … paste this full script into console…
function downloadEntitiesCSV() {
const hass = document.querySelector('home-assistant').hass;
const entities = hass.entities;
const sorted = Object.values(entities).sort((a, b) => {
const idA = a.entity_id?.toLowerCase() || '';
const idB = b.entity_id?.toLowerCase() || '';
return idA.localeCompare(idB);
});
let csvContent = "ENTITY ID,NAME,PLATFORM\n";
sorted.forEach(entity => {
const entity_id = entity.entity_id || '';
const name = entity.name || '';
const platform = entity.platform || '';
csvContent += `"${entity_id}","${name}","${platform}"\n`;
});
const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.setAttribute("href", url);
link.setAttribute("download", "hass_entities.csv");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
then type and run…
downloadEntitiesCSV();
file hass_entities.csv will automatically download to your system
Uh huh. So That screenshot I made is a hallucination.
No thanks.
Worked after a cache clear. Odd.
@VietNgoc is Console the same at Terminal?
No:
I’m sorry. What is a Web Browser Inspector? Can you take a snapshot of it and post it? I do not see it in my copy of HA.
check How to open DevTools in the browser and console section…