Announce devices Home

I would like my TTS system to announce devices that switch to home. I know how to set this up for a specific device. But is there a way to make TTS announce the last device that turned “home”?

A lot of people mention there name in their phones name. This way I could welcome visitors by TTS is a fun way. (as long as they connect to my WiFi network of course).

For example: It would be cool if NMAP detects a new phone on my WiFi network, a automation would be triggered to announce the device name by TTS.

(Welcome home “device name”) where the device name is the name of the device last switched to home.

I dont think you could for new devices since you don’t know exactly what they are going to be called… If a device has been tracked before then you know the name and can add automations to greet the person when their phone connects to your wifi easily, but I can’t think of a way to do it for devices that have never been connected before.

There might be a way to monitor the known devices file and see if it added a new device, then use whatever name that device has by default… but it seems like a lot of unnecessary work and their phone name might be something random like mine which has a ton of numbers in it. But, this would require your own python script or similar from a command line sensor or something, just too much work to be worth it IMO unless there is a better way I don’t know of.