Add Location context to Voice sentence trigger

Hi,
I need a little nudge in the right direction. Let’s create a fictional scenario to explain this.

I want to say something like: “[Wakeword], decrease the number of people in X to 0.”
Ideally, I’d like to create a single automation that can handle all possible values for X (e.g., Living Room, Kitchen, etc.). However, it seems like this isn’t straightforward with the automation tool —or maybe I’m just missing something.

So, my question is: Is there a way to extract the value of X from the spoken sentence?
Alternatively, is there a way to say something like, “Set the number of people in the current room to 0,” and have it automatically apply to the room/area where the voice assistant is located?
Thanks as always in advance. Love this community.

Are you using an automation with a Sentence trigger or setting up intents/scripts?

currently im using the sentence trigger. I please elaborate on the scripts and intentions.

For Sentence triggers there are a couple ways to get the area name.

  1. Add slots to your trigger sentence by using the template sentence syntax.
  2. For sentences that do not contain the actual area (like your “Set the number of people in the current room to 0” example) you can get it via the following template:
    {{ area_name(trigger.device_id) }}

In addition to using automations with Sentence triggers, it is possible to expand Assist’s capabilities by adding custom sentences/intents and intent scripts directly to the related integrations’ configurations. Using this method is more complicated than using Sentence triggers, but also has some additional functionality.

This post might help