OH 2.4 Alexa binding. Start custom python script after receiving Alexa voice command

Is this possible to integrate automatically start of a python script (executed after “Alexa, switch Touchpanel On”) in Alexa openhab binding, taht is executed after receiving Alexa command or temperature question/setting ?
This should be integrated into Alexa binding.

I prepared some python script, that automatically awakes touchpanel screen after Alexa voice command.

But better solution is to call this script automatically from Alexa binding, if this receives some Alexa command or temperature question/setting.

I would use a virtual switch with Alexa, and this switch triggers your python script via the exec binding. I trigger a virtual switch via Alexa to initiate going to bed (switching off lamps etc.)

You could use a group for all your lastVoiceCommand channels and let a rule trigger when a member of this group recieves a command.


echoLiving_LastVoiceCommand "Last command [%s]" (echoCommands) channel="amazonechocontrol:echo:default:echoLiving:lastVoiceCommand"}
echoKitchen_LastVoiceCommand "Last command [%s]" (echoCommands) channel="amazonechocontrol:echo:default:echoKitchen:lastVoiceCommand"}
echoWork_LastVoiceCommand "Last command [%s]" (echoCommands) channel="amazonechocontrol:echo:default:echoWork:lastVoiceCommand"}


rule "Start touchpanel"

     Member of EchoCommands changed to "switch touchpanel on"
     *Execute your python code with Exec binding*

Currently you need to create an empty routine for this to work.
Go to your Alexa app, create a new routine with switch touchpanel on as voice input and let it switch something on. Save this routine, open it again and remove the switch.
This will create an empty routine so Alexa wont answer you and openHAB is able to let the rule run.

I don´t know why but openHAB sees the lastVoiceCommand event without an empty routine but doesn´t run the rule.

kind regards

Thanks Michael, very clever and usefull :heart_eyes:
All working with routine without switch.

If “alexa” is used, then after speaking alexa to echo the backlight goes always on !!!
Awake word is changeable in Alexa app, if someone prefers other.

Member of EchoCommands changed to "alexa"
1 Like