Easily disable Pihole from your iPhone (or iPad)

If you run a pihole the odds are good that you’ve needed to disable it from time to time. I wanted an easy way to disable my pihole(s) temporarily, so I wrote a simple shell script to do it for me. I’m almost always on my Macbook, so this approach worked for a while. I needed to disable it a few times while I was out of the room, so I figured I’d find an easier way to do it from my phone.
I already used an iOS app called Launcher on my iphone, so integrating pihole api calls with it seemed like a no-brainer. For convienience, it can be used from your lock screen without having to unlock your phone.

Using the Launcher Widget to disable pihole

Get the Pihole API Key

Obtain the API Keys for your pihole(s) using this command from a linux shell on your Pihole:

1
2
3
4
sudo cat /etc/pihole/setupVars.conf | grep PASSWORD
# Output from that command is the API key (Copy this value):
17d1ce58eb42099oiwerDDDf9sddfwder285w0ere7tce6t3723489df78234

This is our API Key: 17d1ce58eb42099oiwerDDDf9sddfwder285w0ere7tce6t3723489df78234

Install and Configure Launcher for iOS

Install Launcher on your iPhone or iOS device.

Open Launcher and select the + Give this Launcher widget a name like Pihole Off. I chose a short name because the launcher icon has a character limit.

Important: Toggle the Don't open Safari: switch to ON

There are 3 important values that make up most of the URL. The hostname, the Pihole API Key and the number of seconds to disable. I used 300 seconds (5 minutes) in my setup.

Now type in the following URL, substituting your own values for API_KEY and HOSTNAME for your pihole. If you use TLS/SSL, you’ll need to change the HTTP schema to HTTPS.

Create New Launcher Widget

Example URL:

1
http://my.pi.hole/admin/api.php?disable=300&auth=17d1ce58eb42099oiwerDDDf9sddfwder285w0ere7tce6t3723489df78234

Tip: If you’re on iOS on a Mac, you can copy the URL for your pihole and on your iPhone just single tap and Paste

Optionally, you can add a Siri command by clicking Add to Siri and configuring it in Launcher. Once you’ve set the options, click on the checkmark icon in the top right corner to save.

Test the new launcher and make sure it works as you expect. During testing, I had the pihole admin interface open in a browser. After clicking the launcher icon, I reloaded the page saw that the pihole was in a temporary disable countdown:

Our New Launcher Widget

Pihole Disabled

It Works! Now that you have a working way to disable the pihole from a Launcher, let’s put the launcer widget in a useful spot on the phone.

The Today Screen

The Today Screen on the iPhone is the screen that is accessed by swiping right from the lock screen or the home screen. It looks like this:

iPhone Today Screen

This is very handy and easy to access place for a useful button! Let’s install our Launcher Widget there by scrolling to the bottom of the Today screen and clicking the Edit Icon. Touch the Green + next to Launcher. Tap and hold the right hamburger = icon and slide it into a convenient location up among your other widgets. Tap Done and test your new widget again.
Now with a simple right swipe from your lock screen, you can disable your pihole.
Using the Launcher Widget to disable pihole

Final thoughts

The only drawback that I’ve found with this method is that the Launcher widget doesn’t provide any feedback.

As I’ve demonstrated here, Launcher is a great tool for putting REST API calls at your fingertips (literally). There are probably similar ways to do the same thing on Andoid. If someone shares a link with an Android how-to, I’ll link it here.

Disable your pihole for a few minutes and leave a comment below if you’ve found this helpful or if you have any tips to share.




Technology Used:
PiHoleLauncher
Comments