How to find out in which room/area my voice pe is located in a custom intent?

I’m trying to get the location of my voice preview edition in an intent.
In an automation with a sentence trigger I can use “{{area_name(trigger.device_id)}}”. But how can I get the room name in an intent?

Thx in advance
Horst

I haven’t figured it out yet. The data is DEFINITELY I. The conversation stream (if you have an LLM on a VPE… ask it what room it’s in, it knows…) I’m just trying to figure out how to access the data.

In the intent stream the device_id is included, but the problem is to get access to this data in a custom intent.

area_id(trigger.device_id)
then use state_attr

That doesn’t work because there’s no trigger inside the conversation. You need to use a different method to identify the device you’re actually running from. You can make a template sensor that grabs all the VPE devices and pops the active one to the top - but that ONLY works if you only use one VPE at a time - and only works itlf it’s actually a VPE and not the conversation stream in general I’ve already run into issues with that one. It also cannot ID a conversation triggered from a Companion app.

I was actually trying to figure out how to create / ID a first class attribute in the stream that IDs the client and the user attached to the client - that’s ACTUALLY what we need.

Only possible in an automation with a sentence trigger

1 Like

for yaml

  INTENT:
    data:
      - sentences:
          - "your sentence"
        requires_context:
          area:
            slot: true

After that, the area variable is available in the script.

1 Like

It’s not a sentence trigger… You’re already in the prompt.

Now that said I see what you’re doing. Use the requires context…

This might be possible to use by creating a dummy intent and forcing area context. Let me see if that works. (it. Won’t on mobile I’m pretty sure. It doesn’t have an area)

Any intent involves a trigger. Either I’m not fully grasping the task.
If you need to know the value of the room from which the last request was executed, then your variant with an auxiliary sensor is suitable.

It is not when two vpe s are active you only get one or a list which the problem still exists. It also doesn’t trap the mobile case. I’ve already fallen prey to that with the first version I tried.

Artificially forcing area context might be the ticket… But I need more coffee before testing.

Thanks . That’s the solution

Just to close the loop I sat down with this and looked at the reason we didn’t understand each other. OK I figured out the disconnect.

Two scenarios - if you’re using a sentence trigger - like this post, this is the solution.

If you’re inside the prompt and need to tell the VPE what device it’s on for CONTEXT (meaning not the exact call assist is currently responding to but you still need to know where you came from) is common in LLM land and it doesn’t work. There was no intent call. Or it may not be the intent call you wanted - the llm is driving the bus. You’d have to add area context to EVERY intent and - some of what you’re calling isn’t an intent. For that scenario they need an active attribute on the conversation object you can latch on to with calling device and calling user and dump into the prompt as a context item.