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.
OMG! You’re right @Dolores… why I have focused on dot? every entity has a dot!
Yes… the problem was the starting digit.
The solution came from @nordlead2005… thanks!