通过IFTTT在树莓派中运行bash脚本 [英] run bash script in raspberry pi via IFTTT

查看:137
本文介绍了通过IFTTT在树莓派中运行bash脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行Alexa(亚马逊回声)的树莓派,可以立即将触发器推到IFTTT,例如,我说"Alexa,将电子邮件发送给blablabla",我立即收到一封电子邮件.

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.

我的目标,我想通过IFTTT使用语音命令(由Alexa)在同一个树莓派上执行bash脚本.是否有任何IFTTT配方可以立即将触发器推入我的树莓派? (以便我可以立即运行bash脚本)(注意:尽管有一个上载器/下载器,并且以下脚本将其与cronjob一起使用,但Dropbox不支持raspberry pi).

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).

我发现每隔几分钟运行cronjob的一个( Raspi Runner ),但我不是确定我是否可以每秒设置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!!

我该怎么做?

推荐答案

简短答案:
IF
T 他的-Alexa
T 母鸡
T 帽子-Adafruit/Maker Webhook

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

更长的答案:
有两个选项:
1)Alexa将通知IFTTT发生了触发事件.为此,选择的操作是发布 MQTT 消息.这个MQTT频道是由Adafruit创建的.不用说,您需要在RPi上编写MQTT提要阅读器.

2)制造商网络挂钩.您将RPi暴露在Web上,并保持服务器在其上运行.公开可以从 Maker Webhook 调用的网络服务.就我个人而言,这是我的首选选项,但设置可能会很麻烦,即从调制解调器,路由器等进行端口转发.

参考文献:
1) Adafruit官方网站
2)MQTT Java库
3) Hackster教程-带有选项#1
4) Hackster教程-带有选项# 2

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

这篇关于通过IFTTT在树莓派中运行bash脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆