How to get the IP of a Media Player

Is there a way to get the IP address of a media_player?

Context:

I’ve written a script that uses the rest_command functionality in order to get over a bug in the Bluesound plugin. This way I can still write scripts that use the functionality of my players correctly.

However, in order to get to the player I need an IP adress. I now get these from selecting the entity from my router’s integration. However I would much rather couple this to the media_player entity to remove the extra complexity.

More on the script and Bluesound plugin: