Change audio file IP address to use DNS?

I need to change the IP address on media clips to include a domain name instead of a raw IP address. Here’s the scenario:

  1. I have several small media player (speaker) which use ESPHome to play announcements when events happen in my summer home (I’ll call it “local”).
  2. The announcements are generated by the Google Text-To-Speech media module.
  3. I want to place one of the speakers in my winter home, approximately 650 miles away, and have it play the announcements there (I’ll call it “remote”).
  4. When an announcement is… announced, Home Assistant sends the text to Google and receives an MP3 file containing the speech in return. This file is written to storage on the local HA server.
  5. HA then sends a URL containing the local IP address and path to the MP3 file to the media player, so that the player can fetch and play it. I poked a hole in the remote router’s firewall for this, and that part works well. The URL looks sort of like
  6. Because the remote media player is on a different network, it can’t get to the file to fetch and play it. The media player tries anyway, and then it crashes and reboots.

I already have a firewall rule on the local router to allow access to Home Assistant. So, if I can replace the address (“” in the above example) with the server domain name (e.g., “”), then the remote media player will be able fetch the MP3 file and play it. Problem is, I don’t know of a way to do that.

Does this all make sense? How can I get Home Assistant to use my domain name instead of the local LAN address?