简体   繁体   中英

How does raspberry pi receive trigger events from webhooks with IFTTT?

What I am trying to do is a quite basic task: to send event triggers from different services to Raspberry pi and do some tasks when these triggers are received, in other words to make "home automation".

I searched for many websites and links but all projects about ifttt and raspberry pi do the reverse job: raspberry pi posts a web request and another service receives this trigger and does something.

There are some projects to receive requests from google assistant on raspberry pi but google assistant posts a request which contains https://raspberry_ip_address:port/bla_bla which works locally, but I want to send request from my phone even if it is not connected to my home wi-fi.

I found that ProtaOS on rpi works for these tasks and there are some projects with node-red but I don't want to use both of these solutions, I want to write python code on my own.

Is there any api or library for getting requests from maker ifttt trigger events for Python?

Any help would be appreciated. Thanks!

If i understood your question correctly, You want to trigger something with your phone and then on raspi you will excecute something with that trigger generated from phone or any other device.

  1. One way of doing this is to use an external api like thinkspeak or ifttt, for that you have to continiously read a particular field which your trigger will change check this

  2. Another way can be making your own api and using it both from your services to post data and your raspi to read data. Python Flask ia a very simple framework for building web api. For hosting there are many free services like heroku, pythonanywhere. Flask 101 and Free Hosting!!!

  3. Another way is to host your trigger listener in your raspi and port forward your raspi IP with Ngrok or any other services of such kind. Ngrok

Comment below if you have any other specific query. Keep Hacking :)

There are a number of solutions I use in this scenario, depending on what the problem is and how frequently I need to push requests to the Pi. Here is my portfolio:

  1. Get a 3G module like SIM900: https://www.amazon.co.uk/Aihasd-Quad-Band-Development-Wireless-Raspberry/dp/B01IBGDDVM/ . This will allow you to receive SMS in real time and receive instructions with a push from your phone. I like this option for remote sensing and homes with a weak or unstable internet connection.
  2. continuous calls to a server to check for updates (a method you sound familiar with). This works well if Wifi is good and data is cheap.
  3. Web sockets: this allows a continuous connection to be kept open between Raspberry Pi and server, though it requires a stable and continuous connection. https://www.jaredwolff.com/raspberry-pi-getting-interactive-with-your-server-using-websockets/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM