Another Amazon Echo Thread (March 2016) (technical/programming discussion)

I wanted to open a new discussion on the Amazon Echo. Many of the existing threads have been obsolesced by the current, official integration, so I thought a fresh start would be a lot less noisy.

First off, let me say the official integration is surprisingly good, right down to me being able to say “Alexa, set the upstairs to 68” and having Alexa respond with “Setting the upstairs heat to 68”. I really wasn’t expecting that from my home rolled Venstar device type.

But as we all know, there are a few desired behaviors missing (and please feel free to point out any errors/omissions on this list)…

1.) Color Control.
While I am currently using scenes called from HAM Bridge via a virtual switch, it would nice to have Alexa handle this directly in some cases.

2.) Thermostat Modes.
I have discovered no way to ask Alexa to change the mode of my HVAC system.

3.) Query Device State/Reports.
This is a big one for me. I really would like to ask Alexa for various states of my devices, and I imagine many would like to have a group of devices the could request a report from (“Alexa, what is my house status”).

It seems pretty clear Alexa is just authorizing and mapping to endpoints, hence the limitations (although the thermostat still was a surprise). How about an authorized/default app, accepting endpoint access that could report the state of things back to Alexa? And adding color control to on/off/dim for color capable devices? Or is this simply too much to ask for given the current state of SmartThings.

Of course, there is the skills route. And while that would certainly allow for better context in query verbiage, it still would require arrival to endpointed apps that would facilitate them.

Thoughts?

1 Like

Take a look at the smart app “Alexa Helper”.

You can have Alexa change the modes of your hvac.

You can also get feedback reports (current status) of your devices as well.

All by asking Alexa.

3 Likes

Thanks… I looked at his stuff, but none of it is being done natively, just through virtual switches (which I am already doing).

And the feedback/status reports are not being routed to the Echo, right? You have to use another connected speaker?

I don’t think this is directly possible at this time without a custom Skill (or Bluetooth hack shared on the forum).

It may change someday, but Alexa cannot initiate speech without a specific request; and we cannot modify the built-in Smart Home “skill” to add new custom spoken responses.

1 Like

They are playing the notifications on the echo itself. @bamarayne can tell you more, but I believe they’re using landroid to create them and the echo just as a Bluetooth speaker at that point.

As far as “being done natively” did you mean natively to echo? In that case, it has to be done as a skill, they haven’t opened up the other path.

You can have echo play a custom MP3, or you can use it as a Bluetooth speaker as in the notifications example, but that’s it.

For anything else you need a cloud service acting as an ASK skill. So your echo commands become “echo, tell MySkill request” rather than just “echo, request.”

1 Like

I don’t pretend to understand the difference between an integration in the Amzon app and a skill; perhaps there isn’t any other than where it is presented, and no “skill name” needed for the app based integrations. But yes, the integration would need to be modified to call for the state data and parse the response for speech back to the Echo. Not sayin’ we could do it.

Yeah… that was kinda my next question. It seems this SmartApp ain’t ‘open’. So who’s responsible for the lion share of the development. Considering how well it works I’m guessing this is all Amazon’s baby.

I certainly didn’t glean that from his docs.

MPG?

( you will see several skeptical posts from me, basically saying “really?” But, yes, really. :sunglasses:)

As for MPG, that’s a voice error. :stuck_out_tongue_winking_eye: Should have been MP3. :musical_score: I’ll fix it.

Yes, you can have the echo device play your statuses, or whatever. It does take a pretty good hack, but it works really well.

Note - this does not use the “Alexa voice”. It uses TTS, but is in the Alexa voice, just not as natural.

Basically, you do this…

Using either your phone or an old Android device you download and install LanDroid.
You then connect your device via BT to the echo.
Using either rule machine or Alexa helper, you use the LANdroid device as you speech output. It pays the sounds via the connected echo device.

Using Alexa helper you create your feedback reports, create the applicable virtual switch, and then you just tell Alexa, “turn on X report” (name of your virtual switch). And a couple of seconds later it plays.

My go to bed rule in RM does this. Everything turns off and it tells me the current status of my doors, windows, the temp upstairs and downstairs, and what the thermostats are set to. It then says that my house is safe and secure and to have a goodnights sleep.

It takes some practice and tweaking, but it works good.

Oh yeah, and if Alexa is playing music, it will pause the music, speak your report, and then resume playing.

Here is the link.

Thanks… but here that is not going to work. My Echo is permanently BlueToothed to my HAM Bridge server for its notifications via the Mac’s TTS (as well as iTunes playback). I suppose I’ll need to woof up a SmartApp that gets the states of all the devices and HTTP them as params to HAM Bridge for it to speak them.

1 Like

I’m a little bit confused by the question, but if I understand it…

An Alexa skill is code written by a third-party with a designated name that echo will recognize and start that code. That code is allowed to have echo speak its responses.

There are two types of skills, depending on whether echo needs to stay in listening mode after the first spoken command.

First There are interactive skills, where you can ask a question, get a response, and Echo is still listening and the skill code is still running so you can then respond again. This is what is used for playing games and some other options where you may need to drill down to get to the ultimate answer.

And there are one time skills were you just specify the skill and give it a value and then the skill code does something.

Both types are intended to be cloud services that echo is initiating because of the reserved name. I’m not sure what hosting options are available, I haven’t looked into all of that.

http://www.aftvnews.com/a-brief-overview-of-amazon-alexa-skills/

But none of these are smartapps within the SmartThngs system. Just like any cloud service, you could have your echo skill send a call to smartthings if you wanted, and I’m assuming that’s how the ones that get device status do it. So in that case you are writing both an echo skill, to handle the echo interaction, and a separate smartapp that will dialogue with the skill.

But echo itself never knows the device status and isn’t really involved except as a UI to the skill. It parses the voice input and then passes it to the skill and it can say the skill output. But it’s not involved in the logic in between, that’s all up to the skill.

1 Like

Or, you can go to Amazon and order a good quality small speaker with Bluetooth, actually it doesn’t even need that. It can just have an input jack do you can plug it into the Android device headphone jack. Hide that speaker somewhere in the room and use it instead of the echo.

That’s actually how I do it now. I use that setup in my other rooms, along with a Wi-Fi speaker that I got on clearance. That speaker is seen anywhere a Sonos is seen and eliminated the Android device.

I now just choose where I want certain things to play… Like I can tell Alexa, turn on dinner time and the speakers in the kids rooms tell them to come to dinner. But only those speakers.

Great thing about ST… With a little ingenuity you can get it to do anything… And… You can make it all voice controlled via Alexa!

I am guessing it is three. The third being native integrations like the SmartThings one which require no skill name needed to be used. I am not sure this is the only difference between a native integration and a skill though. BTW, I have the ASK SDK here and pretty much grok how they work.

The biggest issue with us customizing the Echo is not the hosting of the skill. I would be willing to do that as long as a ‘Let’s Encrypt’ cert is Amazon approved, which I think it is. The problem is the target, which also needs to be a certed HTTPS server (which I am not likely to expose to the net). I have thought about building a RasPi unit to expose as a proxy, but it would be so much cooler if the Echo had a bridge to your LAN in the same way the sendHubCommand works on SmartThings.

Because of this, SmartThings would be the next best target using an endpointed app.

1 Like

Amazon doesn’t call the official integrations “skills” although they probably could. But there’s a different communication pathway for those so internally they probably look a lot different to the Amazon engineering staff, although from a customer-facing viewpoint the only difference really is that you don’t have to say “tell.” But the integrations are closed, there’s no way for us to get to them.

1 Like

I have a number of them already (jawbones), but in my house, the range pretty much sucks. HAM Bridge can fire up every A/V system in my house (3 of them) and pipe audio to them via AirPlay, so this is the better route for me.

Thanks.

1 Like

Yeah, you already have the infrastructure in place. Just use Alexa helper and rule machine and you’re good to go.

Are you able to choose individual speakers?

1 Like

Plus, as I initially mentioned, I think they are hampered by what SmartThings makes available via their endpoints (I think this is kinda the chicken or the egg thing). I’d really like to know what the Alexa SmartApp is doing other than facilitating connecting to endpoints. In any event, after April 15th I’ll try to take a whack at a skill that targets the Physical Graph. Anyone know how return data from an endpointed app? Everything I have done along those lines just terminates at the app (command, notification, etc.).

1 Like

Individual systems. I use an AppleScript that directs whether the server and/or other AirPlay devices receive output. For instance, my main theater system gets ‘barking dogs’ when outside motion is detected and I am away.

2 Likes

It doesn’t need to do anything more than this and I doubt it does. What do you think it does??

Just run Live Logging and you’ll see a lot of (excessive?) debugging messages.

The messages are a little unusual, so I don’t think the SmartApp was written by the “usual” SmartThings SmartApp developers… I hear they contract stuff out sometimes, but the details are secret.

I’m not sure exactly what the Alexa SmartApp is doing. My own guess is that it’s just a conduit between the mobile app/platform and some real integration code (not written in groovy) that manages the interaction with echo including authorization of devices. So even if you could open the smartapp, I don’t think you’d actually be anywhere near The true integration code, and that that’s something that is restricted to official Amazon partners.

1 Like