How to trigger Alexa routines from Home Assistant

Yes, but that just takes me to a blank New Routine page where if I click “When this happens” > “Smart Home” to get to Chose Device, it says No devices found! There is nothing there relating to the Device I just came from.

? There must be something. What are you seeing when you go to the routines section → add new → add action → smart home → all devices

Under add new action I am seeing plenty - Light (many), Control group (all the rooms I have stuff in) and Control scene (loads, certainly all the scenes I have set up in the Blitzwolf app for controlling my telly and amp).
Just No Devices when i go “When this happens” > “Smart Home”>. My gues is that they are not set up in the HA configuration.yaml. I have only attempted to configure on as in a post above.

Ah, ok. As far as I know, you need an Alexa device with an integrated hub.

I have an Echo if that’s what you mean.

This is entirely dependent on the skill you are using. For example, I use Haaska and Alexa will not trigger routines off of Smarthome entities, even though the state of a sensor is visible in the Alexa app. If I remember correctly this is related to the Alexa Proactive Events.

So, currently the flow is:

“Alexa, turn on the amp” > Alexa runs Routine Z, which sends command to Blitzwolf > Blitzwolf sends IR signal > Amp turns on…?

You want:

Entity X turns on > HA tells Alexa to run Routine Z…

If that is the case, just process the logic in an HA automation and use Alexa Media Player to trigger Routine Z.

alias: Alexa - Routine Z
description: >-
  Tell Alexa to run Routine Z when Entity X turns on 
trigger:
  - platform: state
    entity_id: input_boolean.entity_x
    from: 'off'
    to: 'on'
condition: []
action:
  - service: media_player.play_media
      data:
        media_content_id: Routine Z
        media_content_type: routine
      target:
        entity_id: media_player.den_echo_dot
1 Like

Type matters. If your Echo has no integrated Zigbee hub (e.g. Echo 4. Gen, Echo Studio), it night be the easiest to go the way Didgeridrew suggested above.

I do run Haaska. Frustrated that it doesn’t mention this at the very top of the post (unless I missed it).

I will try the media route, but that means HACS I guess. I’ll have a look.

Thanks

From what I understand it is possible to modify the Haaska lambda to enable proactive events (The Haaska Super Thread - #279 by wmaker and https://gist.github.com/matt2005/744b5ef548cc13d88d0569eea65f5e5b).
I can’t really offer any guidance on setting it up because I never bothered doing it… I started out using AMP before I setup Haaska, so it was already my normal workflow (and I would rather get kicked in the shin than spend extra time using the Alexa app).

Thanks for giving this some thought. I had a look and my Alexa Developer console and it is already configured to “Send Alexa Events”. I think that just keeps Alexa updated with current states, but doesn’t do anything to enable HA triggering Alexa Routines.

I’m just about to install HACS and then the media player! Scary stuff.

Drew - Thanks for your input.
I’ve now installed an SSH terminal, HACS and Alexa Media Player and now have a platform: ping entity that detects when my television is on or off and an automation that turns my Amp on or off in step.
As it happens, my Amp can be turned off directly over the LAN as it appears as a media player within HA with a number of controls including the off switch. But, to turn it on, I have to use the Alexa routine to send the On command to the Blitzwolf IR transmitter.
One day everything will come with MQTT capability and that will make life so much simpler.

1 Like

I’ve been trying to get Alexa routines to trigger in Home Assistant.
With a bit of help I came up with a motion sensor template that that Alexa can see.
Alexa can see the sensor and can also see if movement is detected or not but when I try to use it in a routine I get “this device is not currently supported”.
Any ideas?

Many thanks

Hey all - putting this out there in case anyone is still looking for how to do Alexa routines from HA.

Use the Media Player component which now also lets you trigger routines. No need to make Alexa scan and check for devices.

3 Likes

Thank you, just what I have been looking to do.

Hi all!
I am trying to get a sensor in to Alexa to trigger a routine, have defined as follows:

binary_sensor:
  - platform: template
    sensors:
      amazon_smart_plug_1:
          friendly_name: "Hall Lamp - HA Binary Sensor"
          device_class: 'door'
          value_template: '{{ is_state("input_boolean.amazon_smart_plug_1", "on") }}'

It appears in Alexa fine, and when I toggle my input boolean it changes state in Alexa, but there is no option to add to a routine and it does not show in the available Smart Home devices as a trigger.

Within Alexa it shows as a ‘Contact Sensor’ which I believe is correct?

Any advice really appreciated! Have tried adding / removing / restarting / changing device_class so many times, but nothing seems to work :frowning:

Thanks!

in the release notes of release 2022.07 it says that triggering Alexa Routines is now possible via input_booleans, input_buttons etc

input boolean work fine for me but I can’t get buttons to work. I get an Error in the Alexa App that says that this device is not supported.

1 Like

I am trying to get this to work, but am a little bit confused. I get the basic idea of exposing a binary value to alexa that can trigger a routine, I have created a template device as follows.

binary_sensor:
  - platform: template
    sensors:
      master_curtain_sensor:
        friendly_name: "MasterCurtain"
        value_template: 
        device_class: 'door'

The problem I am confused by is what I need to put into value_template, I don’t have a an actual device in HA to track the actual state of the scene. such as a light within the scene. The curtains can’t be connect to the HA., which is why I am trying to use Alexa routine.

What should I put into value_template here?

Is an input_boolean what I want?

1 Like

This seems to work.

binary_sensor:
  - platform: template
    sensors:
      sun_up:
        friendly_name: "Sun is up"
        value_template: "{{  is_state('input_boolean.curtain_master', 'on') }}"

@Jeffrey_Ellin
Are you able to see the device in the Alexa app, and also trigger a routine based on the device’s state?

Are you using Nabu Casa?

For me (not using nabu casa), I can add the input_boolean and binary_sensor to the alexa app, but I don’t see any device listed as a trigger when I tried to go “When this happens” → “Smart Home”.

So I have worked around based on voice command sent by the Alexa Media Player. I described my workaround in my post here.

thanks

I’ve read though most of the posts in this thread trying to figure out where I’m going wrong. I’m using the Alexa Skill rather than Nabu Casa and have had the skill successfully linked for a while now. I have only recently needed to create a routine where I want it to toggle a binary sensor.

I have added the required entries into configuration.yaml - there are no errors in the logs relating to this so I assume everything is setup correctly. I’ve also restarted HA and relinked the skill.

I have created a door sensor from a template and it shows up in the Alexa device list after a rescan. The only issue I have is that when create the route and I try to select the binary sensor under devices, it is displayed right at the bottom of the list under the unsupported section.