Page 1 of 8

Alexa text to speech

Posted: Wednesday 25 July 2018 21:26
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.

Re: Alexa text to speech

Posted: Wednesday 25 July 2018 22:24
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?

Re: Alexa text to speech

Posted: Friday 27 July 2018 14:30
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.

Re: Alexa text to speech

Posted: Friday 27 July 2018 14:35
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

Re: Alexa text to speech

Posted: Saturday 28 July 2018 15:05
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..

Re: Alexa text to speech

Posted: Saturday 28 July 2018 16:31
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.

Re: Alexa text to speech

Posted: Saturday 28 July 2018 16:35
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

Re: Alexa text to speech

Posted: Saturday 28 July 2018 16:52
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

Re: Alexa text to speech

Posted: Saturday 28 July 2018 17:36
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.

Re: Alexa text to speech

Posted: Sunday 29 July 2018 9:37
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

Re: Alexa text to speech

Posted: Sunday 29 July 2018 10:12
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?

Re: Alexa text to speech

Posted: Sunday 29 July 2018 10:42
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.

Re: Alexa text to speech

Posted: Sunday 29 July 2018 13:27
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

Re: Alexa text to speech

Posted: Sunday 29 July 2018 15:07
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.

Re: Alexa text to speech

Posted: Wednesday 01 August 2018 20:54
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'

Re: Alexa text to speech

Posted: Wednesday 01 August 2018 23:32
by lepetitnicolas
is it possible to display text on the echo spot?

Re: Alexa text to speech

Posted: Thursday 02 August 2018 1:29
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.

Re: Alexa text to speech

Posted: Thursday 02 August 2018 18:09
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

Re: Alexa text to speech

Posted: Thursday 02 August 2018 19:35
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.

Re: Alexa text to speech

Posted: Thursday 02 August 2018 21:33
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