I am doing a project to try and activate Alexa voice command by just motion detection without the need to say Alexa…
For example, when someone walks into a room (when PIR sensors detect movement) I would like Alexa to ask how may I help you etc.
Does anyone know if this is feasible?
What @Pantheon likely meant was a virtual switch. There’s code out there for a virtual switch that has both the switch and sensor capabilities sonyou cN trigger ot on and off like a switch for routines but Alexa ‘sees’ the open/close as a sensor and can respond.
That said, i think youve got a bigger issue. Two of them, in fact. One - solvable, motion sensors have potential to be quite annoying here. Youll have to aim them very carefully to prevent false positives. Which tied to an announcement will become quite annoying quickly…
But the biggest one. Right now the one function you would need to make this work on Alexa’s side isnt currently available…
You cant trigger the Alexa wake word from a routine.
You can trigger a routine which will do a function but you cant wake Alexa to make her ask for something and leave the mic open for response.
You CAN make her say some static command like “how can I help you?” But the operator would still have to use the Alexa wake word in the response, but that would usually just serve to confuse the issue.
Alexa : “How can I help you?” *returns idle
Me: “Turn on the lights” silence and darkness remain
Whereas, not making Alexa say anything, the operator just asks for what he/she wants.
If you simply want an Amazon Echo device to speak a canned phrase, yeas that is very simple to do. Simply use an Alexa Routine that is triggered by a Motion or Contact sensor. Then, in the Routine, add an Action to speak the phrase you want. As @nathancu mentioned, this will not be an interactive dialog, but you can at least make an Echo device speak a phrase.
The Motion or Contact sensor can be a real, physical device… or it can be a virtual sensor device.
Yea, in the Alexa App which can be triggered by any of the below or either a contact or motion sensor via ST. Can make more complex rules in ST using a SmartApp or webCoRE or keep it simple and just use the logic in the Alexa App.
This is assuming “voice commands” means just speaking…
And the background as to why this seems so cumbersome…
Amazon is very careful to ensure that programmers have access to specific features only. So given that Amazon is the keeper of the kingdom it’s probably best to understand the Amazon developer documentation around the subject and understand what’s possible. Amazon Alexa Voice Assistant | Alexa Developer Official Site Pay close attention to the sections around notifications. Basically most ‘skills’ on Amazon can’t just wake up an Echo device and start talking. Amazon does this to prevent various hacking attacks. That specific item becomes your issue in most cases that you need to work around.
You also started looking in to this at a very ‘weird’ period. Even 6 months ago, this would have been very different. You could use a combination of WebCoRE and something like Echo Speaks and later Voice Monkey to build a speak / response engine because they CAN - or could at one time, get around those notification limitations but with recent changes Echo Speaks and Voice Monkey neither of those work right now.
@nathancu - your comments above made me curious about how Alexa would handle a situation where one adds a “Custom” action to an Alexa Routine. I have noticed that there are times when I tell Alexa to do something via voice command, and she will ask me a clarifying question. For example, if I ask her to “Cancel today’s alarm”, she will say “I have cancelled today’s alarm. Would you like me to cancel this alarm for every day?” To which I have to reply, “No.”
So, I decided to see what would happen if I entered the “Cancel today’s alarm” as a Custom Action in an Alexa Routine. Sure enough, she prompted me audibly with the same question she always does, and waited for me to respond audibly. Thus, under certain specific circumstances, one might be able to initiate a two-way dialog by triggering an Alexa Routine.
I just found this interesting… Not sure what the practical application would be for this functionality, but I am sure someone will find a creative use for it!
Nice find. Yeah I think the next announcement loophole will come from something like this where someone builds a custom skill that opens the response and transfers it . Amazons dev team has done a very good job preventing this scenario fortunately/unfortunately as it’s somewhat akin to a cross-site scripting attack on a website…
I’m seeing some confusion here about the current state of Amazon Alexa routines, because they did change early this year in quite a significant way.
First of all, as @rontalley mentioned, Alexa routines are already designed to do the first part of this. If you have a physical sensor which is known to Alexa, usually a motion or contact sensor, you can just use that as the trigger for an Alexa routine. Super simple and works well.
Next, as @ogiewon mentioned, Amazon very recently added the ability to use a “custom action“ as the last step in an Alexa routine. This will be the exact equivalent of speaking that particular command to Alexa. So, if your custom skill is triggering a skill which has a call and response format, that skill will be activated and that call and response format will take place.
This is not a loophole: it’s intentional. It was done specifically to provide a method for routines to handle security skills which request pin codes, and also to handle some of the vacuum cleaner skills, which often have a call and response.
The security part of all of this is handled by the Alexa skill, not the routine. And it will allow for multiple questions and answers as long as the skill itself does.
The Original Question
So to do this as described by the OP, you aren’t doing anything with smartthings or with virtual devices. It’s all being done through Alexa features.
First, you just use an Alexa routine to recognize the sensor as a trigger.
Second, the last step of that routine should be a custom action to trigger an Alexa skill that you wrote that has whatever call and response you want.
So any more questions on the details of doing all of that should go to an Alexa developers forum, of which there are several.
The only way that smartthings would be involved is if you wanted to put a lot of additional logic around when the trigger occurred. Otherwise, as @nathancu Suggested, it could get pretty annoying.
For example, if you wanted to ask the breakfast question only once each day, you could put that logic in Webcore on the smartthings platform and instead of triggering your Alexa routine from the physical sensor, you would let smartthings evaluate the physical sensor notifications and then turn on a virtual sensor if you did want to go into the Alexa stuff.
But you only need all of that if you can’t get the screening logic that you want in the Alexa routine itself. It does have some like time of day, but you could get way more complicated in smartthings.
Here is the community FAQ on using a smartthings virtual sensor to trigger an alexa routine:
I hope that helps clear up some of the confusion. Amazon has been increasing the functionality of Alexa routines for about a year now, and they have many options that they didn’t used to. So it’s possible that the original use case may end up being very simple as far as the sensor part, but will require writing an Alexa skill to go with it.
Also, because there may be some additional confusion…
This forum is for those who are using the Samsung SmartThings ™ Home automation platform, so all of the questions and answers are assumed to be in that context. It is not a general home automation forum, nor an Alexa programming forum. However, it is a very busy forum so it tends to come up near the top in general home automation searches, which can confuse a lot of first-time visitors
All of which is to say if if all of our discussion of virtual switches or Webcore was confusing to you, that’s because the answers were in a SmartThings context, and assumed that you have an account on the Samsung platform.
If you are not intending to use the Samsung product, that’s fine. In this particular case, as I mentioned in my previous note, you actually won’t have to. You can do everything just with Amazon features. However, you should then take that discussion to an Amazon developers forum and they can help you there.