Voice: Trigger a multi-word script?

Hi all,

I’m trying to figure out if this is possible or if it’s a reportable bug. I have a script called “Late Night”, which I seem unable to trigger from Voice Assistant due to the fact that it is more than one word. However, it seems like there is no way to make a template for more than one word. For instance, here’s the default “name only” sentence for executing a script (from intents/sentences/en/HassTurnOn/name_script.yaml at d7bab6f383ec338d70df985747d23f43946d4dc9 · OHF-Voice/intents · GitHub):slight_smile:

[(activate|run|start|<turn>)] [<the>] {name} [script] [on]

If I say: “Run the sunshine script”, my “sunshine” script runs, detected as:

intent:
  name: HassTurnOn
slots:
  name: sunshine
details:
  name:
    name: name
    value: Sunshine
    text: sunshine
targets:
  script.sunshine_lights:
    matched: true
match: true
sentence_template: '[(activate|run|start|<turn>)] [<the>] {name} [script] [on]'
unmatched_slots: {}
source: builtin

However, if I say: “Run the late night script”, my " late night" script does not run, detected as:

intent:
  name: HassTurnOn
slots:
  name: late night
details:
  name:
    name: name
    value: Late Night
    text: late night
targets: {}
match: true
sentence_template: '[(activate|run|start|<turn>)] [<the>] {name} [script] [on]'
unmatched_slots: {}
source: builtin

So it finds the word, but doesn’t associate it with a script. Is there something I’m doing wrong, or should I report this?

Note: I am able to solve this for my use case, so I’m not looking for ideas there, just don’t want to report a bug if it’s not considered one. I solved it by writing a custom intent like:

conversation:
  intents:
    TriggerLateNight:
      - "[turn|or] on [the] late night [lights]"

intent_script:
  TriggerLateNight:
      action:
        service: script.late_night
      speech:
        text: "Turned on late night"

Have you considered automations with trigger: conversation?

- alias: Leaving Home Voice Trigger
  id: "1223kk3k32123k1233123123"
  triggers:
    - trigger: conversation
      command:
          - "I'm leaving home"
          - "Leaving home"
          - "Run leaving home"
          - "Activate leaving home"
  actions:
    - action: script.turn_on
      target:
        entity_id: script.leaving_home_worker

I know intent scripts exist, but these automation scripts seemed aimed at your use case?

I had, but all of the scripts we use in voice are triggered by the same “turn on” phrase, so I was trying to normalize without needed separate items (be they automations or intents). I’d say your automation method is cleaner in most cases, but I already have a bunch of custom conversation sentences defined in one place, so this particular method works better for me.

My main question is, why doesn’t HA recognize mutli-word items, and was that on purpose?

It does. And I’d have to see your voice debug pipeline to understand what it is actually misunderstanding.

Im also with linwood a sentence trigger is much easier and sidesteps a lot of problems with intents later.