Art Dustman
Expert
Expert
Posts: 610
Joined: Fri Nov 10, 2006 3:22 pm
Location: NJ
Contact: Send private message

TTS with ALEXA!

Tue Jan 08, 2019 5:48 pm

In case some of you didn't know, Amazon added a contact and sensor API which essentially allows you to make your echo do almost anything you can do via voice. You can make your echo alert you with a notification, play music, talk, give you weather, etc. There is a list here: https://www.openhab.org/addons/bindings ... on-devices

I know Allonis hasn't hooked into the echo greatness just yet, but using openHab and Allonis together, you can get that level of control.

I will post the details of how to get this going once I redo my system on a RasberryPI instead of a windows build. And I still need some info on how to make POSTURL function in Allonis work. I have worked around that with a small utility called CURL.exe and I am posting that way. Another robust method would be to use the public and well documented API for OpenHab and write an interface which would give direct control. Cough..cough.. =P~

But stay tuned and I'll post my current method after I make some pi and get that online.

User avatar
DaveB
Simply Incredible
Simply Incredible
Posts: 3376
Joined: Sun May 30, 2004 11:57 pm
Location: Mays Landing, NJ
Contact: Send private message

Re: TTS with ALEXA!

Mon Jan 14, 2019 7:47 pm

Art - My next Pi build will be the same. I am going to add in POE and some USB storage and then load it up. I just completed a Pi build for my reef tank using reef-pi software. I also have my last in wall touch screen running from a Pi behind the screen. For about $50 per implementation, they are very stable devices.

I am interested in your work with Alexa. I have an Alexa and just need some time to play about.
Thanks
Dave Bruner
:shock:

Art Dustman
Expert
Expert
Posts: 610
Joined: Fri Nov 10, 2006 3:22 pm
Location: NJ
Contact: Send private message

Re: TTS with ALEXA!

Thu Jan 31, 2019 9:47 pm

Here is the basic premise.

Lots of info here that is more detailed than below, but can get confusing
https://www.openhab.org/docs/installati ... abian.html

Go get a Raspberry Pi 3 model B+
Get a case and a power supply at least 3 amps. Most are 2.5, but hunt for that 3
If you are daring, get a mstata adapter and proper case for that and hope you guess right to boot from that
Otherwise, use a MicroSD card and learn how to backup your config/card, eventually it will fail

Google yourself OpenHabian with the Raspberry PI config - Plenty of info here on how to set this up, but here is the short version:

Use pre-configured self-installing image of Openhabian Pi (latest image)
Use Balena Etcher to write the image
Power up your Pi and let it do it's stuff (self installs and configures)
Use your router and assign a static IP reservation
Map samba shares \\openhabianpi.local\ at your browser and map from toolbar ribbon or similar
The Login/PW for the shares are both openhabian by default (change this before you map if you want, recommended, see below)

ssh with Putty into your raspberry pi (use IP) and open the openhabian config tool
Login/pass: openhabian
enter in console: sudo openhabian-config

Change passwords as you please
ssh or sudo login/pw is openhabian - change this, don't forget it
samba share login/pw is openhabian - change this, don't forget it

In your browser get to openhabianpi http://openhabianpi:8080/start/index

For TTS control you will need the Amazon Echo Binding
Install the amazon echo binding from paper UI Addons>bindings - install
look in the "things" and find the account for amazon, to get it online you have to type in the correct URL indicated
It will be something like this: http://openhabianpi:8080/amazonechocontrol/xxxxxxx
If that page does not open (page not found) you may have a version conflict
Uninstall the echo binding
Reboot your PI
Google yourself the .JAR file of the newest version, and place that file in the addons folder (using those samba shares)
Reboot the pi
Retry
(this knowledge cost me HOURS of time, hopefully it saves some of you the frustration)

You will get a page to login to your amazon account, and when you do, you will get a list of all your devices you can control

Now, your Pi will discover all the "Things" which are echo devices, look in the inbox on paperUI
You have to make those things by adding them. I recommend you stick to just echo devices for now
Once you add the thing, open the thing like "Kitchen" - assuming you have an echo named Kitchen. If you didn't name your echos, stop now and fix the names to what you like, refresh that list in your browser in paper UI
That thing "Kitchen" can do stuff, but you need to connect Channels
thingsetup.PNG
thingsetup.PNG (51.67 KiB) Viewed 1223 times
Click ones you want to add (they will turn into bullseyes)
Where is TTS?? click more in the topish right and see all the functions you can do on your echo
Scroll down to speak... click the joy :)
It will popup a screen to link, leave the top default, and click the bottom - DO NOT PICK ANYTHING, CREATE NEW !!!
Now you will have an item to do stuff with. That item is essentially the function

You should see a thing like Kitchen_Speak

Now, how do I get MyServer to work it.. The only way to communicate to the Openhabianpi is with REST
Your opening screen in the openhab console (web) http://openhabianpi:8080/start/index has a link to the REST API
You can go to ITEMS and click to "Send a command to an Item" to test at this point (recommented)
Item Name in my example is Kitchen_Speak and put whatever you want the echo say say in the body
You will notice that it will generate the CURL you will need. Test and make sure all is well

Now, go find the CURL utility https://curl.haxx.se/ and download it to your MyServer and put it in the appropriate folder (look below and it will make sense) - I used c:\Curl

Make a macro command called Echo.Speak.TTS
fill it with this:

Runhidden|c:\curl\curl.exe~-X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "<p1>" "http://openhabianpi:8080/rest/items/<p2>"

Call the macro whatever way you want and toss in the approriate parameters;
<p1> = what you want echo to say
<p2>= the thing (Kitchen_Speak or Bedroom_Speak)

Caution: some of this is case sensitive! make sure it all is case correct, and DON'T USE SPACES.

So now you can have MyServer run the macro:

Echo.Speak.TTS|This is a test of my Echo to say hello~Kitchen_Speak

Pretty sure I covered everything, Let me know how fast anyone gets this setup. All this discovery took me about 2 weeks.

Cool Tip: You can do lots of other things and make your echo do other stuff. Look it up. But you can't make the echo do what you would normally say to it. You have to create a routine first.
But... If you make an echo speak, and you say, "Alexa. Turn on the kitchen light" and you put another echo next to that one, you CAN tell the echo what to do in a roundabout way, one echo to another. Get two cheap dots and get this functionality.

Return to “myServer”

Who is online

Users browsing this forum: No registered users and 1 guest