• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
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.8k
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.
  • R
    Russ
    last edited by Russ Jul 16, 2023, 11:41 AM Aug 13, 2020, 12:12 AM

    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
    • C
      Cutezator
      last edited by Aug 14, 2020, 3:40 PM

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

      R 1 Reply Last reply Aug 14, 2020, 4:18 PM Reply Quote 0
      • R
        Russ @Cutezator
        last edited by Russ Aug 14, 2020, 4:19 PM Aug 14, 2020, 4:18 PM

        @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
        • F
          Furkan Cevik
          last edited by Aug 14, 2020, 6:39 PM

          This post is deleted!
          F 1 Reply Last reply Aug 14, 2020, 6:54 PM Reply Quote 0
          • F
            Furkan Cevik @Furkan Cevik
            last edited by Aug 14, 2020, 6:54 PM

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • F
              Furkan Cevik
              last edited by Aug 14, 2020, 7:20 PM

              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.

              R 1 Reply Last reply Aug 14, 2020, 8:09 PM Reply Quote 0
              • R
                Russ @Furkan Cevik
                last edited by Russ Aug 14, 2020, 8:12 PM Aug 14, 2020, 8:09 PM

                @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

                F 1 Reply Last reply Aug 14, 2020, 9:21 PM Reply Quote 0
                • F
                  Furkan Cevik @Russ
                  last edited by Aug 14, 2020, 9:21 PM

                  @Russ Works now, thanks!

                  1 Reply Last reply Reply Quote 0
                  • T tuicemen moved this topic from Instructions on Jan 30, 2022, 7:44 PM
                  • T TI_Gaming_TV referenced this topic on Mar 1, 2023, 6:30 PM
                  3 out of 8
                  • First post
                    3/8
                    Last post