Ensure you have a working TTS with Echo Devices (Alexa) as Media Player - Testers Needed
Then simply replace TTS_voice = self.get_state(“sensor.last_alexa”) with
TTS_voice = “the actual name of the device”
There have been a number of improvements in Echo Devices (Alexa) as Media Player - Testers Needed since I wrote this.
check this for last sensor https://github.com/keatontaylor/alexa_media_player/wiki
If you only have 1 alexa then the above is not required just code the name