2

I have a raspberry pi running Alexa (amazon echo) that can instantly push a trigger to IFTTT, for an example I say "Alexa, trigger email to blablabla" and I immediately receive an email.

My Goal I want to execute a bash script on the same raspberry pi with voice command (by Alexa) via IFTTT. Is there any IFTTT recipe that can instantly push a trigger to my raspberry pi? (so that I can instantly run a bash script) (Note: Dropbox doesn't support raspberry pi, though there is an uploader/downloader and the below script uses it with cronjob).

I found one (Raspi Runner) that runs cronjob every few minutes, but I'm not sure if I can setup cronjob for every second and use this script!!

How can I do this?

kuruvi
  • 641
  • 1
  • 11
  • 28
  • I am unclear why you want to trigger this script via IFTT? Surely you Raspi already knows there is an event because it is sending the Email to IFTT, so it doesn't need to be told by IFTT that there is an event surely? – Mark Setchell Apr 08 '17 at 11:48
  • it is alexa (amazon echo) running in pi that takes voice commands and sends the email trigger to IFTTT, but intervening alexa and getting the commands locally is a hard job though some project like fauxmo (wemo-emulator) and homeassistant exist. – kuruvi Apr 08 '17 at 12:07
  • Does the length of your sent mailbox change when Alexa sends a mail? Or its modification date? – Mark Setchell Apr 08 '17 at 13:52
  • @MarkSetchell I think the project will become scalable when Alexa is running on kuruvi's phone too. Then this would make more sense. But yes, if it's going to be limited to RPi, might as well have some hook inside the RPi itself. Because otherwise, the RPi is sending data to Alexa's servers, then to IFTTT, then IFTTT to some other delegate which will finally bring it back to your RPi, doesn't make a lot sense. – alok Apr 10 '17 at 04:54

1 Answers1

3

Short Answer:
IF
This - Alexa
Then
That - Adafruit/Maker Webhook

Longer Answer:
There are two options:
1)Alexa will notify IFTTT that trigger event has occurred. Against which, the action chosen is publishing an MQTT message. This MQTT channel is created by Adafruit. Needless to say, you need to write an MQTT feed reader at the RPi.

2) Maker web-hooks. You expose your RPi to the web, keep a server running on it. Expose a web-service which may be called from the Maker Webhook. This is personally my preferred option, but setup could be a pain, i.e. port forwarding from modem, router etc.

References:
1) Adafruit Official Site
2) MQTT Java Library
3) Hackster Tutorial - With option #1
4) Hackster Tutorial - With option #2

alok
  • 502
  • 3
  • 15
  • I just feel it's worth a mention here that I tried to get #2 to work but could not. I don't understand networking all that well and I could not make my router forward all requests to the server hosted on RPi. #1 is what fully works in my home setup. – alok Apr 10 '17 at 04:51