本文介绍了使用树莓派制作启用了ifttt的家庭自动化系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在尝试使用ifttt和我的rapiberry pi模型b +创建一个相对简单的家庭自动化系统.我的目标是创建一个托管Web服务器的python脚本,该服务器可以由ifttt maker渠道发布到该服务器. pi需要能够通过ifttt检测到该帖子,然后在我的情况下执行一项操作来更改RGB LED的颜色/亮度/状态.我已经尝试使用电子邮件来控制操作,但是速度非常慢,每当wifi在pi上掉线时,脚本就会崩溃,因此我还需要一个可以检测wifi何时出故障的检测系统,以防止崩溃.我目前(11岁)(Shocker),但我需要一些帮助,因为目前,我正竭尽全力去实现自己的目标.任何帮助将不胜感激.

Hi everyone I am trying to make a relatively simple home automation system with ifttt and my raspberry pi model b+. My goal is to create a python script which hosts a web server which can be posted to by ifttt maker channel. The pi needs to be able to detect the post by ifttt and then run an action in my case change the color/brightness/state of an RGB LED. I have already tried use email to control actions but that was very slow and whenever wifi dropped out on my pi the script crashed so I also will need a detection system that can detect when wifi is out to prevent crashes. I am currently 11 years old (Shocker) but I need some help because currently, i am struggling to get anywhere close to my goal. Any help will be greatly appreciated.

推荐答案

RPi端
您需要两个单独的脚本:
1)将托管Web服务器的Python脚本.
2)可以处理RGB数据的Python脚本.(猜想您已经拥有了此脚本)


在IFTTT方面
首先,查看此称为Maker Web-hooks的IFTTT服务.
基本上,IFTTT可以访问URL(在您的情况下为python网络服务).因此,您公开了一个API,告诉IFTTT监听您选择的触发器.并在触发时调用您的Web API.这应该非常快.
一些注意事项
1)RPi的服务器需要可以从互联网访问,而不仅仅是本地wi-fi.这是因为IFTTT将尝试与您的RPi Web服务器联系.


2)为了快速传递消息,您可以评估MQTT. 在此处的另一个答案中对此进行了解释.
唯一的不足是,您需要(免费)注册MQTT经纪人服务.因此,在IFTTT和您的RPi之间本质上还有一个附加实体.

3)就像@anjsimmo所说的那样,异常处理是必须的.您需要使用任何类型的代码来完成此操作.


我正在使用MQTT运行具有相同RPi模型的个人家庭自动化系统. Publisher是一个Android应用程序,订阅者是RPi.


您的项目一切顺利!

The RPi side
There are two separate scripts you need:
1) Python script which will host a web-server.
2) Python script which can manipulate RGB data.(Guess you already have this)


On IFTTT side
First of all, check out this IFTTT service called Maker Web-hooks.
Basically, IFTTT is able to hit URLs(in your case, your python web-services). So you expose an API, tell IFTTT to listen to a trigger of you choice. And upon trigger, invoke your web API. This should be very fast.
A Few Notes
1) The RPi's server needs to be accessible from the internet, not just the local wi-fi. This is because IFTTT is going to try to reach out to your RPi web-server.


2) For quick message delivery, you can evaluate MQTT. This has been explained in another answer here.
The only shortfall is, you need to register(for free) for an MQTT broker service. So there's essentially an additional entity between IFTTT and your RPi.

3) Like @anjsimmo has said, exception handling is a must. You'll need to do it with any sort of code.


I'm running my personal home-automation system with the same RPi model, using MQTT. Publisher is an Android app and subscriber is the RPi.


All the best with your project!

这篇关于使用树莓派制作启用了ifttt的家庭自动化系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 15:57