Enable/Disable Alexa Voice Control

Hi all,

i included an Amazon Echo with voicecontrol by Alexa within openHAB (2.4) and everything works fine.
Is there a way to enable/disable Alexa from openHAB (e.g. within a rule)? The reason for that is, that I want to disable the openHAB control by Alexa when I am leaving the house, so that no one from outside can control my home by shouting from outside.

Many thanks,

Thorsten

If you have presents detection, so that OH knows when your home/away, you can try using that as a condition (the if part in a rule) to check before Alexa send a command.

@Chumbos I don’t think there is an easy way to accomplish that at the moment on the software side. It would be nice if Amazon would provide a way to programmatically mute echo devices. The only solution I can see is to use a smart plug/outlet with your echo device that you could setup to turn off when you leave the house.

Thanks @H102 - if i got i right, this would mean that i would need to check in every rule for items i can control via Alexa if this condition is true and i could not control those item via my App if i am not at home.

Yes, a programmable way to mute the echo device would be a good solution. I setup a Homematic IP installation for a friend and if you turn the “alarm” mode on in the App the Alexa voice control is disabled until the alarm mode is switched off again. I am wondering how they have done it.

Maybe there is the chance to add this feature in the openHAB Alexa binding as an idea.

I will try the workaround with the smart plug in the meantime. :slight_smile:

Sort of. See Design Pattern: Separation of Behaviors for a way to centralize the check so it only needs to appear in one place.

2 Likes

It would be nice if there was a channel to switch off the Voice, like a channel that links to the Mute button.

1 Like

I too am looking for a way to mute alexa from within a rule (mute does not seem like the right word to stop something listening?? ).
I have an "Away Mode " rule that locks doors and alarms an alarm. I often turn this on by asking Alexa to do so. As I have two echos located outside, if someone knew the magic words, they could turn this mode off and effectively disable all security.
Fortunately, security is not too much of an issue where I live, but it would be nice to disable voice commands when this mode is on.

I’m also looking for a way to disable Alexa voice commands via rule so that incoming commands from Amazon will be ignored on OH3 side. Same usecase like the poster before: out of house and don’t allow commands coming from the outside. Since item commands are not triggered by rules on my system, but are managed by the Alexa Skill binding, there is no way to “intercept” those with a check in a rule.

Is it somehow possible to stop the Alexa Skill binding or so via REST? Thanks to JRule I guess I would also have full access to the OH Java API if needed. Maybe someone already did something like this.

There is a way. Assuming OH 3 and UI created rules, create a Switch Item. When this Item is ON the commands from Alexa are allowed. When it’s off they are to be ignored.

Next create a Proxy Item for Alexa to command.

Then, create a rule that gets triggered when the Proxy Item is commanded that forwards that command to the “real” Item.

Finally, create a rule that triggers when the Switch Item from above changes. When it turns OFF, disable the rule that forwards the proxy commands to the “real” Item. When it turns ON enable the rule.

That essentially cuts off the commands from Alexa.

Use a Group and Design Pattern: Associated Items in the Proxy Item naming and you can create the rule that forwards the commands from Alexa in one rule.

Interesting. I’ve got my rules in files. But doesn’t that mean I have to create proxy items for all of my 300+ items and expose them instead to the Alexa Skill than the real ones :)?

In that case put and if(AlexaCommands.state == OFF) { return; } at the top of those rules.

Or create the rule in the UI, query for the rule in the REST API Explorer, and then save that JSON to a .json file in $OH_CONF/automation.

Or just leave it defined in the UI.

Unfortunately Rules DSL does not support enabling and disabling other rules.

Yes, or more likely create new “real” Items and move the links to the Channels to those instead of the already exposed Alexa Items. That limits the risk of disrupting the connection with Alexa.

I’m not claiming that it’s a perfect solution and that it won’t take some work. But it is a solution that can be employed. Note that this approach is generic and will work with any sort of integration, not just Alexa.

Ok got it :). Thanks for sharing this approach!