I am working on custom commands to Alexa like:
Alexa, which windows are open on the car.
With node-red I check the last spoken command to alexa for “car” windows" and “open” and set a proper response.
However, Alexa always answers with “sorry, …”, because she does not know what I am talking about.
Is there any way to suppress this “I don’t know” response?
indeed, make a routine within the alexa app for that defined sentence: “Alexa, which windows are open on the car.” and define a response yourself. In my case, I respond Oki - and openhab adds doki… so I know on Oki that alexa’s routine has been hit and on Doki that Openhab is triggered. I did that because sometimes openhab looses connection here. ( i justed opened a thread related to that: Amazonechocontrol is instable: Web Socket close 1006 )
Good luck.
PS: and yes, I have multiple similiar sentences as routines just in case I forgot the exact phrase…
I’ve found that I need to use a combination of routines and rules triggered by LastVoiceCommands. Which one I use depends on the spoken phrase. Some combinations of words just don’t work with routines via the Alexa app so I use LastVoiceCommand for those.
The problem I have found with routines is that at least a couple of time, all my routines have disappeared so I’ve needed to set them up again from scratch.
I’d agree with you that using LastVoiceCommand is much easier to manage.
So I’d also like a way of suppressing the Alexa response, which could be triggered perhaps by the openHAB rule recognising the spoken phrase in question.
“if” your rule would “say” something, it would override the alexa default response if quick enough. It happens from time to time that I don’t hear the OKI, only the DOKI (see above)
But that also is just a work-around. I think it is not possible to prevent alexa from saying anything without telling alexa exactly “when” to not respond.
well… having that said… another option is to change the volumne to 0… and only openhab is changing volumne to 50 or so… say or say not something… and afterwards, change it back to 0.
I was going to try that next. Does it work effectively.
What I did was put all the LastVoiceCommands in a Switch-case rule with an identical routine firing for every case as well as the action being triggered.
The routine switches on a rule which sends a TTS text string saying “Doing that now”.
This over-rides the normal Alexa response but there is a slight delay so you hear a bit of that first.
A bit rubbish really but at least the actions get executed.
I created an unbound switch item called AlexaDoNothing that does just that. It’s the only thing in my routine to turn it on and she happily does without complaint and says “OK” while I process the LastVoiceCommand and do the real work in the back end
Sure, my AlexaDoNothing switch is set up like this:
Switch AlexaDoNothing "Alexa Do Nothing" {alexa="PowerController.powerState"}
I also needed to create dummy “turn on the fan” and “turn off the fan” routines so Alexa wouldn’t complain that it didn’t know what to do, the only thing it does is set the above switch to “on”
I use jython rules, but here’s how I do it to operate my fans by just saying “turn on (or off) the fan” from a room. It can be adapted pretty easily to do whatever you want based on the echo name and command, as is pretty simple so should be easily converted to old style rule syntax. My echo devices are all set up with this format:
String Echo_Bedroom_LastVoiceCommand "Echo Bedroom Last Voice Command" (GAlexa_LastCommand) {channel="amazonechocontrol:echo:echo_account:xxxxxxxxxx:lastVoiceCommand"}
@rule("Alexa Last Command")
@when("Member of GAlexa_LastCommand received update")
def alexaLastCommandEvent(event):
#ignore groups
if str(ir.getItem(event.itemName).type) == "Group":
return
#get "room" name, i.e. Echo_Bedroom_LastVoiceCommand becomes Bedroom
echoName = event.itemName.replace("Echo_","").replace("_LastVoiceCommand","")
echoCommand = event.itemState.toString()
if echoCommand == "turn on the fan":
events.sendCommand(echoName + "_Fan_Speed_Dimmer","100")
elif echoCommand == "turn off the fan":
events.sendCommand(echoName + "_Fan_Speed_Dimmer","OFF")
You can refer to my post below if you are interested in doing such setup using a standard rule. Just to be clear with this method, you would need to have the Alexa skill enabled. Additionally, I would recommend using an activity controller instead of power controller.
Just to make sure that I understand your approach correctly:
Whenever OH recognizes a command (like my example above with my car doors by nodeRED), you set the LastVoiceCommand to “turn the fan on”- a command which will be covered by a routine in the alexa app and because she does just that she responds with OK.
But doesn’ she process the original LastVoice command before the “turn on the fan”?
It’s actually the opposite. What I have set up allows me to say “Alexa, turn on the fan” from any room and she will turn on the appropriate fan just as she responds to “turn on the lights” if you have your lights grouped with an alexa
Another point, I forgot to mention is that you can enable “Brief Mode” on your Alexa account which will replace the standard “OK” response with a sound.