Release Candidate and Support: Amazon Echo Control Binding

No, because there is no feature for this in Alexa app yet, this means that there exist not web api for this.

This is the reason, why you have create a dummy alexa routine with the text you use for the command.

Iā€™m pretty sure I read in a blog about a dot (or echo) tear down, that the mute button was only a physical switch, without any way to control it through software. I believe they described it as a security measure, so that if you push that mute button, you know nobody is listening.

This isnā€™t the article, but it discusses the sameā€¦ alexa - Is the Amazon Echo mic mute a hardware switch? - Internet of Things Stack Exchange.

1 Like

Thatā€™s what i want to avoid though, creating routines for every command. Iā€™ll see if there is a way around that, with some smart Volume handling or very general routines that cancel any further command processing on alexa side. That way we could write smart command parsers and structures in oh2 and use alexa as a mere voice recognition and tts device, augmenting our smart home. Might work nicely with https://github.com/ghys/habot too

So you can say ā€œTurn on the TVā€, and based on which Echo device heard the command, you would be able to turn on the correct TV?

It seems like there are still some dependencies missing in the latest 2.4 Beta. I get the following errors when trying to install:

[rg.openhab.binding.amazonechocontrol] - FrameworkEvent INFO - org.openhab.binding.amazonechocontrol
org.osgi.framework.BundleException: The bundle class path entry "lib/tyrus-standalone-client-1.13.1.jar" could not be found for the bundle "osgi.identity; osgi.identity="org.openhab.binding.amazonechocontrol"; type="osgi.bundle"; version:Version="2.4.0.201808260052"; singleton:="true""
(...)

[rg.openhab.binding.amazonechocontrol] - FrameworkEvent INFO - org.openhab.binding.amazonechocontrol
org.osgi.framework.BundleException: The bundle class path entry "lib/javax.websocket-client-api-1.1.jar" could not be found for the bundle "osgi.identity; osgi.identity="org.openhab.binding.amazonechocontrol"; type="osgi.bundle"; version:Version="2.4.0.201808260052"; singleton:="true""
(...)

The latest version has only jsoup-1.10.1.jar included in the /lib folder.

i think i had that error too before i cleared cache

Thanks, but clearing the cache didnā€™t solve this issue.

Hi Michael,

I like your binding very much and just started playing with it.

Iā€™m wondering if it sounds reasonable to query programmed alarms from Alexa (Wecker)?

Here is my scenario: I tell Alexa ā€œAlexa, wake me at 6 tomorrow morningā€. An alarm is created, which can be checked via Alexas web interface. If the binding also would check the upcoming alarm, one could trigger other actions at that point im time. In my scenario it would dimm a light, starting 20 minutes before alarm time in order to simulate a Phillips Wake Up light.

Iā€™m sure there would be much more use cases. What do you think?

Thanks,
Thomas

The new ā€˜ā€™ alexa last commandā€™ā€™ channel is for room aweness. Ok i get this. I create an ampty routine. I also creating an item associated with each (of my echo ā€˜last command,).

But i see no string anywhere ?.. i try to output something on nodered but nothing

Hi,

Iā€™ve written a rule to grap all Alexa notifications (timers, alarms, reminders), filter-out my bedroom active alarm and start some kind of a sun-rise with my Hue lamp 15 minutes before the Alarm will fire up.

Thanks to @michi providing the webservice interface so that I can call Alexa notifications. Beta Version 2.4ā€¦ is required.

Hope this helps people who have similar ideas. Happy to get feedback and improvement ideas.

rule "Alexa bedroom alarm control bed table light"
	when
		//run every 1 minute
		Time cron "0 0/1 * * * ?"
	then
		//read Alexa notifications - alarm, reminders, timers
		logInfo("Alexa", "read notifications ...")		

        var String json = sendHttpGetRequest("http://192.???.???.???:8080/amazonechocontrol/account1/PROXY/api/notifications")
                
        //get number of notifications read
        var String length = transform("JSONPATH", "$.notifications.length()", json)
        //logInfo("Alexa", json)
        //logInfo("Alexa", "-----------")
        logInfo("Alexa", "Number of notifications found: " + length)
                     
        var i = 0
        var String status
        var String deviceSerialNumber
        var String type
        var String alarmtime = "NULL"
        var String alarmdate = "NULL"
        var int count = Integer::parseInt(length)
              
        //for all notifications, identify ...
        while(i <= (count - 1)) {
            status = transform("JSONPATH", "$.notifications[" + i +"].status", json)
            deviceSerialNumber = transform("JSONPATH", "$.notifications[" + i + "].deviceSerialNumber", json)
            type = transform("JSONPATH", "$.notifications[" + i + "].type", json)
            logInfo("Alexa", "Count: " + i)
            logInfo("Alexa", "Notification status: " + status)
            logInfo("Alexa", "Device serial number: " + deviceSerialNumber)
            
            //... an ALARM that is ACTIVE and belongs to the BEDROOM Alexa device
            if(type == "Alarm" && status == "ON" && deviceSerialNumber == "G070RQ11809709JQ") {
                alarmtime = transform("JSONPATH", "$.notifications[" + i + "].originalTime", json)
                alarmdate = transform("JSONPATH", "$.notifications[" + i + "].originalDate", json)
                logInfo("Alexa", "Alarm found: " + alarmtime + " " + alarmdate)
                i = count //only the first one is considered - exit while loop
            }
            else {
                logInfo("Alexa", "Notification not considered")
            }

            i = i + 1
        }
        
        //an active alarm has been found
        if(alarmtime != "NULL") {
            var DateTime setAlarmTime = new DateTime(alarmdate + "T" + alarmtime)
            logInfo("Alexa", "Set alarm time used for Hue control: " + setAlarmTime.toString)
            
            if(now.isBefore(setAlarmTime) && now.plusMinutes(15).isAfter(setAlarmTime)) {
                logInfo("Alexa", "Alarm is within 15 minutes range")
                if(now.isBefore(setAlarmTime) && now.plusMinutes(10).isAfter(setAlarmTime)) {
                    logInfo("Alexa", "Alarm is within 10 minutes range")
                    if(now.isBefore(setAlarmTime) && now.plusMinutes(5).isAfter(setAlarmTime)) {
                        logInfo("Alexa", "Alarm is within 5 minutes range")
                        sendCommand(diLightBedTableRainer_1EtageSZ, 80)
                    }
                    else {
                        sendCommand(diLightBedTableRainer_1EtageSZ, 50)
                    }
                }
                else {
                    sendCommand(swLightBedTableRainer_1EtageSZ, ON)
                    sendCommand(diLightBedTableRainer_1EtageSZ, 30)
                }
            }
        }

end

Cheers.

Rainer

4 Likes

Is it possible to detect If a Timer was set in one of my Echos (via maybe this sendHttpGetRequest(ā€œhttp://192.???.???.???:8080/amazonechocontrol/account1/PROXY/api/notificationsā€)?

And then based on that set the Timer on another Echo aswell?

Itā€™s easy to filter on a certain device, type and whether itā€™s active. I havenā€™t tried to set a timer (or alarm) via the Control binding / webservice yet.

1 Like

If that would be possible that would be great because I really need this feature.

I am not a good coding guy thatā€™s why I want to ask where I can try to look/read on how to make this work. Because I have no idea where to start

Hi Rainer,

that is good work. i wanted to do almost exactly the same. How do you authenticate against the Alexa API? Or can we just fire calls as long as this Binding is already authenticated? So can youa ctually use all the Alexa API Feature through this ā€œproxy url ?ā€ Thats pretty cool. Why is it not documented? Or did i miss something?

Same error for me, try to clean cache but still here.
Updated to latest snapshot of openhab.

Have you fixed this ?

Thank you
Aymeric

New Beta 2.4 (3)

I tried to fix the problem with the missing bundle. Unfortunately a pre-beta tester reported now a new problem with an other missing bundle. I can not reproduce the problem in my installation.

It would be nice to get feedback if it works or not and on which OH version and platform.

  • New channel mediaProgress
  • New channel mediaProgressTime
  • New channel notificationVolume
  • New channel ascendingAlarm

Does the echo binding allow one to use the Echo Plus as a Zigbee hub?

Yes, it should work as long as the binding is online, no extra authentication is needed, only change the url so that it goes through the binding proxy. I will add the sample to the documentation.

Regards,
Michael

No, there is currently no smarthome support.