[RELEASE] Pi hole controller

Simple on/off controller for Pi-hole and some stats.

5 Likes

what is Pi hole in this context? Not an ad blocker.

hm - you use this in your smarthome scheme?

1 Like

To avoid the WAF yes. Some results in google for instance (the advertisements) do not work with pihole active so sometimes you need to disable things from the couch :wink:

or when the house detect wife and kids at home, turn on pihole. Turn off pihole when you’re alone at home for all your adult viewing pleasure LOL…

Thank you for this! Blocks a few services the wife uses, but it’s a pain to make her go through the web interface to disable for a minute. Now she can just ask Assistant to do it for her :slight_smile:

This is fantastic. Thanks.

Hi there! Also a newbie. I’ve been wanting to do something like this for a very long time, and now that I have a SmartThings hub, I’m excited to do it!
However, using your code, I’m getting the debug error saying that the IP address is missing in preferences, but I replaced deviceIP with the IP address of my Pi.Hole, as well as the API key.
However, reading through the code, I feel like that’s not what is supposed to be done. Where are you supposed to enter your info?

Thank you for this! Works fantastic.

How’d you get it to work? I don’t see where to specify the API key or IP address…

Once you install the device handler you have to create a device in the ide using the DH. Once you have that you go into the smartthings app and find the device you just made and go into the gear

So, I installed the device handler (that’s the script, right?) and then created the device in the IDE and told it that the “Type” was Pi.Hole.
in the SmartThings app with the halo/single circle, I see a device Named Pi.Hole, and it was on by default, however me toggling it doesn’t appear to be doing anything, and if I disable it via the webUI, it doesn’t display as “Off”.
Edit: Nevermind, I forgot to modify the device settings.
Thank you very much!!! Now to make it automatically turn back on after so long. Any idea how to do that?

Where do I get my api key from? Assuming when I get home I can maybe get it from the Web interface

When you go into the dashboard on the pihole you can get it.

1 Like

Thanks @CopyCat73, this is awesome. I reversed the Enable/Disable in you script and renamed it “Shut Your Pi-hole”. Now when I turn it on it disables Pi-hole and I set a timer to turn it off after a set time. Definitely WAF, I have it working with a button. Maybe I’ll set it up with Alexa and say “Alexa, Shut Your Pi-hole” :wink:

Edit: I now have it setup so when we say “Alexa, shut your Pi Hole”, Pi-Hole is disabled for 1/2 hour.

Thank you! This is extremely useful. Is there a way to change the upstream DNS while pi hole is disabled and change back to the default when pi hole is turned back on? We’re using a “family friendly” DNS which sometimes give us false positive, it’d be nice to be able to easily turn to an “all open” DNS while pihole is disabled.

Amazing! Thank you so much for this! Still works great!

Copied this into smartapps and got the following error:

No signature of method: script_app_metadata_226348ba_6d0a_4438_9738_2bbb7eb798e3.metadata() is applicable for argument types: (script_app_metadata_226348ba_6d0a_4438_9738_2bbb7eb798e3$_run_closure1) values: [script_app_metadata_226348ba_6d0a_4438_9738_2bbb7eb798e3$_run_closure1@68431dc5] Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure)

Any ideas on how to resolve?

Just curious if there was any possible way this could be updated to use whatever Samsung is allowing us to use after Groovy is killed off?