Hassio changes entity name every time I restart

Hi people

Just looking around with automation and found out that every time I reboot (restart) hassio, it changes entity names for some of my devices.

For example, I’ve got three Samsung TVs with entity names: media_player._ for room1, media_player.__2 for room2 and media_player.__3 for room3.

So, I’ve made some automation with tv in room1 using entity name media_player._ and it worked just fine. But! After restarting my hassio changed room1 tv entity name from media_player._ to media_player.__3 so I had to reconfig all automation I’ve set up before.

Seems like entity names are needed to be configured somehow manually for every tv.

Any ideas how to fix it?

Thank you.

what kind of media player? Have you tried hard coding them in your config instead of using discovery?

my tv configuration looks like this:

TV

media_player:

  • platform: samsungtv
    host: 192.168.1.–
    port: 8001
    name: TV1
    mac: 68:27:37:e5:–:--

  • platform: samsungtv
    host: 192.168.1.–
    port: 8001
    name: TV2
    mac: 68:27:37:e6:–:--

  • platform: samsungtv
    host: 192.168.1.–
    port: 8001
    name: TV3
    mac: 68:27:37:e6:–:--

What I find odd is that it’s not using media_player.tv1 as the name after you specify a name in the config.

Is there a way to assign entity name manually for each tv?

should be using tv1, tv2, tv3 etc. Do you have other media players that have that name?

Actually, instead of tv1, tv2 and tv3 I’m using names that consist of two words in Cyrillic for each tv. Wonder if it’s allowed, but it works somehow.

That’s your problem. You’re using characters that don’t translate into a good entity_id. Which is why you are getting __1 __2 __3. Use characters between a and z. Then in your customize section, rename it to the Cyrillic characters.

Wow! Thanks a lot! Seems like it solved the problem.

Yeah, other languages don’t work well as entity id’s. I believe home assistant restricts the characters to a-z0-9. So when you add unknown characters, it replaces it with underscores or nothing. It makes sense because I don’t think you can ‘code’ python in other languages (I’ve never tried).

It’s a pretty good idea to get automatic transliteration from Cyrillic to Latin. Technically it’s not very difficult. Or to check configuration files while editing to avoid Cyrillic characters to be entered.