Confused about how to get sensor names

New to HA :smiley: I’m trying to add the Emoncms History integration, which involves editing Configuration.yaml and in particular adding a bunch of lines listing all the sensors I want to send. So I found my way to http://homeassistant:8123/config/entities and can at least see the sensors I want to send.

But I have no idea how to copy the names of the sensors. I’m hoping there’s some way to simply copy the names of the senors and paste them into my Configuration.yaml file. But I can’t find any sensible looking buttons on the page, and there’s no link to any help either. Googling hasn’t managed to find anything useful either, so I’m hoping asking here might? :pray:

In the entities page, click on the entity you want, then on the cogwheel top right in the pop-up.

You’ll see and entity_id field with a copy button next to it.

You need to use the copy button. If you highlight and copy you’ll only get the second part of the entity ID - ie occupied_probability instead of sensor.occupied_probability.

You just highlight and copy them with a catch:

  1. Highlight the entity name.
  2. Without letting go of the mouse button, keyboard shortcut to copy (Ctrl+C for Windows).
  3. Let go of the mouse button and click outside the window that pops open to close it.

Alternatively, you can copy the entire page, dump it into an Excel/Google Sheets/etc. but you’ll have to do some manipulation to lay everything out right.

Thanks. That only copies them one at a time. I was hoping to be able to select all the ones I need?

Thanks also. This variant seems to have another catch or two - with my browser as it was I was looking at sensor.h5075_62fb_... and if I selected that I just got sensor.h5075_62fb with the rest of the name :frowning: And then having done it once I don’t seem to be able to choose a different sensor now?

This sounds like a more hopeful approach but how do I copy the entire page?

You could have done them individually by now! :grin:

I did a little sleuthing. All this was done from Windows.

I have the Samba share add-on installed. I used it to grab a copy of core.entity_registry (located in /homeassistant/.storage). Using PowerShell ISE, I ran this script:

$jsonContent = Get-Content -Raw -Path "***file path to core.entity_registry"

$jsonObject = $jsonContent | ConvertFrom-Json

foreach ($entity in $jsonObject.data.entities) {
    $entityId = $entity.entity_id
    Write-Host "Entity ID: $entityId"
}

And it spits out a full list of all entities. A few things to keep in mind:

  1. Do not edit the file in HA. Make sure you copy it to your local desktop.
  2. Pretty sure you’re going to see everything…even stuff that isn’t readily available in the “entities” list and/or is disabled.
  3. Other things I haven’t thought of.

Excellent! Many thanks, Ryan :smiley: I’m on linux so I just used scp to copy the file to my desktop. It’s late now so I’ll have a play with the file tomorrow when I’m fresher.

edit tomorrow to add: I just used grep and sed to extract what I needed:

grep sensor.h5075_ core.entity_registry > g1
sed -e ‘s/ “entity_id”: "/ - /’ g1 > s1
sed -e ‘s/",//’ s1 > s2

There are probably better ways to do it, but life’s too short :slight_smile:

2nd edit: I see that the forum helpfully edits out white space but I can’t be bothered to work out the ‘correct’ way of quoting the commands.

1 Like