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

development
binding
alexa
Tags: #<Tag:0x00007f01440faf18> #<Tag:0x00007f01440fadb0> #<Tag:0x00007f01440fac48>

(Markus S.) #1294

Hi Michael. Thanks for your info. Perfect. :ok_hand:
Greetings,
Markus


(Martin Puff) #1295

Hello,

how can i use a secound echo for text to speech?
when i setup a secound dot, it is online in the paper ui, i copyed the rule from the first one that is working and change it for the secound.
when the rule starts, the first echo is speeching the text, the secound dot is only lightning blue, but no sound.
the first one is a echo 2nd generation, and the secound one is a echo dot 3rd generation.

thing file:

Thing echo              XXXXXXXXXXXXXX          "Alexa Wohnzimmer"   [serialNumber="XXXXXXXXXXXXXX"]
Thing echo              XXXXXXXXXXXXXX          "Alexa Schlafzimmer" [serialNumber="XXXXXXXXXXXXXX"]

item file:

String Echo_Living_Room_FF_Bed                   "Text to Speech"                        (FF_Bed) {channel="amazonechocontrol:echo:XXXXXXXX:XXXXXXXXXXXXXX:textToSpeech"}

rule file:

rule "Benachrichtigung im Schlafzimmer wenn eine Bewegung in der Garage erkannt wurde"
when
    Item Motion_Garage_mitte received update ON
then
if (Echo_Living_Room_Speak.state == ON) {
        Echo_Living_Room_FF_Bed.sendCommand('Es wurde eine Bewegung in der Garage erkannt')
        logInfo("FILE", "Es wurde eine Bewegung in der Garage erkannt")
    }  
end

Greetings,
Martin


(Thomas) #1296

I have defined for each Echo its own text to speech item.
The rule calls both items.


(Martin Puff) #1297

if you mean the Echo_Living_Room_Speak.state, this is only a virtual switch for the rule, that i can turn off and on the execution of the rule


(Thomas) #1298

I have it like this, I double everything up (maybe there is a better solution, then I would be interested, too)
item file:

String Echo_second_gen  "Text to Speech"  {channel="amazonechocontrol:echo:XXXXXX:textToSpeech"}
String Echo_third_gen  "Text to Speech"  {channel="amazonechocontrol:echo:XXXXXX:textToSpeech"}

rule file

Echo_second_gen.sendCommand("...")
Echo_third_gen.sendCommand("...")

(Derchrome) #1299

Hello everyone, just a small question.
How do I get the actual state of my echo?
I want to turn on the amplifier if the echo plays music in a rule.
Another thing I would like to do is to stop the music of the TV is turned.
And how to add a control (like play, pause, next, previous) in my sitemap? Other things like volume am actual artist and so one work.
As I stand on the tube right now I would be glad if you could post some example rules.

Thanks in advance!


(Michael) #1300

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

I´ve some dummy switches that are exposed to Alexa through the Homekit markup.
[“Switchable”]
When i´m saying the magic words that are configured in one of my routines the dummy item gets switched on.
This triggers a rule to do something and switch the dummy back to off at the end.

Currently this is pretty static as i´m only able to hardcode an answer to one device.


Does someone already have access to the new Guard feature and knows if this can be triggered from openHAB?
As far as i know you need to call Alexa that you´re leaving or coming home.


(Thomas) #1301

See post #1227


(Thomas) #1302

I think currently it is not possible, but I would love this feature


(Michael) #1303

Awesome :slight_smile:
Thanks for reffering!


@derchrome

You´re able to trigger the rule by the state of the channel type “player”:

2018-12-15 18:35:09.565 [vent.ItemStateChangedEvent] - echoArbeit_Player changed from PAUSE to PLAY

You need the channel type player and then add this item as Default to your sitemap.

Default item=echoArbeit_Player

This will result in an controllable item on your sitemap:

Just have a look at the addons help: Amazon Alexa Control Binding


@idkpmiller
Hi Paul,

thanks for your work!
I just build a rule to play an Radio Station on TuneIn that is not recognized by Alexa.
As i have different Echos around my house i need to adjust the volume to match the Echo that is used.
An Echo Dot 3.Gen is much louder than a Echo Dot 2.Gen…

Rule:

rule "1Live Diggi abspielen"

when

    Member of EchoCommands changed to "eins live diggi"

then

    val SourceRoom = triggeringItem.name.split("_").get(0)
    val _RadioID = SourceRoom+"_RadioID"
    val _Volume = SourceRoom+"_Volume"

    val SourceArbeit = (SourceRoom == "echoArbeit")

    if(SourceArbeit)
    {
        _Volume.sendCommand(60)
        Thread::sleep(1000)
        _RadioID.sendCommand('s45087')
    }

end

I´m getting this error:

2018-12-15 18:26:47.990 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule '1Live Diggi abspielen': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(java.lang.String,java.lang.String) on instance: null

I already figured out that _Volume.sendCommand(60) will cause this error.
_RadioID.sendCommand('s45087') works fine.

The items are correct and should work like this:

Dimmer echoArbeit_Volume "Echo Arbeit [%.0f %%]" <soundvolume> (Alexa_Arbeit, Arbeit) {channel="amazonechocontrol:echo:Michael:echoArbeit:volume"}
String echoArbeit_RadioID "Radio Sender ID" (Alexa_Arbeit, Arbeit) {channel="amazonechocontrol:echo:Michael:echoArbeit:radioStationId"}

The rule works withouth adjusting the volume and is also simplier, but it could be that one of my Echos starts the music with 100% volume. No problem for 2.Gen Echo Dots but for 3.Gen Echo Dots and my Echo :smiley:

Cheers
Michael


(Michael Geramb) #1305

At least, it is possible to use the player channel state to check if music is played.


(Derchrome) #1306

@Michael: Thanks for your help. I already added a default value to my sitemap but it shows nothing :thinking:


(Michael Geramb) #1307

I found a bug in the proxy implementation. Please try it with Beta 10 and send it as PUT. I have tested it now and this will work. If you have the complete code for using it in a rule, please post it here in this thread.


(Michael Geramb) #1308

BETA 10 Released (This version is newer than the 2.4 snapshot builds because it is not yet merged in the master)

this is a bug fix release. It fixes a bug with the proxy function for PUT and POST http verbs and fixes a problem for users with problems with TTS if the use not the amazon owner account of the device. For all users is no need to upgrade.


(JustAProgrammer) #1309

So the procedere to manually add the .jar folder is now fixed? :slight_smile:


(Michael Geramb) #1310

I don’t understand the question, this is not a binding problem, sometimes openHAB has problems with caches, but basically this works, I always use the manual installed jar in my installation. If you have previously installed the binding from the paperUI you should deinstall it first, then copy the jar to the add on folder and it should work.


(JustAProgrammer) #1311

that’s what I did, but some people including me, had problems when trying to connect to alexa.de (or whatever domain) with the manually added echo control. Just wanted to ask if you worked on/fixed this problem :slight_smile:


(Michael Geramb) #1312

Is there any USA user with “Apple Music” on the echo?


(Udo Weber) #1313

Hi @michi,

I have a problem with the Amazon Echo Control Binding and the Amazon Alexa Skill .

If I NOT install the Amazon Echo Control Binding I can tell Alexa via Voice Command to finde new devices and e.g. new items with the Tag [“Lighting”] are found w/o a problem.

But as soon as I install Amazon Echo Control Binding , no new devices are found. And during the search for new devices, the log files shows an exception shortly before Alex tells me that nothing new could be found.

Interesting is that existing switches are still working with Amazon Echo Control Binding installed.

So currently my annoying workaround is:
Add new Alexa Switch, disable the Amazon Echo Control Binding , let Alexa search for new devices, install Amazon Echo Control Binding again.

I had this problem with OpenHab 2.3 also. Yesterday I did a complete fresh installed of OpenHAB 2.4 on a new SD Card and only copied /etc/openhab2 , uuid and secret of myopenhab. But the problem still exists.

I already opened a issue on GitHub with addition information attached.
Let me know if you need anything else.
Thanks for your binding :slight_smile:

Greets Udo


(Ray) #1314

I can confirm the problem udo descripes, when i ask her to search i see errors in the log and she doesn’t discover the new tagged devices
Also use a workaround with an old oh on a vm
I,m realy happy with this binding and can live with these minor problems :grin: