Released: Openhab2 Amazon Echo Control Binding (controlling alexa from openhab2)

development
binding
alexa
Tags: #<Tag:0x00007f0156926d10> #<Tag:0x00007f0156926b58> #<Tag:0x00007f0156926a18>

(Kris K) #1315

Hi All,

im using this binding version, org.openhab.binding.amazonechocontrol_2.4.0.201811041600.jar which I’m not sure of the version number

I have a repeatable speed issue, in that when the echo items file is loaded, it takes over 3000ms to load in HabPanel. When i comment out the file, my speed returns and all is fine

The binding/echos are causing a huge delay to the system. Does anyone know how I can resolve this?

Thanks


(Kris K) #1316

Hi Zolakk @michi i have this exact same issue.

How do we resolve this?


(Thomas) #1317

I trigger the search via alexa app on mobile phone or via the alexa login in browser. That is working, so I do not need to un/reinstall the binding.


(omatzyo) #1318

I also had this problem initially. It was related to system resources. The discovery is intensive. I was running on a pi. If you figure out what is eating your resources and fix that you should be able to do both. Part of the solution was to change the frequency that the Alexa binding polls Amazon. (In my case the older version of the nest 2.0 binding was the real culprit… but that’s been resolved for a while)


(omatzyo) #1319

I have Apple Music and echos, but unless something has changed recently these is no connection between the two.


(Udo Weber) #1320

On which raspberry do you have the problem? Also a Raspberry Pi 2 Model B Rev 1.1?


(Udo Weber) #1321

Thanks for this hint, I will give it a try and report later.

So, tried it with my phone, same results, no new devices are found. If I turn off the binding, new devices are found with my phone.


(Udo Weber) #1322

Mmm interesting, is their a easy way to see how much resources a binding/addon in openhab is consuming? Because top only gives me the consumption of openhab java process in total.

CPU is running during search around 80%. I have some free memory, but as I see openhab is started with maximum memory allocation pool for the Java virtual machine of 512MB.

Thanks for your help. :slight_smile:


(Ray) #1323

I have a raspberry 3B Plus, when i see the error in the log CPU load does not come above 50%, memory available is stable around 45%
I just tested this to see if there is a peak when I ask her “Discover my devices”, there is none that i can see


(omatzyo) #1324

In on a 3B plus also. I’ll test when I get home. What OH version do you guys have?


(Ray) #1325

Openhabian 2.3.0.1 if i’m not mistaken


(Udo Weber) #1326

I’m working with two:

One at my fathers house, a Raspberry Pi 2 Model B Rev 1.1 with openHAB 2.4.0-1 (Release Build) and the mentioned issue.

One for me, a Raspberry Pi 3 Model B Rev 1.2 with openHAB 2.4.0-1 (Release Build) with out any problem.


(Udo Weber) #1327

What did you do to get sonos working, created a new thing with “Thing type id” echo and the “Serial Number” of the Sonos? I will give it a try…

But did you get any further with TTS on Sonos or is it not working with this binding?
If not it should be possible with Google TTS, because every Sonos is an audio sink.


(Bert Kaufmann) #1328

That’s hard to answer, but I will try…

I’m on OH 2.4 (newest version from docker hub, not raspberry!) now and just saw that the binding is available as official binding now. So I shut down OH, removed old org.openhab.binding.amazonechocontrol_2.4.0.201811041600.jar from addons folder and cleared all caches.

I would recommend to do that also, to start on a clear state.

After that I restarted OH and installed the official Amazon Echo Control Binding. Even after this upgrade all is still working fine.

Here some extracts from my configuration files.

sonos.things

...
// BATH ONE sonos:One
Thing sonos:One:RINCON_xxx [udn="RINCON_xxx", refresh=60, notificationVolume=25]
...

amazonecho.things

Bridge amazonechocontrol:account:account1 "Amazon Account" @ "Accounts" [amazonSite="amazon.de", email="abc@def.gh", password="xxx", pollingIntervalInSeconds=60]
{
    ...
    Thing echo echoBath "AlexaBath" @ "OG" [serialNumber="xxx"]
    ...
}

amazonecho.items

...
// Commands
String EchoBathTTS                	"Text to Speech"                  (AlexaBath) {channel="amazonechocontrol:echo:account1:echoBath:textToSpeech"}
...

and a part of my contacts.rules

rule "FrontDoorOpened"
when
	Item ContactFrontDoor_DoorSensor changed from CLOSED to OPEN
then	
	if (ContactFrontDoor_DoorSensor.state == OPEN) {
		...
		EchoBathTTS.sendCommand('Die Haustür wurde geöffnet!')
		EchoDiningTTS.sendCommand('Die Haustür wurde geöffnet!')
		EchoWorkingTTS.sendCommand('Die Haustür wurde geöffnet!')
		...
		}
end

As you can see here, I’m sending the text also to other speakers in my house, but only EchoBathTTS will play the sound. All other speakers won’t play anything over TTS.

But that’s - as I understood - a limitation of Amazon’s api and won’t work (at this moment).

So perhaps start with a clean installation with only one speaker and try to get it working with config-files and a rule for testing like above. If you get that running, place more speakers to it.

Good luck and (most important) have some nice Christmas days!


(Michael) #1329

The problem is that you´re not waiting for the first command to be executed.
I figured out that you need to wait atleast one second before sendingung another TTS command.
You could do it with Thread::sleep(1000) or creating groups with your TTS members

Group EchoFirstfloorTTS
String EchoBathTTS     (EchoGroupTTS)
String EchoDiningTTS   (EchoGroupTTS)
String EchoWorkingTTS  (EchoGroupTTS)

And then triggering the Group to send your text

EchoFirstfloorTTS.sendCommand('Die Haustür wurde geöffnet!')

Don´t ask me why but this works just fine instead of sending the command one by one.


(JustAProgrammer) #1330

I can approve that, noticed the same thing on my dots


(Bert Kaufmann) #1331

Hmm… Just tried that. Also after cleaning caches, restarting OH and reconnecting to Amazon-Account both ways don’t work here. Strange!


(Oliver) #1332

Is there any way to get an information on which Echo i called a command?

it is possible, but only on an indirect way:
In my case there are 3 Echos having the Last Voice Command channel linked:

String Echo_Children_LastVoiceCommand	   "Last Voice Command"				         {channel="amazonechocontrol:echo:account1:XXXXXXXXXXXXXX:lastVoiceCommand"}
String Echo_Bedroom_LastVoiceCommand	   "Last Voice Command"				         {channel="amazonechocontrol:echo:account1:XXXXXXXXXXXXXX:lastVoiceCommand"}
String Echo_Living_LastVoiceCommand	   "Last Voice Command"				         {channel="amazonechocontrol:echo:account1:XXXXXXXXXXXXXX:lastVoiceCommand"}

I’ve created two dummy items

Number Echo_Current                         "Letzte Alexa"
String Echo_LastCommand                  "Letztes Commando"

using this rule:

when
	Item Echo_Bedroom_LastVoiceCommand changed
then
	Echo_Current.sendCommand(1)
	Echo_LastCommand.sendCommand(Echo_Bedroom_LastVoiceCommand.state.toString)
end

rule "check last Alexa2"
when
	Item Echo_Living_LastVoiceCommand changed
then
	Echo_Current.sendCommand(2)
	Echo_LastCommand.sendCommand(Echo_Living_LastVoiceCommand.state.toString)
end

rule "check last Alexa3"
when
	Item Echo_Children_LastVoiceCommand changed
then
	Echo_Current.sendCommand(3)
	Echo_LastCommand.sendCommand(Echo_Children_LastVoiceCommand.state.toString)
end

the dummy items contain the last command as string and the last echo used as number.

Merry Christmas


(Scott Johnson) #1333

Merry Christmas 'Eve to all. I posted this question in its own thread a few days ago, I should have posted here instead. I am enjoying the Echo Control Binding but am having 1 small issue. I can’t play Amazon Stations, I can play Amazon Playlists and Tunein Stations fine. When I keep trying different command sequences the station will play “sometime”, but not on a repeatable basis. Can someone help me with the syntax or sequence to play an Amazon Station.

THANKS!!!

items file:


// Player control
Player Echo_Home_Player               "Player"                            (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:player"}
Dimmer Echo_Home_Volume               "Volume [%.0f %%]" <soundvolume>    (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:volume"}
Switch Echo_Home_Shuffle              "Shuffle"                           (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:shuffle"}

// Player Information
String Echo_Home_ImageUrl             "Image URL"                         (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:imageUrl"}
String Echo_Home_Title                "Title"                             (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:title"}
String Echo_Home_Subtitle1            "Subtitle 1"                        (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:subtitle1"}
String Echo_Home_Subtitle2            "Subtitle 2"                        (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:subtitle2"}
String Echo_Home_ProviderDisplayName  "Provider"                          (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:providerDisplayName"}

// Music provider and start command
String Echo_Home_MusicProviderId      "Music Provider Id"                 (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:musicProviderId"}
String Echo_Home_PlayMusicCommand     "Play music voice command (Write Only)" (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:playMusicVoiceCommand"}
String Echo_Home_StartCommand         "Start Information" (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:startCommand"}

// TuneIn Radio
String Echo_Home_RadioStationId       "TuneIn Radio Station Id"           (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:radioStationId"}
Switch Echo_Home_Radio                "TuneIn Radio"                      (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:radio"}

// Amazon Music
String Echo_Home_AmazonMusicTrackId    "Amazon Music Track Id"            (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:amazonMusicTrackId"}
String Echo_Home_AmazonMusicPlayListId "Amazon Music Playlist Id"  (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:amazonMusicPlayListId"}
Switch Echo_Home_AmazonMusic           "Amazon Music"                     (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:amazonMusic"}



// Commands
String Echo_Home_TTS                "Text to Speech"                           (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:textToSpeech"}
String Echo_Home_Remind                "Remind"                           (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:remind"}
String Echo_Home_PlayAlarmSound         "Play Alarm Sound"                           (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:playAlarmSound"}
String Echo_Home_StartRoutine         "Start Routine"                           (Alexa_Home) {channel="amazonechocontrol:echo:account1:echo1:startRoutine"}

Rule that does not work:

// Amazon Radio
rule Alexa_Playlist2
when
    Item mhPlaylist2 received update ON
then
	//Echo_Home_MusicProviderId.sendCommand('Amazon Music')
	//Thread::sleep(1000)
	//Echo_Home_AmazonMusicPlayListId.sendCommand('')
	//Thread::sleep(1000)
	Echo_Home_PlayMusicCommand.sendCommand('')
	Thread::sleep(5000)
	Echo_Home_PlayMusicCommand.sendCommand('90s Country')

end

(JustAProgrammer) #1334

actually pretty smart…
you could make a virtual switch item for lights, only turning on/off those lights where the echo is…