TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Enable or disable ads with Pi-hole on a Raspberry Pi

    Raspberry Pi
    3
    8
    1.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • RussR
      Russ
      last edited by Russ

      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/

      Russell VanderMey

      1 Reply Last reply Reply Quote 0
      • CutezatorC
        Cutezator
        last edited by

        Hello.
        Nice hack 🙂
        I think you inverted the commands, Off should be "pihole disable".

        RussR 1 Reply Last reply Reply Quote 0
        • RussR
          Russ @Cutezator
          last edited by Russ

          @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.

          Russell VanderMey

          1 Reply Last reply Reply Quote 0
          • Furkan CevikF
            Furkan Cevik
            last edited by

            This post is deleted!
            Furkan CevikF 1 Reply Last reply Reply Quote 0
            • Furkan CevikF
              Furkan Cevik @Furkan Cevik
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • Furkan CevikF
                Furkan Cevik
                last edited by

                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.

                RussR 1 Reply Last reply Reply Quote 0
                • RussR
                  Russ @Furkan Cevik
                  last edited by Russ

                  @Furkan-Cevik, good question. I should have covered this in the video. You need to enable one of these:

                  • "TRIGGERcmd Smart Home" Alexa skill
                  • "TRIGGERcmd Smart Home" Google Assistant action

                  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.

                  Russell VanderMey

                  Furkan CevikF 1 Reply Last reply Reply Quote 0
                  • Furkan CevikF
                    Furkan Cevik @Russ
                    last edited by

                    @Russ Works now, thanks!

                    1 Reply Last reply Reply Quote 0
                    • tuicemenT tuicemen moved this topic from Instructions on
                    • T TI_Gaming_TV referenced this topic on
                    • First post
                      Last post