Giter Club home page Giter Club logo

ha-alexa-tts's Introduction

ha-alexa-tts

Alexa Unsolicted TTS for Home Assistant

Here is the unsolicited text to speech for Alexa devices that we have been waiting for!

The loetzimmer.de shell script has been updated (Thanks Ralf Otto) with the excellent work of Michael Geramb to support direct TTS to any Alexa devices!

This script does work by using the Alexa web interface, so it may break at anytime. However, the TTS component is POSTing a JSON object direct to the API endpoint, so the odds that TTS portion stays working are high.

The TTS works with two shells scripts, the original by Alex Loetzimmer and wrapper for it that allows Home Assistant to call it as a command line notify component.

To get started, download the scripts: https://github.com/walthowd/ha-alexa-tts

Save scripts in your Home Assistant config directory and make them executable (chmod +x alexa_remote_control.sh & chmod +x alexa_wrapper.sh)

Add your login credentials to the Home Assistant secrets.yaml file, with the keys alexa_email and alexa_password.

Run the script interactively to pull your devices:

./alexa_remote_control.sh -a

If login fails look at /tmp/.alexa.login. Search for "password" and see if you are being prompted for the captcha. If so, you can attempt to login to Alexa manually from a browser (from the same IP) and see if that fixes the issue for you. It never did for me, so I logged in to https://alexa.amazon.com with Chrome and used the cookies.txt extension(https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg?hl=en) to export my amazon cookies to /tmp/.alexa.cookie. Other individuals have reported success using the same procedure, but only when using Firefox.

Once you have ./alexa_remote_control.sh -a returning your devices you can test TTS by running:

./alexa_remote_control.sh -d "My Dot Name" -e speak:This_is_a_test!

If that works, next in a shell type:

echo $PATH

Copy that value and put it in the PATH in alexa_wrapper.sh

Add a command line notify to Home Assistant:

notify:
  - platform: command_line
    name: 'My Dot Name'
    command: "/home/homeassistant/.homeassistant/alexa_wrapper.sh -d 'My Dot Name'"

If you are using hass.io, adjust the command line to:

     command: "/config/alexa_wrapper.sh -d 'My Dot Name'"

Restart Home Assistant and you should now be able to call notify.my_dot_name with a message from an automation or the services interface broadcast messages to your devices.

You can also add a notify for all of your Alexa devices:

notify:
  - platform: command_line
    name: 'All Alexas'
    command: "/home/homeassistant/.homeassistant/alexa_wrapper.sh -d 'ALL'"

Let me know if you have any questions!

ha-alexa-tts's People

Contributors

walthowd avatar neilcrosby avatar kotopoulos10 avatar vivianlink avatar eracknaphobia avatar patriot1889 avatar

Watchers

James Cloos 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.