Enable or disable ads with Pi-hole on a Raspberry Pi
-
This video shows how you can say, Alexa, turn off ads or Hey Google, turn on ads to toggle ads on or off on your network.
Use this article to setup your Raspberry Pi if you haven't already.
Use the Smart Home Alexa skill or Google Assistant action.
Use a line like this in your /root/.TRIGGERcmdData/commands.json:
{"trigger":"PiHole","command":"/usr/local/bin/pihole_on_off.sh","ground":"background","voice":"ads","allowParams":"true"},
This is the bash script I wrote to /usr/local/bin/pihole_on_off.sh and made it executable with chmod +x /usr/local/bin/pihole_on_off.sh
#!/bin/bash case "$1" in "off") pihole enable ;; "on") pihole disable ;; *) echo "Run this with on or off as the parameter." exit 1 ;; esac
This page gives a list of pihole commands:|
https://docs.pi-hole.net/core/pihole-command/ -
Hello.
Nice hack
I think you inverted the commands, Off should be "pihole disable". -
@Cutezator, I kept getting confused but I think I got it right because I'm saying "turn off ads" not "turn off pi hole". Turning off ads means enabling pi hole.
-
This post is deleted! -
This post is deleted! -
Hey Russ, so i set up everything like u said.
I can run the script like u with /usr/local/bin/pihole_on_off.sh on/off.
I also can enable/disable it on my trigger cmd command management.
But how do i do with with my voice? can i change what i need to say? Im confused here lol.
-
@Furkan-Cevik, good question. I should have covered this in the video. You need to enable one of these:
Then your commands become Smart Home switches and you can say, Alexa (or Hey Google), turn on/off ads.
Your command will run on your Raspberry Pi with on or off as the parameter.
-
@Russ Works now, thanks!
-
-