Coder Social home page Coder Social logo

tomerfi / home_assistant_appdaemon_alexa_google Goto Github PK

View Code? Open in Web Editor NEW
14.0 4.0 1.0 49 KB

An AppDaemon application for Home Assistant, handles calls from Alexa Skill and a Google Action

License: MIT License

Python 100.00%
home-automation alexa alexa-skill alexa-custom-skill home-assistant hassio appdaemon appdaemon-apps google-actions dialogflow

home_assistant_appdaemon_alexa_google's Introduction

AppDaemon application for Home Assistant, Handles calls from Alexa Skill and Google Action
Maintenance

NOT MAINTAINED!

I'm no longer maintaining this repository!

You can still use the files โ˜๏ธ, if you want.
These ๐Ÿ‘‡ are the instructions.


AppDaemon application for Home Assistant, handles calls from either and Alexa Skill or a Google Action.
You can see the application in action in the following videos on my youtube channel:

Please note: The functionality of this application is design to suit my own needs, it won't necessarily fit others and you might need to do some python code writing and designing to make it work for you.
For example, the application collects data about my Qnap NAS and reads it back to me, you might not have a Qnap NAS yourself or you might not use its designated Home Assistant component, so you don't actually need that part of the application.
Nevertheless, the infrastructure and flow will still be eligible, just edit the intents and the intent handlers to suit your own needs.

Prerequisites

  • Home Assistant. The application has been tested with HassIO version 0.63.2
  • AppDaemon, Since I'm using HassIO, I actually use the AppDaemon v2 Hassio Addon made by frenck. The application has been tested with version 1.0.0 of the addon.
  • Expose your environment securely to the web so that it is accessible for Amazon and Google servers. There are a number of ways to accomplish that. I use the Caddy Proxy Hassio Addon made by bestlibre to handle my certificates and do a dns based internal routing: Calls from my DuckDns name is redirected to Home Assistant so that I can access it from outside my lan, my No-IP name is redirected to the AppDaemon instance.
    I also use the DuckDns and the No-IP Home Assistant components to update my ip address.
    On my router side, I've create a port-forward for the port 443 towards my Home Assistant environment.

AppDaemon Configuration

  • In appdaemon.yaml, fill in your Home Assistant and AppDaemon information such as url address, port and password.
    You probably already did it when you've installed AppDaemon, so there's no actual need to change anything.
  • In apps.yaml, configure the following applications:
home_control_google:
  module: home_control_google
  class: HomeControl

home_control_alexa:
  module: home_control_alexa
  class: HomeControl

Application Analysis and Configuration

In home_control.py the following variables contains data to be used by the intent handlers:

  • start_phrases: A list of start phrases randomly incorporated into the first response of the session.
  • end_phrases: A list of end phrases randomly incorporated into the last response of the session.
  • hava_profile: A dictionary for holding the entity names to use with HA to update the current location, get current location and issue an iCloud find request, when I ask the application to locate Hava (my wife).
  • tomer_profile: A dictionary doing the same as the above, holding the information for Tomer (myself).
  • door_sensors: A list of the door sensors for the application to check when I ask for a sensors report, the application will read back the ones in Open state.
  • system_sensors: A dictionary holding the entity id's of 5 specific system sensors, based on their states the application will construct a response informing me of the system overall status when I ask for the system information.
  • devices_sensors: A list of the entity id's for my nmap trackers, based on this list the application will read back to names of the sensors in Offline state when I ask for the devices information.
  • network_profile: A dictionary holding the entity id's of 6 specific network sensors, based on their states the application will construct a response informing me of the network overall status when I ask for the network information.
  • storage_profile: A dictionary holding the entity id's of 8 specific qnap nas sensors, based on their states the application will construct a response informing me of the nas overall status when I ask for the storage information.
  • water_heater_switch: A string containing the entity id of my Switcher V2 boiler for the application to use when I ask it to turn on the boiler for X minutes/seconds.

Restricted Access

As an added measure of security, I've added a couple of lists to control the users, application and devices allowed to make calls to the application.
In home_control.py scroll down the bottom where you can see the last two functions and update your id's into the lists, you can also leave it empty for no restricted access:

def authorizeAlexaUse(api, application_id, device_id, user_id):

The lists are:

  • applications
  • devices
  • users
def authorizeGoogleUse(api, user_id):

One list named users.

Create the Alexa Skill

  • Create an Alexa custom skill, if you're not familiar with doing so, this guide can help you.
  • Point the created custom skill to the url in the endpoint_https_address text file, just make sure to edit the url with your dns name and ad password.
  • Update the interaction model based on the interaction_model json file.

Create the Google Action

  • Create the project and the action, if you're not familiar doing so, this guide can help you.
  • Edit the agent json file, scroll down to the bottom and edit the url with your dns name and ad password.
  • Zip the entire content of the dialogflow_agent folder and create the Dialogflow agent from it.

home_assistant_appdaemon_alexa_google's People

Contributors

tomerfi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

krille01

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.