Can an automation be triggered using a voice command?

I have an automation named Christmas Lights which turns on several devices at sunset. I have it exposed to Alexa and Assist. So not being sunset, I removed the trigger and it still did not work with voice commands. Then I used a trigger of a specific time and at that time said “Alexa, turn on the Christmas Lights”. Still didn’t work. When I used Assist it responds "Turned on the automation. Is there a way to run an automation using voice commands? Or should I just write a script?

-Thanks

In HA, “Turning On/Off” an automation is actually enabling or disabling it, not triggering it. You can add a Sentence trigger in the automation itself if you want to trigger it using Assist commands.

Options:

  • Use a script, which once exposed, should be available as a “scene” in the Alexa app. Assist has a specific intent sentence for turning on a script.
  • Use a Helper as a proxy between Alexa and HA. This could be an Input Boolean Helper, a Template Switch, or a Template Light. For the Input Boolean, you would add that as a trigger in your existing automation.

Thank you! The sentence worked for Assist. I think I can add two triggers using two different sentences for “Christmas lights on” and off.

If your christmas light are an entity in HA then you expose this entity to assist and nothing else is needed… if this entity is called christmas lights then you can just say christmas lights on to assist and it works.
Or off if you want that at the end of the year. :slight_smile:

Yes thank you. I took Didgeridrew’s suggestion and created an automation with two sentence triggers, and added a sunset trigger. So now I can just press the power button on my phone and say “Christmas Lights On|Off”. And they will also come on at sunset.

Updated to calling two scripts to handle all of the on/off actions.

I am so glad I switched from Hubitat to Home Assistant!!!

alias: Christmas Lights
description: ""
triggers:
  - trigger: sun
    event: sunset
    offset: 0
    enabled: true
    id: sunset
  - trigger: conversation
    command:
      - Christmas Lights On
    id: lights on
  - trigger: conversation
    command: Christmas Lights Off
    id: lights off
  - trigger: time
    at: "16:00:00"
    weekday:
      - sun
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
    id: time
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - lights on
        sequence:
          - action: script.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: script.christmas_lights_on
      - conditions:
          - condition: trigger
            id:
              - lights off
        sequence:
          - action: script.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: script.christmas_lights_off
      - conditions:
          - condition: trigger
            id:
              - sunset
            enabled: true
        sequence:
          - action: script.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: script.christmas_lights_on
      - conditions:
          - condition: trigger
            id:
              - time
        sequence:
          - action: script.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: script.christmas_lights_on
mode: single