Personalized information via Alexa via flash briefing e Home Assistant

7 minutes of reading
Guide purposes
  • Define at Home Assistant set of predefined information to turn to Amazon Echo / Alexa so you can make status queries of the profirst home automation via Smart Speaker
  • Difficulty level: medium / high
Concepts dealt with:
  • Cloud configuration
  • Software configuration
Software components used:
Prerequisites
Physical devices used:
  • The device on which it resides Home Assistant
  • Smartphone on which to run theapp Amazon Alexa (Android and / or iOS)
  • Amazon Echo (any model or any model of smart speaker you mount Amazon Alexa as integrated software)
GUIDE more indicated for:

All environments

Notes and disclaimer
  • qualsiasi eventuale modifica agli impianti domestici dev'essere progettata ed realizzata SOLO da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
Driving review: 1.3

Home Assistant Amazon-Echo-Plus

Abstract

Amazon Echo It is one of device of wider and more recognized success. As we explained, this smart speaker uses the software to work Alexa, which is available, even for smart speakers proproduced by third parties, as well as how appstand-alone communication for Android and iOS smartphones / tablets.

As explained in tabs like the one linked to the domotics pyramid or on how use at best from propri Smart Speaker, the idea of ​​integrating Amazon Alexa al proprio personale HUB Home Assistant is definitely among the best. There are two ways to do this, one easy (for a fee) it's a difficult (free).


This guide is an affinameof integration of Alexa with Home Assistant: while this integration is useful to control the entity Once the configuration is defined by voice commands, this guide will allow the user to take advantage of the so-called summary of Alexa's news (In English flash briefing) to obtain personalized information procoming from profirst personal home automation based on Home Assistant.

Let us explain ourselves better.

We put to own a beautiful garden and to have prosaw a to domotize and integrate on Home Assistant the irrigation system. Let's also assume that Home Assistant has a sensor that measure the humidity level of the garden soil as well as related sensors to weather forecasts, let's say Dark Sky.

Through this guide it would be possible to define one flash briefing such to provide based on an automatic analysis, default, based on soil moisture, whether or not it has rained (and if it will), on the last artificial irrigation performed whether or not it is appropriate to irrigate, such as:

"The lawn is quite wet, it rained today. If I were you I wouldn't irrigate.
or
"The lawn is dry and no rain is expected in the prossime 12 hours, prosee to irrigate."

or phrases like that.

Another example it could simply be to be reported by Alexa the environmental status of the house:

"The average temperature in the home is 22 degrees, the average relative humidity is 45%, the air quality is excellent."

And so on.


In this guide we will simulate the need to obtain from Alexa the analysis of the presence (or not) of the tenants and the temperature of the fridge. I am alone two examples: as always, the limit is fantasy.

ATTENTION: the "news summary" (described here) should not be confused with Alexa's automatic notifications on Home Assistant, which (the latter) allows Alexa to be "talked" as an automatic voice notification system.

It starts

Prerequisites

To run the following guide it is strictly necessary that:

  • Alexa is already integrated with Home Assistant:
  • Home Assistant is reachable remotely with proHTTPS protocol (if Alexa is integrated via the prodifficult pass, this step is certainly already unmarked - otherwise it is necessary applicare this guide);
  • Home Assistant can be reached remotely also from 443 port (whatever it is the port configured on the instance ofHUB it is necessary that the port-forwarding at the profirst router / modem "turns" the external 443 port towards it).
    On this topic we recommend reading of this guide.

Assumptions

In this guide we will describe the prodefinition process of a Alexa skill (appgreasy, of type flash briefing) which reports two different analyzes:

  • one that provides information about where tenants are;
  • another that tells us the temperature of the fridge.

Nb Obviously these are just examples to make people understand proprocess; the definition of the flash briefing is linked to profirst fantasy.

By way of example we will assume the existence in configuration Home Assistant of the following entity:

  • device_tracker.marco (type entity "Device Tracker"Rappresent the position Geographic user Marco);
  • device_tracker.daniela (type entity "Device Tracker"Rappresent the position Geographic user Daniela);
  • sensor.temperatura_frigo (type entity "Sensor"Rappshowing the instantaneous temperature inside the refrigerator detected with any wireless sensor, type the Xiaomi).

It is also assumed that the component has been integrated into the configuration "areas"To define specific areas where usually Marco and Daniela find themselves (eg. Work, School etc.).

Home Assistant

API

If it is prosaw to integrate Alexa a Home Assistant means free mode, you can move on.

Otherwise, make sure you have in configuration (and eventually prosee to insert it) the following entry:

api:

homeassistant:
  auth_providers:
    - type: homeassistant
    - type: legacy_api_password
      api_password: TUA_API_PASSWORD

The field "api_password”Must contain one profirst random string. Restart Home Assistant.

FLASH BRIEFING

It is in this phase that one defines what and how Alexa will communicate certain information; this is where the user's imagination intervenes, obviously combined with the needs proand to the elements a proavailable.

We then define the flash briefing, in the case of the example of this guide, two specifications: "Status of presence" and "Fridge temperature"

alexa:
  flash_briefings:
    statopresenza:
      - title: Stato presenza
        text: >
          {%- if is_state('device_tracker.marco', 'home') and
                 is_state('device_tracker.daniela', 'home') -%}
            Siete entrambi in casa!
          {%- else -%}
            Marco si trova a {{ states("device_tracker.marco") }}
            e Daniela si trova a {{ states("device_tracker.daniela") }}
          {% endif %}
        display_url: "https://developer.amazon.com/it/docs/flashbriefing/flash-briefing-skill-api-feed-reference.html"
    temperaturafrigo:
      - title: Temperatura Frigo
        text: La temperatura del frigorifero è di {{ states.sensor.temperatura_frigo.state|float }} gradi
        display_url: "https://developer.amazon.com/it/docs/flashbriefing/flash-briefing-skill-api-feed-reference.html"

Restart Home Assistant.

Nb the field DISPLAY_URL it's a field strictly necessary. It can be filled in with a URL any, as long as it is there.

At this point if everything has been configured correctly the instance Home Assistant will exhibit two payloads in JSON notation callable via URL.

Still following the example of this guide, the two URLs will be:

https://mio_dominio.duckdns.org/api/alexa/flash_briefings/statopresenza? Api_password =dsgqlhqhgeht43hfkjh3iu

https://mio_dominio.duckdns.org/api/alexa/flash_briefings/temperaturafrigo? Api_password =dsgqlhqhgeht43hfkjh3iu

The URLs are as follows:

  • https://
  • FQDN of profirst external address Home Assistant (do not indicate any port or indicate: 433, different ports are not allowed by the skill at AWS - you see prerequisites)
  • / Api / alexa / flash_briefings /
  • the name of the flash briefing defined in configuration, in this case:
    • statopresenza
    • temperaturafrigo
  • ? Api_password =
  • API password defined with the key "api_password"In the block"http:”Present in the configuration.

Opening the browser and pointing to a URL so defined, the answer MUST always be of the following type:

[
  {
    mainText: "La temperatura del frigorifero è di 5.7 gradi",
    redirectionURL: "https://developer.amazon.com/it/docs/flashbriefing/flash-briefing-skill-api-feed-reference.html",
    titleText: "Temperatura Frigo",
    uid: "bb9a5e6a-4ed3-4797-803f-4bc095ae0dab",
    updateDate: "2019-04-21T20:46:45.0Z"
  }
]

Any other kind of answer will not allow the functionnameof the skill which we will define at AWS, and therefore of the whole mechanism that we are carrying out, so before going further, make sure you have achieved this result.

Creation of Alexa Flash Briefing Skill

Finished the side configuration Home Assistant you need to create one Alexa Flash Briefing Skill, "Bridge" that we will use from our home automation to Alexa.

Connect to the address https://developer.amazon.com/alexa/console/ask then using the profirst use Amazon.com / .it to authenticate. The purpose is to go and define a type skill ad hoc flash briefing for our environment.

At this point, the main page of the “openedDeveloper Console", Click on"Create Skill"

Amazon Developer Console - Create Skill

Nb in case Alexa was previously integrated through AWS (free method), will already be present in the list another skill (which should not be changed). In the screenshots proplaced in this guide this second skill is present and is called "haaska".

On the following page indicate the name of the skill (what you prefer in this example "inDomus") is "Flash Briefing" as typology:

Alexa Flash Briefing - step 1Once clicked on "Create Skill"You will be in the detail page of the skill flash briefing. In the field "Custom Error Message" indicate "Proproblems with the skill", Then click on"Add new feed"

Alexa Flash Briefing - step 2This will give access to an editor able to indicate the details of ours flash briefing previously defined at su Home Assistant. This procedura is repeating itself whenever you need to add a new one flash briefing to our configuration.

Alexa Flash Briefing - step 3

In this screen we will indicate the following information:

Preamble"Gives Home Assistant"(Is the phrase that Alexa prowill announce by going to read the information of the flash briefing - can obviously be customized)
NameThe name of the flash briefing defined in configuration Home Assistant (eg. "Refrigerator temperature")
Content update frequencyHourly
Content typeText
Content genreOther (or other)
FeedThe URL where the skill will retrieve the textual information, or that one defined above
Feed IconAn icon of your choice, if available

Click on "add"And, if it is not necessary to insert new flash briefings, click on"Save" top right.
The screen should apparire more or less like this:

Alexa Flash Briefing - step 4

In this example, flash briefings are, as expected, two.

App Alexa

At this point it is necessary open the proman app Alexa on smartphone / tablet, which we usually use to manage the configuration of the Smart Speaker (s) present in the home.

Click top left (the three stripes) and click on "skill"

At this point provvedere to activate the propria skill flash briefing (in the example called "inDomus") as following sequence:

This slideshow requires JavaScript.

Use

At this point the flash briefing I'm profor use.
Indeed, it will suffice pronunciare "Alexa, let me hear the summary"To get the information procoming from profirst home automation Home Assistant.

Another example

Another example comes from the desire to get a quick chapter from Alexa of the environmental status of the prohome. Let's say we have more thermal and humidity sensors distributed around the house, plus a sensor air quality (Eg. Broadlink A1 e-Air): it would be nice to get an answer from alexa like:

"The average temperature in the home is X degrees, the average relative humidity of Y%, the air quality is .."

The flash briefing to be carried out at Home Assistant would roughly like this:

alexa:
  flash_briefings:
    ambientale:
      - title: "Stato ambientale casa"
        text: >
          La temperatura media in casa è di {{ ((states("sensor.temperatura_1")|float + states("sensor.temperatura_2")|float )/2)|float|round(1) }} gradi,
          l'umidità relativa media è del {{ ((states("sensor.umidita_1")|float + states("sensor.umidita_2")|float )/2)|int }}%. La qualità dell'aria è {{ states.sensor.air_quality.state }}

Obviously it would be enough add the flash briefing to the skill AWS in the methodologies expressed in the present projet.


Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.


telegram

Stay up to date through ours Telegram channel!