Alexa Integration

There are two way (and probably more) to integrate Amazon Alexa with your Home Assistant installation:

  • The easy way: with Home Assistant cloud, but after a free trial period this will cost you 5$/months. See this guide if you want to follow this way.
  • The hard (probably tedious is more appropriate) way: same functionalities of the HA cloud but for free thanks to the haaska project.

On the web you can find a lot of guides and tutorials about the Alexa integration with haaska, but in my opinion the one in the official haaska wiki is the best one.

Every step is well described and if you follow them exactly, you will end with a working system. After that you will be able control the devices supported by Alexa and present in your HA installation with voice commands, through an Echo speaker or through the Alexa app (available for Android and IOS).

Below some points that can facilitate you in the installation process.

  • One of the prerequisites of haaska is that your HA installation must be accessible from the outside. With the d-diot image this is not to hard. Read this guide to know more. Please read also the introduction guide, because you have to think about security before opening your HA installation to the outside world.
  • Once you have finished with the setup of haaska, before adding your haaska skill to the Alexa app, filter and configure the entities that you want to expose to Alexa, otherwise all of them will be exposed (see this HA guide). To do that you need to edit your configuration.yaml file, like the example at the end of this page.

Alexa has a proactive mode, with which Alexa is informed by status changes of a sensors even if you don't query it directly. Proactive mode must be enabled if you want to trigger a custom routine in the Alexa app (i.e. say something through an Amazon Echo XXXX when the motion sensor YYYY is activated). To enable the proactive mode you have to:

  1. Click on your haaska skill.
  2. Click on the permission menu entry in the left tab and activate the Send Alexa Events button
  3. Click on the smart home menu entry in the left tab and click the save button on the top right corner
  4. In your configuration.yaml add the endpoint, client_id and client_secret. Please note that the URL endpoint change on the basis of your country (see here).

Example configuration.yaml

Below an example of the configuration.yaml section for the Alexa integration, with entities filter and configuration. Please note also the endpoint, client_id and client_secret fields to enable the proactive mode of Alexa.

/home/homeassistant/.homeassistant/configuration.yaml
api:

alexa:
  smart_home:
    endpoint: https://api.eu.amazonalexa.com/v3/events
    client_id: !secret alexa_client_id
    client_secret: !secret alexa_client_secret
    filter:
      include_entities:
        -  light.lamp_2
        -  light.lamp
        -  light.zipato_unknown_type_0002_id_0003_level
        -  sensor.multisensor3_2_7 
        -  sensor.multisensor1_1_7
        -  sensor.multisensor2_2_7
        -  sensor.multisensor4_3_7
        -  sensor.multisensor5_3_7
        -  switch.avidsen_smart_plug_1
        -  binary_sensor.multisensor1_1_5
        -  binary_sensor.multisensor2_2_5
        -  binary_sensor.multisensor3_2_5
        -  binary_sensor.multisensor4_3_5
        -  binary_sensor.multisensor5_3_5
    entity_config:
      light.lamp_2:
        name: "Lampada sala"
        description: "Mood lamp XL"
        display_categories: LIGHT
      sensor.multisensor3_2_7:
        name: "Sala"
        description: "Si7021 on Multisensor 3"
        display_categories: TEMPERATURE_SENSOR
      light.lamp:
        name: "Lampada camera"
        description: "Mood lamp small"
        display_categories: LIGHT
      sensor.multisensor1_1_7:
        name: "Camera"
        description: "Si7021 on Multisensor 1"
        display_categories: TEMPERATURE_SENSOR
      sensor.multisensor2_2_7:
        name: "Cameretta"
        description: "Si7021 on Multisensor 2"
        display_categories: TEMPERATURE_SENSOR
      sensor.multisensor4_3_7:
        name: "Cucina"
        description: "Si7021 on Multisensor 4"
        display_categories: TEMPERATURE_SENSOR
      sensor.multisensor5_3_7:
        name: "Bagno"
        description: "Si7021 on Multisensor 5"
        display_categories: TEMPERATURE_SENSOR
      light.zipato_unknown_type_0002_id_0003_level:
        name: "Lampada cameretta"
        description: "Z-wave bulb"
        display_categories: LIGHT
      switch.avidsen_smart_plug_1:
        name: "Presa cameretta"
        description: "Avidsen smart plug 433 Mhz"
        display_categories: SMARTPLUG
      binary_sensor.multisensor1_1_5:
        name: "PIR camera"
        description: "AS312 on Multisensor 1"
        display_categories: MOTION_SENSOR
      binary_sensor.multisensor2_2_5:
        name: "PIR cameretta"
        description: "AS312 on Multisensor 2"
        display_categories: MOTION_SENSOR
      binary_sensor.multisensor3_2_5:
        name: "PIR sala"
        description: "AS312 on Multisensor 3"
        display_categories: MOTION_SENSOR
      binary_sensor.multisensor4_3_5:
        name: "PIR cucina"
        description: "AS312 on Multisensor 4"
        display_categories: MOTION_SENSOR
      binary_sensor.multisensor5_3_5:
        name: "PIR bagno"
        description: "AS312 on Multisensor 5"
        display_categories: MOTION_SENSOR

Example secrets.yaml

Below an example of the secrets.yaml section for the Alexa integration.

/home/homeassistant/.homeassistant/secrets.yaml
# Alexa
alexa_client_id: amzn1.application-oa2-client.xxxxxxxyyyyyyyzzzzzzz
alexa_client_secret: xxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyzzzzzzzzzzzzzzzzzzz

  • how_to/home_assistant/alexa_integration.txt
  • Last modified: 2019/12/16 19:04
  • by franzunix