intents icon indicating copy to clipboard operation
intents copied to clipboard

Missing an option for capturing area prepositions

Open jose1711 opened this issue 1 year ago • 2 comments

There does not seem to be a way to

  • name areas in their basic form (living room, kitchen, terrace)
  • capture the preposition used with area name ([in|on|at]) and correctly reflect the form used by the user in response.

This approach seems to do the job:

-- common.yaml
expansion_rules:
  area: "[{area_prepositions:preposition}] {area}"
lists:
  area_prepositions:
    values:
      - in
      - on
      - at
-- fixtures.yaml
areas:
  - name: "kitchen"
    id: kitchen
  - name: "living room"
    id: living_room
  - name: "terrace"
    id: terrace
-- responses/..
intents:
  ..
    default: "Doing something {{ slots.preposition | default() }} {{ slots.area }}"

When testing with parse --sentence the sentence is correctly interpreted, slots are set as follows:

{
  "slots": {
    "device_class": "light",
    "preposition": "on",
    "area": "terrace",
    "domain": "light"
  },
  "response": "Doing something on terrace",

The problem here is that this will not pass the tests:

AssertionError: Intent xyz does not support slot 'preposition'. See intents.yaml for supported slots

Overall I am missing a way to capture a piece of text (similar to regex groups) and then use it in responses.

jose1711 avatar Mar 21 '25 10:03 jose1711

Good idea @jose1711 🙂 What do you think about this? https://github.com/OHF-Voice/hassil/pull/229

synesthesiam avatar Aug 14 '25 18:08 synesthesiam

Good idea @jose1711 🙂 What do you think about this? OHF-Voice/hassil#229

I very much like your proposal and can't wait to be able use the captures in the intents.

jose1711 avatar Aug 18 '25 15:08 jose1711