Allow wildcard strings for Assist conversation intents

I wanted to try to build an assist action for adding products to a shopping list. However, it seems that custom conversation intents do not support wildcard strings. In other words, I have to define the list of possible inputs beforehand, which is not very convenient for this usecase.

I got the following working already, to illustrate my point:

In /config/custom_sentences/en/picnic.yaml:

language: "en"
intents:
  AddProductToPicnic:
    data:
      - sentences:
          - "Add {product} to shopping list"
lists:
  product:
    values:
      - in: "bananas"
        out: "bananen"
      - in: "tomatoes"
        out: "tomaten"

In my main config:

intent_script:
  AddProductToPicnic:
    action:
      - service: script.dynamic_telegram_notification
        data:
          message: "Adding {{product}} to shopping list!"
      - service: picnic.add_product
        data:
          config_entry_id: "*redacted*"
          product_name: "{{product}}"
    speech:
      text: "Adding {{product}} to shopping list!"

This works as long as I add a product from the predefined list, however there does not seem to currently be a way to use any product I want.

This is the support I would like to have added, being able to ingest any string value for the conversation intents.

I found a custom_component that can do this, as I explain in this topic.
However, it would be great if wildcards like this are supported natively in HA.

1 Like

I have been banging my head against a brick wall trying to get this to work, but when I copied YOUR script, suddenly it did.

Except it was an illusion - it seems the key phrase ‘shopping list’ overrides your script and uses some much more effective default script. First I noticed that even misunderstood words got added to the list despite not being defined products, then I played around and found out that replacing ‘shopping list’ from the intent phrase caused using the altered phrase to result in the dreaded error, “Unexpected error during intent recognition”.

So more applying my forehead to walls, I guess.

Had the same problem.
You can use wildcards like this:

lists:
  product:
    wildcard: true

I use it to have a test that lets me check if the messages i send to a bot get parsed correcty.
Altough make sure you have the sentences made propperly or else the product will be tomatoes right now if you tell assist to Add tomatoes righ now to shopping list

Also i encurage you to look into the pre defined sentences to learn how they make the sentences more generic
Homeassistant build in sentences