How trigger an Automation with Assist?

I’m trying to activate an automation using its saved name (in my case Good Night), but Assist doesn’t understand.

If I try to “Disable Goodnight” or “Enable Goodnight” the automation become disabled/enabled but not triggered.

How can I trigger an Automation using a name or a defined sentence? (Alexa Routine style…)

Can be a “language” issue? I’m using Italian Language…

what about showing us the Automation in YAML and Correct formatting

we mite see something you miss

\

1 Like
alias: Buonanotte
description: ""
trigger: []
condition: []
action:
  - type: turn_off
    device_id: ccae0000cae4ac613bf30bd0e00f6000
    entity_id: light.lampada_scrivania
    domain: light
mode: single

It’s a simple Automation used to try Assist Integration. It just turn off a lamp

my understanding is an Automation will only trigger when a trigger is trigged

you don’t have a trigger

I think you need to go down the Conversation

like added a custom sentences

then you can add a Aliases to the Lights

so you can tell it difference name to turn on/off the same light

2 Likes

Thank you for your answer @myle.

Yes there is no trigger in my automation: I would like use my voice or my text as trigger. Also, my intent is not to turn off a single light but to initiate a series of actions following the “Goodnight” command, triggered by voice or text using Assist.

For my use case I will try intent_script


Update:
Unfortunately, I believe that intent_script cannot call other scripts in turn.

Therefore, I cannot use a word or a sentence to activate/run/trigger a script/automation?

Then you want a script.

They definitely can… as Tinkerer stated, you should be using a script if you don’t have a trigger.

conversation:
  intents:
    GoodnightRoutine:
      - "Goodnight"

intent_script:
  GoodnightRoutine:
    speech:
        text: "Running Goodnight routine"
    action:
      service: script.goodnight_routine

For existing automations using the automation.trigger service works as well*

intent_script:
  GoodnightRoutine:
    speech:
        text: "Running Goodnight routine"
    action:
      service: automation.trigger
      data: {}
      target:
        entity_id: automation.goodnight_routine

* The automation.trigger service bypasses conditions by default and does not create a trigger variable so it is not appropriate for use with automations that rely on trigger-variable-based templates or trigger-id-based conditions.

  • Set up an input_boolean (toggle) helper
  • Add a state trigger to the automation for that entity going to 'on'
  • Add an action at the end of the automation that turns it 'off' (service: input_boolean.turn_off)

As an added advantage, that’ll then be exposed to the Android Auto “interface”, such that it is at this stage of development.

Yes, thank you! When I wrote the update note I converted the automation into a script.

Then I didn’t know how to link a script to the intent_script because of the lack of explicit documentation about it. If there is, please point it out, thank you very much!

Thank you also to @Didgeridrew, I’ll try to add action.service=script.my_script

is it possible to have the source (the name of the speakeror satellite) in the trigger ?
I would like to have an automation that don’t do the same things depending on the context.
like for instance i want to be able to say “light” and it turn on the light in the correct room
or just saying “turn off” and it turn off the light or the music on the correct room

Just add a sentence command as the trigger

alias: Buonanotte
description: ""
trigger:
  - platform: conversation
    command: Turn off the light

but how do i get information on the source ? like the area, satellite, device, pipeline or anything to have an idea from where this sentence was said ?

Each voice assistant has an entity called “Assist in progress”. You can use that as a condiditon.
So, if you say turn off the lights, and the Bedroom voice assistant state is Assist in progress, it will turn off the lights in the bedroom.

thanks for the idea, it’s a start, unfortunately it can’t be super reliable because it means I must not have 2 speaker assisteing at the same time. but it’s a good idea to start thanks
They said the context exist they know from which satellite it’s coming from, i hope it will be made available

Pipeline iis a state also. You can set up a seperate pipeline for each assistant satellite and use that as the condition.

I’m not sure to understand can you precise please ?

Never mind. I don’t think that will work. I believe my first suggestion is the best idea right now.
If I come up with something better, Ill let you know.
Each satellite has their own ID, but its not available as an entity.