ESPresence for speaker selection?

Thanks for ESPresence home assistant knows the room where I am. I also have a Google speaker in each room. Would it be possible to automatically select the speaker based on room presence? For example, i want a voice announcement to only be played in the room where I am. I could imagine doing this with if staments inside the automation but I’m hopping of a better approach like creating a new speaker entity that get linked to the relevant speaker as i move rooms. Is this possible? If so, could you point me in the right direction.

I did just that with the help of this video.

This file is what you need to get started and adapt to your HA environment.