Basic Alexa routine not working

Hello everyone!

I’m having an issue with something very basic

I have a simple routine in Alexa which triggers a scene and that scene runs an automation in HA when i say “Alex, i’m taking a bath” or “Alexa, i’m taking a shower”

The problem is when I say that, Alexa replies me with something like “Enjoy your bath” “Take care of you” or anything else funny but doesn’t trigger the scene…

If I insist several times it sometimes activate the scene but it’s random

Is there a workaround for this ?

I’ve tried saying “I’m taking a bath” to my Axexa and it says “Sorry, I don’t know that” - so apparently it’s not one of Amazon’s smartass jokes.

You say the Alexa scene runs a HA automation - what is the automation’s trigger exactly? All my Alexa scenes launch HA scripts.

It changes the colors in blue / gold
then
It deactivates the motion sensor in the bathroom

here is my HA automation :

alias: "SCENE: Bain"
description: ""
trigger:
  - platform: state
    entity_id:
      - scene.bain_douche
condition: []
action:
  - type: turn_off
    device_id: 0b46e8532d4579b21d7860e1469c7374
    entity_id: switch.detecteur_mouvements_sdb_motion
    domain: switch
  - service: scene.turn_on
    target:
      entity_id: scene.salle_de_bain_bleu_dore
    metadata: {}
mode: single

Should I do the same with scripts instead of automation ? What is the difference ?

Sorry i’m pretty new in all of this

An automation has to have a trigger to set it off - the state of a switch, say: start the automation when the switch changes from off to on. A script is just a block of code that is launched by something else.

Alexa routines can be used to launch scripts from voice commands - and confusingly a script is referred to as a scene in the Alexa app.

So you need to write a script, something like:

alexa_bathroom_light_on:
  alias: Alexa bathroom light on
  sequence:
  - service: light.turn_on
    data: {}
    target:
      entity_id: light.bathroom
  mode: single

When this is exposed to Alexa and you write your routine in the Alexa app, it will appear in the list of actions under Smart home | Control scene.

You can’t use a HA scene to trigger an automation as you have done, because it doesn’t have a state as such - it’s more of a description of the state of other entities.

Ok thanks for the clarification.

I think I remember now, I wanted to create scripts at first but then I notice I couldn’t add them in the IOS widget (only scenes are visible)

But I didn’t find a way to link scenes with scripts, that’s why I created automations.

Is there a workaround maybe ?

Not familiar with IOS, I’m afraid. Android has a toggle widget which will launch a script (scripts are listed by name in the drop down). The script could turn on the HA scene with scene.turn_on. That way the same effect could be achieved either by voice command or by widget… Have I correctly understood what you’re after?

The problem with Alexa integration is triggering the “Enable/Disable Automation” instead of “Trigger Automation”. To work around this issue, I have created another automation that will runs the Automation we want when Alexa turns it on. and for sure i turned it off

alias: Alexa call Automation
description: “”
trigger:

  • platform: state
    entity_id:
    • automation.original_automation
      to: “on”
      condition:
      action:
  • service: automation.trigger
    target:
    entity_id:
    - automation.original_automation
    data:
    skip_condition: true
  • service: automation.turn_off
    target:
    entity_id: automation.original_automation
    data:
    stop_actions: true
    mode: single

IMPORTANT: make sure you turn off the original automation before you call Alexa for the first time start the first time.

I’m not clear on what issue you’re trying to work around, but calling the automation.trigger service outside of troubleshooting is almost always a bad idea. And using an extra automation triggered on the state of another automation is just many extra layers of badness.

I’m certain that if you explain the issue you have, there is a sane way to solve it.