Automatically set area in script when called by voice

Is there a way to create a script that automatically choses an area based on the device location that it is launched? I’ve got Atom Echo devices in each room running voice assistant and would like to be able to run a script called “Lights!” that would turn on all the lights in a room, based on which Atom Echo hears the command. Right now I’ve got several “Lights” scripts but voice gets confused and then asks me which one I want to execute.

How are you triggering these scripts?

Voice assistant.

Yes, you said you are using Voice Assistant in your OP. But, you said you were triggering “scripts”. HA Scripts don’t have triggers, so either you are using something else to run your scripts, or you aren’t using HA scripts.

For example:

We need to know what you are actually doing in order to tell you how to get the area information.

2 Likes

I’ve definitely got scripts that are being run when I say the name of the script using voice assistant. My assumption was that the voice assistant was looking for a matching script name and executing it. Below is a screenshot of the scripts I’ve been using. I was hoping to have a single script called “Lights!” that would automatically select all the lighting devices in the same zone that the voice assistant device that hears the command is located as the target, then execute the script.