How to use an entity with dot in his name?

My media player has dot in his name (media_player.2dcgyqlkw6f6e)

So this config that are working for other media players in my network get me back an errot for the dot…

{% if is_state('media_player.2dcgyqlkw6f6e','playing') %}
   {{ media_player.2dcgyqlkw6f6e.attributes["media_title"] }}  
{% else %}
   Inattivo
{% endif %}

How I can solve?

I must be missing something. I don’t see a dot in that media player’s name.

Isn’t your template missing a period after attributes?

It isn’t the ‘.’ that is the problem, it is the number 2 as the leading character.

In your template use

states.media_player['2dcgyqlkw6f6e'].attributes

instead

I’m not sure if you’d have to do the same for the is_state(), since I typically just access things directly with an else fall back case.

EDIT: you were also missing the leading “states” since that has to be there in front of media_player unless you are passing it into a function which prepends it.

1 Like

Try this for your template:

{{ states.media_player.2dcgyqlkw6f6e.attributes.media_title}}

OMG! You’re right @Dolores… why I have focused on dot? every entity has a dot! :thinking:
Yes… the problem was the starting digit.
The solution came from @nordlead2005… thanks!