Release Candidate and Support: Amazon Echo Control Binding

Will chek to create a .thing file soon!

Did someone already tried to play something from the Amazon Sound Library?

I made a small test but this wasnĀ“t working

echoArbeit_TTS.sendCommand("<speak>The sheep do <audio src='soundbank://soundlibrary/animals/amzn_sfx_sheep_bleat_03'/></speak>")

The new channel works like a charm!

Thanks!

1 Like

Yes, this is technical possible. What are you thinking about this?

1 Like

Not yet tested, but it should work wirh public https urls, but the mo3 must fullfill some rules. The are somewhere documented on the amzon developer pages.

This makes at really much more easier if you want test with the latetest beta version and new channels.

I took one of the Amazon examples :smile:
Iā€˜ll have another look tomorrow and see what is possible.

I am running Openhab 2.5.0~S1496-1 on a Raspbery Pi 3+ and SSD as primary storage, and have had no issues for a while :grinning: but all of a sudden my HAB Panel has started to state:

ā€œConnection lost! Trying to reconnectā€¦ā€

After some initial investigations it appears that the call to <my_openhab_ip>:8080/rest/items is failing. Trying to call this directly (just using a web browser) the full json is sometimes returned, but more often than not it returns just:

{"error":{"message":"GET url \u0027https://alexa.amazon.co.uk/api/behaviors/entities?skillId\u003damzn1.ask.1p.music\u0027 failed: Bad Request","http-code":500,"exception":{"class":"org.openhab.binding.amazonechocontrol.internal.HttpException","message":"GET url \u0027https://alexa.amazon.co.uk/api/behaviors/entities?skillId\u003damzn1.ask.1p.music\u0027 failed: Bad Request","localized-message":"GET url \u0027https://alexa.amazon.co.uk/api/behaviors/entities?skillId\u003damzn1.ask.1p.music\u0027 failed: Bad Request"}}}

The Amazon Echo Control Binding has been installed from PaperUI (binding-amazonechocontrol - 2.5.0.SNAPSHOT) and I am able to check the account via http://<my_openhab_ip>:8080/amazonechocontrol/account1 and it correctly shows that the account is logged in and also shows all my devices. I am also able to control all of these devices correctly from within OpenHAB.

Uninstalling the binding everything works perfectly again (apart from - obviously - the control of my Amazon devices!).

Any assistance, or ideas on my next steps would be greatly received.

UPDATE:
Have downloaded and placed the beta 2.5 (3) into the addons folder and now the issue does not exist.

1 Like

I would set alarms directly from homeseer (mqtt )( i use homeseer ).

  1. ex: I have two echo in my living room:

if an alarm is set to LVecho2 then copy the alarm to LVecho1 , then delete the alarm on lvecho2.

  1. if my phone is not detected on the wifi ( on a morning day) set an alarm on the echo to wakemeup

  2. if an alarm had been set and i am already outside the house, then delete the alarm .

  3. every tuesday night set an alarm on a echo to wake me up at 8 am wednesday morning. If there is no school tomorow delete the alarm.

the list could go onā€¦

Iā€™m facing the same issue, unistalled the Amazon Echon Control binding as when this happens Habpanel stalls for a while. Will try a current beta of the binding over the weekend and feedback here.

Did you get the audio-tag (with the Amazon Sound Library) to work?

<audio src='soundbank://soundlibrary...

Unfortunately no.
Alexa just skips the part and it happens nothing.

nextReminder - logic recommendations needed

One of my wifeā€™s complaints about setting a reminder on an Echo is that you have to be by that Echo when the reminder is played back. That rarely happens, so we donā€™t use that function.

My idea is to check for nextReminderā€™s across all the Echoā€™s and then play the reminder at that time using a group TTS across ALL the Echoā€™s.

How would I execute the group TTS based on that reminder(s) set time? Set a CRON task somehow in a rule? Continue to looping until that time occurs, etc?

I think this would be a very helpful rule for a bunch of people on this thread.

Hereā€™s what I got so far to determine nextReminders set.

Group:DateTime:OR(UNDEF,NULL) Alexa_Reminder "State [%s]"
rule "Checking for Echo Reminders via Group"
    when
		Member of Alexa_Reminder received update or
		Member of Alexa_Reminder changed	
	then

		if (triggeringItem.state != UNDEF && triggeringItem.state != NULL && triggeringItem.state !== null) {

			logInfo("Echo", "Found An Echo Reminder On " + triggeringItem + " Set For " + triggeringItem.state)
		}
end

Which produced this output:

2019-01-19 14:39:57.079 [INFO ] [.eclipse.smarthome.model.script.Echo] - Found An Echo Reminder On Echo_Jay_nextReminder (Type=DateTimeItem, State=2019-01-19T14:41:00.000-0600, Label=Next Reminder, Category=clock, Groups=[Alexa_Reminder]) Set For 2019-01-19T14:41:00.000-0600
2019-01-19 14:39:57.092 [INFO ] [.eclipse.smarthome.model.script.Echo] - Found An Echo Reminder On Echo_Jay_nextReminder (Type=DateTimeItem, State=2019-01-19T14:41:00.000-0600, Label=Next Reminder, Category=clock, Groups=[Alexa_Reminder]) Set For 2019-01-19T14:41:00.000-0600

LMK your ideas?

Best, Jay

Hi,
the SSML support for TTS works with a simple sentence.
Is it possible with a variable too?
My code looks like:

Echo_Kueche_TTS.sendCommand('<speak>Das Telefon klingelt,<break time="1s"/>.</speak>' + CallerName2 + 'ruft an')

in this case CallerName2 is a variable from the Fritzbox.
The echo reads ā€œspeakā€ and ā€œbreak timeā€ instead of doing a pause of 1 second.

For the moment i realize it with:

...
Echo_Kueche_TTS.sendCommand('<speak>Das Telefon klingelt,<break time="600ms"/> es ruft.</speak>')
timeralexa2 = createTimer(now.plusSeconds(5)) [|
Echo_Kueche_TTS.sendCommand(CallerName2 + "an")
]
....

This works, but i want to simplify the rule and the time to the second TTS (CallerName2 + ā€œanā€) is somtimes a little bit longer or shorter.

Any idea to get it to work with one sentence?

Best regards
Michael

I havenā€™t played with SSML yet, but I donā€™t see why something like this wouldnā€™t workā€¦

Echo_Kueche_TTS.sendCommand('<speak>Das Telefon klingelt,<break time="1s"/>. ' + CallerName2 + ' ruft an</speak>')

thank you very much for your help Scott, itā€™s working now!

2 Likes

Is it somehow possible to show a message on Echo Show/Echo Spot using this? I do not want it to say anything, just show a little message (for example if the phone is ringing show who is calling but donā€™t actually say it).

Hereā€™s what I came up with and thank you @5iver for the help on the timer creation line! There are few issues with this example (code scaling for lots of echoā€™s, my bad use of lengthy timers, etc.) Iā€™m open to code streamlining . . .

Items:

String      Echo_Jay_TTS                   "Text to Speech"                  			 (Alexa_TTS_Alerts)                  { channel="amazonechocontrol:echo:account1:echojay:textToSpeech" }
DateTime	Echo_Jay_nextReminder	       "Next Reminder [MAP(alexaalarm.map):%s]"				<clock>		(Alexa_Reminder) { channel="amazonechocontrol:echo:account1:echojay:nextReminder" }

Variables in Rules:

var String			reminder_Jay = null							// Alexa Last Heard Reminder
var Timer			reminder_Jay_tAlive = null					// Alexa Timer

Rule:

rule "Checking for Echo Reminders via Group and Speaking them across all Echos"
    when
		Member of Alexa_Reminder received update
	then

		// Echo reminders via voice should be said in this format below
		// Echo, remind me of X <pause> 3:20 (must say reminder first, then pause, then you will be prompted for a time)

		if (triggeringItem.state != UNDEF && triggeringItem.state != NULL && triggeringItem.state !== null) {

			logInfo("Echo", "Found An Echo Reminder On --> " + triggeringItem.name + " <-- Is Set For --> " + triggeringItem.state)
			
			if (reminder_Jay_tAlive === null && triggeringItem.name == 'Echo_Jay_nextReminder') {
				
				reminder_Jay = Echo_Jay_LastVoiceCommand.state.toString
				logInfo("Echo", "Echo Reminder On --> " + triggeringItem.name + " <-- Set For --> " + triggeringItem.state + " <-- With This Reminder --> " + reminder_Jay)

				reminder_Jay_tAlive = createTimer(new DateTime(triggeringItem.state.toString)) [ |
    				reminder_Jay_tAlive.cancel()
						Thread::sleep(2000)   // 2 second wait
					reminder_Jay_tAlive = null
					Alexa_TTS_Alerts.sendCommand(reminder_Jay)			// TTS to a group of Echos
						Thread::sleep(22000)							// 22 second wait to insure all 11 Echos spoke
					logInfo("Echo", "-----------------------------------------------------------------------------")
					logInfo("Echo", "** Echo Reminder Spoken Around House Was --> " + reminder_Jay)
					logInfo("Echo", "-----------------------------------------------------------------------------")

				]
				
			} else if (reminder_Jay_tAlive !== null && triggeringItem.name == 'Echo_Jay_nextReminder' && triggeringItem.state == UNDEF){
			
				// Cancel the reminder timer since the reminder was cancelled via voice

				logInfo("Echo", "Echo Reminder Cancelled via Voice On --> " + triggeringItem.name)
				reminder_Jay_tAlive.cancel()
					Thread::sleep(2000) 	// 2 second wait
				reminder_Jay_tAlive = null
			}		
		}
end

Best, Jay

Not yet, but I will check this possibility, I expext that it will work, for the ssml support The json have different entries for the display and the spoken text. Currently I use both with the same value. But I will need a beta tester :wink: for this, I do not own such a device.