Speak to Alexa via openHAB 2

Hello community,

I want to ask how I can make a command in openHAB, that Alexa Echo Dot react to? E. g. I tell Alexa, “Do order 1” and she should trigger a rule in openHAB.

I configured Alexa already with openHAB cloud already and everything is up and running. Also I can use commands like “Echo_Living_Room_TTS”. But now I want to trigger something with Alexa.

I tried following:
My item file:

Switch Order1 "Do order 1"

I also tried

Switch Order1 "Do order 1" {alexa="Switchable"}

My rule file:

rule "Testrule"
        when
                Item Order1 received update
        then
                Echo_Living_Room_TTS.sendCommand('You are funny!')
end

This is just an example. Alexa sadly doesn’t react to this. I want to trigger “Testrule” with my voice. Is this even possible?

Thanks!

I think Alexa has a channel in OpenHAB like ‘last command spoken’ or some such. Write a rule that runs on that channel changing, and check if the channel changed to ‘do my cool stuff’ and if so do some cool stuff

https://www.openhab.org/docs/ecosystem/alexa/

Read, absorb, follow…it’s a pretty easy set up. As Andrew says, just set it so sets a switch to ON / OFF and then get the rules to trigger based on ON / OFF

You could use the tutorial below as an example, if you are trying to mix Alexa voice commands with OH command triggering.

Yeah, this worked. Still have one problem: If I tell Alexa something, then she begins to tell me something from the amazon cloud. And after a delay my code overrides it. How I can change this behaviour?

Thank you. I used this as inspiration.

There is nothing that can be done to prevent that. Usually, if you trigger the relevant TTS channel on the OH side just after requesting a voice command, it would override the initial response.

1 Like

My solution now:

Configurate speak recognition in the Alexa app and there I send a command to smart home to specific item that triggers the rule.

Thank you all!