Alexa skill for sensors -- this will open up some huge possibilities

There’s a very recent development with Alexa. Sensors like motion detectors can now trigger an Alexa routine, as I understand it.

With HA, we could make a template sensor that ‘senses’ whatever condition we want, even the flip of a light switch, then trigger Alexa to make an announcement, turn on music,…

With this being taken over by … should we even be making feature requests regarding the Alexa API here anymore?

Agree with kctx… this opens up a world of new possibilities for HA integration… should be near the top of the developer heap.

You’ve been able to do this for a while now using either of the well discussed TTS/media player methods.

It is actually possible to make announcements using this method and bypassing Alexa Media Player entirely. This has some advantages, the big one being that you will not lose your announcement capabilities every time that Alexa Media Player loses it’s authentication (which happens every couple weeks for me, and which is why I’m moving my Alexa announcements over to this method). The downside is that it’s quite a bit more configuration to do and you need Nabu Casa or the Alexa Custom Skill set up, and you cannot use dynamic text, it has to be a fixed message. Here’s how it’s done:

first make a very simple script with no actions as a tag for the announcement you want to make:


Then make a template binary)sensor which reads the on/off value of the script and converts it into a motion sensor:

  - platform: template
        device_class: motion
        value_template: "{{ states.script.announce_dishes_are_clean.state == 'on' }}"

Then you will need to sync your alexa entities in the nabu casa configuration (ensure that you have binary_sensors set to sync or at least the individual sensor you are adding).

and and turn on the option to sync the entity states

then you will need to create a matching routine in the alexa app to actually read out the announcement when it sees the state change of our dummy movement sensor:

You can now test to see if it works in the developer tools. If it does, you should hear your announcement:

Then you can use it as a service call in your automations and never worry about reauthentication of Alexa Media breaking it again:

- id: kitchen_bar_alexa_notify_clean_dishes
  alias: "TTS Notify Clean Dishes to Kitchen Bar Alexa"
  initial_state: 'true'
    platform: state
    entity_id: sensor.bosch_dishwasher_door
    to: 'open'
    condition: and
      - condition: template
        value_template: '{{ (as_timestamp(now()) - as_timestamp(states.automation.fire_notify_clean_dishes.attributes.last_triggered | default(0)) | int > 150)}}'
      - condition: or
          - condition: state
            entity_id: input_select.bosch_dishwasher_status
            state: 'Clean'
          - condition: state
            entity_id: input_select.bosch_dishwasher_status
            state: 'Emptying'
    - service: script.announce_dishes_are_clean