Giter Site home page Giter Site logo

ask2ha_docker's Introduction

ASK2HA

Home Assistant (HA) Add-on for Alexa integration without opening HA to the world.

The Add-on works the same as haaska but the direct communication between HA and the Alexa skill is replaced with a SQS queue for forwarding the requests (Lambda->HA) and a DynamoDB table for the responses (HA->Lambda).

The add-on makes a long pull request every 20 seconds to the Amazon SQS queue. If a request is present is passed to HA, the response is saved in the DynamoDB table using the id of the request as primary key (messageId)

Setup

For the initial part of the setup you can follow this guide https://github.com/mike-grant/haaska/wiki, you also need to create the SQS queue and the DynamoDB table (use "messageId " as primary key for the table).

For the installation of the add-on follow the guide for third-party add-ons https://www.home-assistant.io/hassio/installing_third_party_addons/.

In case of using Docker, you can use the environment variable HA_API_ENDPOINT to set the endpoint of your HA instance (e.g. http://ha:8123/api/alexa/smart_home).

Remember to change config.py for the lambda function and the configuration of the addon inside HA after the installation.

Details about the setup

The setup in general start by following the haaska setup:

  1. First you need to create the Alexa skill and configure it
  2. Create the lambda function in AWS
  3. Add the third party app in home assistant and configure it

Instead in this setup the point 2 and 3 are slightly changed into point 4 and 6 (you can do the points in any order but you need to add the configuration later for the missing info):

  1. create the Alexa skill as before
  2. create a dynamoDB table in AWS (use "messageId " as primary key for the table)
  3. create a SQS queue in AWS (set receive message wait time to the maximum that is 20, use a low maximum retention time like 1 minute)
  4. create the lambda function in AWS (but with my code inside) and configure it with the table and the queue info
  5. create an access token for home assistant to access AWS resources (table and queue)
  6. add this app as third party in home assistant and configure it with the table/queue/access info
  7. remember to update the configuration.yaml as in the haaska wiki

Other info

The Add-on was used as is for more than 1 year with no issues or maintenance whatsoever (maybe I could check if some dynamoDB record were not erased because of instabilities in the internet connection)

The code works as intended but may contains bugs, use at your own risk.

The free tier of amazon AWS should cover both the lambda function, the SQS queue and the DynamoDB table. 1 month uses about 15% of SQS free tier and less than 0.1% of the other two services.

ask2ha_docker's People

Contributors

mrc-g avatar coufal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.