Alexa text to speech Topic is solved

Alexa, Google Home and Siri

Moderator: leecollings

Post Reply
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Alexa text to speech

Post by Hesmink »

Hi All,

I thought it wasn't possible, but it seems it can be done!

Looking at this blog post:
https://blog.loetzimmer.de/2017/10/amaz ... -echo.html

You can download a shell scripts that can do tts and more.
I cannot try it yet, because logging in to amazon.com gives me a captcha request, and I haven't figured out how fix that on a headless rpi without gui.
The work-around normally is to use a 'normal' browser to login, but I cannot do that.

Logging into amazon.de works, but my echo's are in my amazon.com account.
If anyone has any ideas how to fix the captcha stuff for amazon.com, that would be nice.

I can't wait to have my echo dots announce all kind of stuff.
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Alexa text to speech

Post by freijn »

I have it working little bit different and with a small other device.

You do require a Echo dot remote.
My raspberry is activating a relay which does pres the attention button on the remote.
The having a TTS simple engine on the Raspberry playing the command : "Simons says We love Alexa"
Then the attention button is released and within the same second Alexa say : "We love Alexa"

Let me know if you are interested
Frank

BTW I am still looking somebody who can help me building my first simple skill. anybody?
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Alexa text to speech

Post by Hesmink »

freijn wrote: Wednesday 25 July 2018 22:24 I have it working little bit different and with a small other device.

You do require a Echo dot remote.
My raspberry is activating a relay which does pres the attention button on the remote.
The having a TTS simple engine on the Raspberry playing the command : "Simons says We love Alexa"
Then the attention button is released and within the same second Alexa say : "We love Alexa"

Let me know if you are interested
Frank

BTW I am still looking somebody who can help me building my first simple skill. anybody?
Thanks, but I got it working with the script, no need for extra hardware.
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Alexa text to speech

Post by Hesmink »

I 'fixed' the issue by moving my echos from my US account to my DE account.
The DE account doesn't give the CAPTCHA, so it's working now!

With:

script:///home/pi/domoticz/scripts/alexa_remote.sh -d ALL -e speak:'Put your text to announce here'

my echo dots will speak the text.

Very handy to have Domoticz announce all kind of different stuff.

The scripts can do a lot of other stuff, like traffic, weather, play music etc:

Code: Select all

./alexa_remote.sh [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|vol:<0-100>> |
          -b [list|<"AA:BB:CC:DD:EE:FF">] | -q | -r <"station name"|stationid> |
          -s <trackID|'Artist' 'Album'> | -t <ASIN> | -u <seedID> | -v <queueID> | -w <playlistId> |
          -i | -p | -P | -S | -a | -m <multiroom_device> [device_1 .. device_X] | -lastalexa | -l | -h

   -e : run command, additional SEQUENCECMDs:
        weather,traffic,flashbriefing,goodmorning,singasong,tellstory,speak:'<text>',automation:'<routine name>'
   -b : connect/disconnect/list bluetooth device
   -q : query queue
   -r : play tunein radio
   -s : play library track/library album
   -t : play Prime playlist
   -u : play Prime station
   -v : play Prime historical queue
   -w : play library playlist
   -i : list imported library tracks
   -p : list purchased library tracks
   -P : list Prime playlists
   -S : list Prime stations
   -a : list available devices
   -m : delete multiroom and/or create new multiroom containing devices
   -lastalexa : print device that received the last voice command
   -l : logoff
   -h : help
l00pz
Posts: 42
Joined: Wednesday 01 April 2015 11:52
Target OS: Linux
Domoticz version: Beta
Contact:

Re: Alexa text to speech

Post by l00pz »

Hesmink wrote: Friday 27 July 2018 14:35 I 'fixed' the issue by moving my echos from my US account to my DE account.
The DE account doesn't give the CAPTCHA, so it's working now!

With:

script:///home/pi/domoticz/scripts/alexa_remote.sh -d ALL -e speak:'Put your text to announce here'

my echo dots will speak the text.

Very handy to have Domoticz announce all kind of different stuff.

The scripts can do a lot of other stuff, like traffic, weather, play music etc:

Code: Select all

./alexa_remote.sh [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|vol:<0-100>> |
          -b [list|<"AA:BB:CC:DD:EE:FF">] | -q | -r <"station name"|stationid> |
          -s <trackID|'Artist' 'Album'> | -t <ASIN> | -u <seedID> | -v <queueID> | -w <playlistId> |
          -i | -p | -P | -S | -a | -m <multiroom_device> [device_1 .. device_X] | -lastalexa | -l | -h

   -e : run command, additional SEQUENCECMDs:
        weather,traffic,flashbriefing,goodmorning,singasong,tellstory,speak:'<text>',automation:'<routine name>'
   -b : connect/disconnect/list bluetooth device
   -q : query queue
   -r : play tunein radio
   -s : play library track/library album
   -t : play Prime playlist
   -u : play Prime station
   -v : play Prime historical queue
   -w : play library playlist
   -i : list imported library tracks
   -p : list purchased library tracks
   -P : list Prime playlists
   -S : list Prime stations
   -a : list available devices
   -m : delete multiroom and/or create new multiroom containing devices
   -lastalexa : print device that received the last voice command
   -l : logoff
   -h : help
What settings did you use for the "AMAZON" and the "ALEXA" variable in the Script? When I set it to DE and use "layla.amazon.de" it seems that I get a valid Cookie, but my Echo Dot doesn't do anything..
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Alexa text to speech

Post by Hesmink »

l00pz wrote: Saturday 28 July 2018 15:05
Hesmink wrote: Friday 27 July 2018 14:35 I 'fixed' the issue by moving my echos from my US account to my DE account.
The DE account doesn't give the CAPTCHA, so it's working now!

With:

script:///home/pi/domoticz/scripts/alexa_remote.sh -d ALL -e speak:'Put your text to announce here'

my echo dots will speak the text.

Very handy to have Domoticz announce all kind of different stuff.

The scripts can do a lot of other stuff, like traffic, weather, play music etc:

Code: Select all

./alexa_remote.sh [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|vol:<0-100>> |
          -b [list|<"AA:BB:CC:DD:EE:FF">] | -q | -r <"station name"|stationid> |
          -s <trackID|'Artist' 'Album'> | -t <ASIN> | -u <seedID> | -v <queueID> | -w <playlistId> |
          -i | -p | -P | -S | -a | -m <multiroom_device> [device_1 .. device_X] | -lastalexa | -l | -h

   -e : run command, additional SEQUENCECMDs:
        weather,traffic,flashbriefing,goodmorning,singasong,tellstory,speak:'<text>',automation:'<routine name>'
   -b : connect/disconnect/list bluetooth device
   -q : query queue
   -r : play tunein radio
   -s : play library track/library album
   -t : play Prime playlist
   -u : play Prime station
   -v : play Prime historical queue
   -w : play library playlist
   -i : list imported library tracks
   -p : list purchased library tracks
   -P : list Prime playlists
   -S : list Prime stations
   -a : list available devices
   -m : delete multiroom and/or create new multiroom containing devices
   -lastalexa : print device that received the last voice command
   -l : logoff
   -h : help
What settings did you use for the "AMAZON" and the "ALEXA" variable in the Script? When I set it to DE and use "layla.amazon.de" it seems that I get a valid Cookie, but my Echo Dot doesn't do anything..
Depends on which account your alexa devices are registered. Amazon.de or Amazon.com.
For me, it only works on amazon.de.
bramski
Posts: 45
Joined: Thursday 20 July 2017 16:26
Target OS: -
Domoticz version:
Contact:

Re: Alexa text to speech

Post by bramski »

I was being redirect to https://alexa.amazon.co.uk when I went to https://alexa.amazon.com.
Actually got it working by altering the settings in the shell script as follows:

Code: Select all

LANGUAGE="en-US"
AMAZON='amazon.co.uk'
ALEXA='alexa.amazon.co.uk'
Hope this helps anyone struggling
bramski
Posts: 45
Joined: Thursday 20 July 2017 16:26
Target OS: -
Domoticz version:
Contact:

Re: Alexa text to speech

Post by bramski »

Another cool idea using the TTS feature.

You could set the script in the notifications tab on the settings screen in Domoticz.

Go to "custom HTTP/action" section.

Set the URL:action to
script:///home/pi/domoticz/scripts/alexa_remote_control.sh -e speak:'#MESSAGE'

Now at your switch/action define notifications and check the http option.

Pretty cool
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Alexa text to speech

Post by Hesmink »

bramski wrote: Saturday 28 July 2018 16:52 Another cool idea using the TTS feature.

You could set the script in the notifications tab on the settings screen in Domoticz.

Go to "custom HTTP/action" section.

Set the URL:action to
script:///home/pi/domoticz/scripts/alexa_remote_control.sh -e speak:'#MESSAGE'

Now at your switch/action define notifications and check the http option.

Pretty cool
Perfect! Thanks for this idea, I did it using the on/off action, but this is much more usable.
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Alexa text to speech

Post by poudenes »

I use Google text to speech. Connect a speaker to my pi. You can also connect a Bluetooth speaker

Code: Select all

Google Text to Speech

sudo apt-get install mplayer alsa-utils

Google limits you to 100 bytes normally

Create a file speech.sh with:

nano speech.sh

Add these lines to the file and save it

#!/bin/bash
say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=$*&tl=en"; }
say $*

Add execute permissions to your script with:

chmod u+x speech.sh

Test it using:

amixer cset numid=3 1
amixer  sset PCM,0 85%

./speech.sh Look Dave, I can see you're really upset about this.


Verzonden vanaf mijn iPhone met Tapatalk Pro
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Alexa text to speech

Post by freijn »

bramski wrote: Saturday 28 July 2018 16:35 I was being redirect to https://alexa.amazon.co.uk when I went to https://alexa.amazon.com.
Actually got it working by altering the settings in the shell script as follows:

Code: Select all

LANGUAGE="en-US"
AMAZON='amazon.co.uk'
ALEXA='alexa.amazon.co.uk'
Hope this helps anyone struggling

So I get this in my browser :
https://alexa.amazon.com/spa/index.html#settings

Configured this in the script:
#LANGUAGE="de-DE"
LANGUAGE="en-US"

#AMAZON='amazon.de'
#AMAZON='amazon.com'
AMAZON='amazon.co.uk'

#ALEXA='layla.amazon.de'
#ALEXA='pitangui.amazon.com'
ALEXA='alexa.amazon.co.uk'

exe :
./alexa_remote_control.sh -a the following devices exist in your account:
Office
Frank's echosim_BETA
Frank's homedomo
LivingRoom
Frank's Alexa Apps


but :
give me nice outout but no sound on the alexa :-( Any hints? (numbers are modified)

./alexa_remote_control.sh -d ALL -e speak:'Put your text to announce here'
sending cmd:speak:Put your text to announce here to dev:Office type:A3S5BH2HU6 serial:G090LF107212 customerid:A3MOWYBUE3
Sequence command: Alexa.Speak
sending cmd:{"behaviorId":"PREVIEW","sequenceJson":"{\"@type\":\"com.amazon.alexa.behaviors.model.Sequence\",\"startNode\":{\"@type\":\"com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode\",\"type\":\"Alexa.Speak\",\"operationPayload\":{\"deviceType\":\"A3S5BH\",\"deviceSerialNumber\":\"G090LF107212\",\"locale\":\"en-US\",\"customerId\":\"A3MOWYBUE3\",\"textToSpeak\":\"Put_your_text_to_announce_here\"}}}","status":"ENABLED"} to dev:LivingRoom type:A3S5BH2HU6 serial:G090LF117372 customerid:A3MOWYBUE3
Sequence command: Alexa.Speak

Any hints? tips?
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Alexa text to speech

Post by Hesmink »

@freijn I had the same when my echos were in my Amazon.com account. I moved them to Amazon.de and it worked.
Don't know why this happened though. I bought them originally from Amazon.de.
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Alexa text to speech

Post by freijn »

Hesmink wrote: Sunday 29 July 2018 10:42 @freijn I had the same when my echos were in my Amazon.com account. I moved them to Amazon.de and it worked.
Don't know why this happened though. I bought them originally from Amazon.de.
Does that not change any other setting like skills or subscriptions?
Did your echo started to talk German then ?

Thanks

Frank
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Alexa text to speech

Post by Hesmink »

freijn wrote: Sunday 29 July 2018 13:27
Hesmink wrote: Sunday 29 July 2018 10:42 @freijn I had the same when my echos were in my Amazon.com account. I moved them to Amazon.de and it worked.
Don't know why this happened though. I bought them originally from Amazon.de.
Does that not change any other setting like skills or subscriptions?
Did your echo started to talk German then ?

Thanks

Frank
You will probably reset skills etc, but Alexa can still be set to any supported language. Talks English to me.
I tried first with one echo and that worked. If not, you can switch it back.
lepetitnicolas
Posts: 12
Joined: Wednesday 02 November 2016 22:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: South West of France
Contact:

Re: Alexa text to speech

Post by lepetitnicolas »

Hello,
Just to tell you that at home it works great.

do not forget to install .jq (like me)
and follow the instructions of the blog

Thank you for making me discover this script

For info I bought my echo spot in France and the links are:

Code: Select all

LANGUAGE="fr-FR"
#LANGUAGE="de-DE"
#LANGUAGE="en-US"

AMAZON='amazon.fr'
#AMAZON='amazon.de'
#AMAZON='amazon.com'

ALEXA='alexa.amazon.fr'
#ALEXA='layla.amazon.de'
#ALEXA='pitangui.amazon.com'
Raspberry Pi 3 - RFLink and Homewizard
lepetitnicolas
Posts: 12
Joined: Wednesday 02 November 2016 22:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: South West of France
Contact:

Re: Alexa text to speech

Post by lepetitnicolas »

is it possible to display text on the echo spot?
Raspberry Pi 3 - RFLink and Homewizard
sion
Posts: 113
Joined: Friday 08 January 2016 12:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Alexa text to speech

Post by sion »

@freijn
I had the same as this.
Does it work when you set it to just one of the echos?
You need Jq installed for this - and be sure to reboot after installing it.
It’s working perfectly for me now - so far only have it welcome us home; but plan to hook it up to smoke detectors to announce what detector has been triggered; and also just waiting on a power outlet with power monitoring - so we can get a reminder when the washing is done.

Has anyone found a way to get her to pause? Having ,, ,, seems to give a bit of a pause but not much.
running domoticz 3.4834 on rpi2, with
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.

Next: harmony hub.
renerene
Posts: 316
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

Re: Alexa text to speech

Post by renerene »

This is great. I was one of the early adapters of Alexa & HABridge and this is what I've been waiting for.

Please help me with install. Here are my steps until now. I'm on Rpi3
1)Install jq from https://stedolan.github.io/jq/download/ by using command sudo apt-get install jq
2) reboot RPI
3) Downloaded script from https://loetzimmer.de/patches/alexa_remote_control.sh (via blog https://blog.loetzimmer.de/2017/10/amaz ... -echo.html) en placed it in /home/pi/domoticz/scripts/
4) Set permissions on the script to 777
5) Filled the field Domoticz Settings -> Notifications -> Custom HTTP/Action -> URL/Action with ‘script:///home/pi/domoticz/scripts/alexa_remote_control.sh -e speak:'MESSAGE' (without the #, no need for variable while testing)
All other fields are empty
6) After pressing test the following line comes into domoticz log:
2018-08-02 18:05:19.003 Error: Error executing script command (/home/pi/domoticz/scripts/alexa_remote_control.sh). returned: 256
7) tested with all three Amazon sites in the script (.COM .UK .DE)

can only login to amazon.com. The other two don't call or send messages, so can not login. In the amazon.com my device is not visable
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Alexa text to speech

Post by Hesmink »

renerene wrote: Thursday 02 August 2018 18:09 This is great. I was one of the early adapters of Alexa & HABridge and this is what I've been waiting for.

Please help me with install. Here are my steps until now. I'm on Rpi3
1)Install jq from https://stedolan.github.io/jq/download/ by using command sudo apt-get install jq
2) reboot RPI
3) Downloaded script from https://loetzimmer.de/patches/alexa_remote_control.sh (via blog https://blog.loetzimmer.de/2017/10/amaz ... -echo.html) en placed it in /home/pi/domoticz/scripts/
4) Set permissions on the script to 777
5) Filled the field Domoticz Settings -> Notifications -> Custom HTTP/Action -> URL/Action with ‘script:///home/pi/domoticz/scripts/alexa_remote_control.sh -e speak:'MESSAGE' (without the #, no need for variable while testing)
All other fields are empty
6) After pressing test the following line comes into domoticz log:
2018-08-02 18:05:19.003 Error: Error executing script command (/home/pi/domoticz/scripts/alexa_remote_control.sh). returned: 256
7) tested with all three Amazon sites in the script (.COM .UK .DE)

can only login to amazon.com. The other two don't call or send messages, so can not login. In the amazon.com my device is not visable
First of all, you need to login to the amazon site where you registered the Echo dot's, so the same account you use for the alexa app.
Change the parameters in the script for the correct country site.

Then try it on the command line first, before you try to use it as notification.
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Alexa text to speech

Post by freijn »

sion wrote: Thursday 02 August 2018 1:29 @freijn
I had the same as this.
Does it work when you set it to just one of the echos?
You need Jq installed for this - and be sure to reboot after installing it.
It’s working perfectly for me now - so far only have it welcome us home; but plan to hook it up to smoke detectors to announce what detector has been triggered; and also just waiting on a power outlet with power monitoring - so we can get a reminder when the washing is done.

Has anyone found a way to get her to pause? Having ,, ,, seems to give a bit of a pause but not much.
Does it work when you set it to just one of the echos? FR: no :-(

You need Jq installed for this - and be sure to reboot after installing it. FR: didn't do the reboot , will do so in the next hour Thanks !!!

will let you know the result. Thanks for the reply Frank
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest