Release Candidate and Support: Amazon Echo Control Binding

Have you tried this:

@bezibaerchen,

I just spent a couple hours trying to make my system experience your HTTP ERROR 500 problem. For example, I edited the amazon account details in the things file and entered wrong passwords, account names, and caused other unworldly mayhem. I even messed with file permissions, file names, and so on.

I successfully crashed my system a few times, even to the point that one time it took two reboots and a manual system restart to get it working again. But I never experienced any issues with visiting /amazonechocontrol/account/.

Looking back at your comments, the only deviation you’ve made with your OpenHab installation is with the Port number (8090 vs 8080). But you’ve even changed it back to default without success.

It’s probably a good time to log back into your Amazon account (https://www.amazon.de) from your PC. Then confirm the devices in Smart Home-Devices. Plus revisit Settings->devices and confirm your echo devices are still listed and shown as “online.”

Hopefully the binding’s author can lend a hand. Your issue looks like a tough one!

  • Thomas

.

I’m experiencing the same. I did get it to work for a little while. Probably time to get an issue created to track this one (my hands are full at the moment).

Alexa SmartHome Devices:

Is it possible to control Alexa’s SmartHome Devices that are predefined within Alexa?

This rule tied to a virtual switch isn’t working so maybe its my syntax or maybe it’s not possible yet?

rule “Alexa Turns Fans ON”
when
Item All_Fans changed to ON
then
Echo_Living_Room_StartCommand.sendCommand(‘Fans On’)
Thread::sleep(3000) // 3 second wait
Echo_Living_Room_StartCommand.sendCommand(‘Fans On’)
end

Any help would be appreciated.

Best, Jay

@bezibaerchen,

Which version of Java are you using. if i can reproduce your issue on my device
I use
java version “1.8.0_171”
openhab2 Snapshot 2.3.0 installed via apt-get
It works well with the above setup

Regards
Cadbures

If you want Alexa make an announcement for testing then isn’t Speak channel the way to do it. Or I misunderstood your problem.

Anyway maybe the following is useful to you or someone else…

I found Alexa TTS unreliable if the play volume is undefined, which is often the case if Alexa wasn’t playing anything. Also, if Alexa is already playing something I return the volume setting to where is was before the fixed volume TTS announcement. Log info command is useful for debugging. So I did it like this:

Maybe if would be better if the rule started with when ‘Item’ changed from Off to On instead of just On as below.

rule 'Cistern pump On'
when
  Item CisternPump_Switch changed to ON
then
if (Echo_Player.state == PLAY) {
    val current_volume_echo = Echo_Volume.state as Number
    logInfo("Alexa" , 'Player state '+ Echo_Player.state + ' volume '+ Echo_Volume.state)
    Echo_Player.sendCommand(PAUSE)
    Thread::sleep(2000)
    Echo_Volume.sendCommand(35)
    Thread::sleep(2000)
    Echo_Speak.sendCommand('The cistern pump is on')
    Thread::sleep(4000)
    Echo_Volume.sendCommand(current_volume_echo)
    Thread::sleep(2000)
    Echo_Player.sendCommand(PLAY)
  }
  else {
    logInfo("Alexa" , 'Player state '+ Echo_Player.state + ' volume '+ Echo_Volume.state)
    Echo_Volume.sendCommand(35)
    Thread::sleep(2000)
    Echo_Speak.sendCommand('The cistern pump is on')
  } 
end

It’s definitely a tough one as I believe I tried everything without luck. Thanks for your tests.
Amazon account looks fine.

Java information:

dpkg -l | grep java
ii  java-common                             0.56ubuntu2                                all          Base package for Java runtimes
ii  javascript-common                       11                                         all          Base support for JavaScript library packages
ii  nodejs                                  4.2.6~dfsg-1ubuntu4.1                      amd64        evented I/O for V8 javascript
ii  nodejs-dev                              4.2.6~dfsg-1ubuntu4.1                      amd64        evented I/O for V8 javascript (development files)
ii  oracle-java8-installer                  8u171-1~webupd8~0                          all          Oracle Java(TM) Development Kit (JDK) 8
ii  oracle-java8-set-default                8u171-1~webupd8~0                          all          Set Oracle JDK 8 as default Java

java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

Openhab version information:

dpkg -l | grep openhab
ii  openhab2                                2.3.0-1                                    all          openhab2

I must admit I am unsure whether snapshot might improve things.
Currently using:

deb http://dl.bintray.com/openhab/apt-repo2 stable main

Hi bezibaerchen,

Did you try with older addons, manually adding them to addons folder.
org.openhab.binding.amazonechocontrol-2.3.0_RC3.jar
org.openhab.binding.amazonechocontrol-2.3.0-SNAPSHOT.jar

Regards
Cadbures

I tried org.openhab.binding.amazonechocontrol-2.3.0_RC3.jar

Where could I get hold of SNAPSHOT?

Hi bezibaerchen,

get it from here

Regards
Cadbures

Thanks for sharing. No luck with them either :frowning:

Only Difference i see is in your Java Version
Java HotSpot™ 64-Bit Server VM (build 25.171-b11, mixed mode)

Mine is java version “1.8.0_171”
Java™ SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot™ Client VM (build 25.171-b11, mixed mode)

Regards
Cadbures

I now went to OH 2.4 Snapshot with 2.4 version of binding. Same issues…

Hi Mark,

Thanks for your reply; I did learn some things from your post about setting volume from what it was set to and pausing the player first. Good stuff . . .

What I’m looking for is actually how to send commands to Alexa via OH2 which intern controls Alexa connected devices.

My example is I say to Alexa, “turn on fans” which means it will turn on all the fans in the house.

I want to send this command to Alexa and it actually executes the command (not necessary speaks it, but actually does the command as if I asked it to).

Best, Jay

@jwiseman: Here’s a couple ways to do it.

Method 1. Create “Routines” using the Amazon Alexa Mobile app.

Following your example, you would name a routine that turns on the fans and another that turns them off. Any devices registered in your Amazon account would be available to the routine, so each routine can control multiple fans.

Along with naming the routines in the mobile app, you also need to define the echo devices in your .items file and add the control actions to your .rules file. In your rules file you would use the Alexa Binding’s “startRoutine” command.

Method 2. Use the Hue Emulation Binding.
The Hue Emulation binding will allow you to use Alexa to control your devices. It’s what I use – Works great, very flexible, and not difficult to implement. The OpenHab2 docs has all the details.

  • Thomas

Hi Thomas,

Thank you very much for this! I choose Method 1 and here’s the final product:

rule “Alexa Turns Fans ON”
when
Item All_Fans_Switch changed from OFF to ON
then
logInfo(“Status”, “ALEXA: Sets All Fans to ON”)
// Sets Echo Volume
val current_volume_echo = Echo_Living_Room_Volume.state as Number
Echo_Living_Room_Volume.sendCommand(current_volume_echo)

    Echo_Living_Room_StartRoutine.sendCommand('turn routine fans on')
	Thread::sleep(2000)  // 2 second wait

	// Set individual fan states
	Office_Fan_Switch.postUpdate(ON)
	Parker_Fan_Switch.postUpdate(ON)
	Ryan_Fan_Switch.postUpdate(ON)
	Guest_Fan_Switch.postUpdate(ON)
	Bedroom_Fan_Switch.postUpdate(ON)

end

Thank you again!

You are welcome! It’s great to know it is working.

  • Thomas

Monitoring Amazon Connection?

Has anybody wrote a script to monitor if the Amazon connection is connected OK to the binding?

it would be nice to get an email knowing that we need to log back into your Amazon account after a reboot or cleanup of the cache/tmp directories.

Monitoring = http://openhab:8080/amazonechocontrol/account1

Best, Jay

Fantastic work! I’ve been using this binding for a few days now and I’m just thrilled.:grinning:

However, I have a problem with the PlayAlarmSound feature. No alarms are played. I have already tried several devices, but to no avail. An error message is not displayed in the logs.

Could you please give me a hint how to identify this problem?

Cheers,
Philipp