AnxiouslyRare
Posts: 2
Joined: Sat Sep 22, 2018 7:28 pm

iPhone -> Adafruit -> Raspberry (MQTT)

Sat Sep 22, 2018 7:30 pm

First of all I'm a complete newbie to Pi as well as programming, so please bear with me.

Over the past few days I've been wanting to trigger Python scripts to run on my Pi from a button press on my iPhone. I am pleased to say that I have got this up and running using the following method:

IFTTT Button (iPhone) -> Adafruit Feed -> Adafruit Feed watched by Python script -> Python script executed if correct parameter received

This works like a charm and so I added the following for Siri integration / triggering:

Apple Shortcuts / Siri -> IFTTT Webhook -> Adafruit.... and the same as above from here onwards.

So my question at the end of all this is, is this process ok? As in are there better ways that I can be doing this / or any security or other concerns with my current process? Like I said, the above methods work really well for me and are nice and easy to setup and manage with my limited knowledge - but I'd like to know if there are any issues with my current approach.

Thanks!

User avatar
neilgl
Posts: 243
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: iPhone -> Adafruit -> Raspberry (MQTT)

Mon Sep 24, 2018 12:46 pm

Probably it is OK because it works for you.
What might be interesting is to use the pi as a web server, create a page with a button on it, look at that page on your iphone and "press" the button. The pi can then run your python script. No IFTTT or Adafruit needed.

AnxiouslyRare
Posts: 2
Joined: Sat Sep 22, 2018 7:28 pm

Re: iPhone -> Adafruit -> Raspberry (MQTT)

Mon Sep 24, 2018 5:09 pm

neilgl wrote:
Mon Sep 24, 2018 12:46 pm
Probably it is OK because it works for you.
What might be interesting is to use the pi as a web server, create a page with a button on it, look at that page on your iphone and "press" the button. The pi can then run your python script. No IFTTT or Adafruit needed.

Hey thanks for the reply! How complex is it to set up a webserver on the pi? and would that involve having to setup complex rules with holes in my firewall etc?

Andyroo
Posts: 664
Joined: Sat Jun 16, 2018 12:49 am

Re: iPhone -> Adafruit -> Raspberry (MQTT)

Mon Sep 24, 2018 7:54 pm

Website set up is simple to complex :lol:

Getting Apache2 to run is very straightforward and documented all over for the Pi - you could also write the website in Python using FLASK.

If would also add UFWto the Pi to simplify the firewall set up

You can normally handle the router side two ways:
1) Make the IP address of the DMZ the same as the Pi
2) Put a port forwarding for port 80 to the Pi IP address - my preferred change.

One thing to check is if you have a dynamic IP address from your ISP - this may give you a bit of fun getting to the site from outside.
Need Pi spray - these things are breeding in my house...

Return to “Beginners”