Pi-Hole switch

I’m not sure what you want here. I click the toggle for the switch and it goes off as fast as a light would. In my setup I see virtually no lag. I am running Pi-Hole in its own VM on a separate system and using the built in integration with a manual config to add the API token.

1 Like

That’s basically what I did with the input_select from Pi-Hole switch.

Oh it works great when you ONLY use Home Assistant to disable/enable Pi-Hole. What happens with your switch when you disable Pi-Hole using the Pi.hole web interface? There we go.

I see what you mean. To frame this a little differently… Are you saying the Integration acts like its One way from Home Assistant -> Pi-hole for the switch in Home Assistant, This functions pretty well and with a uniform outcome. However the switch in Home assistant doesn’t update correctly when a change is made in the Pi-hole instance to enable or disable leaving Home Assistant switch in a false state?

If this is the case I wonder how we are collecting the enabled/disable state of the pi-hole and if this is actually broken or not completely deployed. I know last year there was a lot of hype for AdGuard and pi-hole was being less thought of…

Hello, not sure if this is related to what @e-raser reports, but the switch remain “Off” for a much longer period than the set timer.
When button is pressed, it disables PiHole for the set duration, and enables it correctly, however the switch remains in “Off” state when PiHole is enabled, eventually it goes back to on, it takes around 5min for the switch to go back to “On”.
I also tried to disable blocking on PiHole web interface, and after around 5min the button in HA changed to “Off”, so it is working for me, but very slow.

type: button
name: PiHole Blocking is
show_state: true
entity: switch.pi_hole
icon_height: 50px
  action: call-service
  service: pi_hole.disable
    entity_id: all
    duration: '00:00:10'

Guessing it has to do with the pulling time HA has on the PiHole integration?

That’s right. Maybe the seitch/sensor scan time is too huge or something like that.

Copy that. That’s maybe the root issue.

By the way this is what It looks like for me, see second entity line to cross-check the switch state from first line. There‘s a huge delay for the switch to update as already mentioned.

I see lots of people switching to AdGuard because it’s beautifully/fully integrated into Home Assistant. And indeed, the Pi-Hole integration in comparison lacks a lot of features… :frowning:

Nothing seems to be working and I do not see any pihole sensors. This is what I have added. My pihole is installed on another server not same with Ha.

# Pi-Hole component
  - platform: pi_hole

I do not see any sensors like in this image below.

The shell_commands does not seem to work, but it does work when I test paste in a url bar to enable/disable pihole.


  pi_hole_status: !secret pi_hole_status
  pihole_enable: !secret pi_hole_enable
  pihole_disable: !secret pi_hole_disable
  pihole_disable_time: !secret pi_hole_disable_time


pi_hole_status: curl -X GET ''
pi_hole_enable: curl -X GET ''
pi_hole_disable: curl -X GET ''
pi_hole_disable_time: curl -X GET '{{ states.input_select.pihole_time.state }}&auth=TOKEN'

Are my quotes correct?

Update: So strange. I even tried adding this to config as per the Pi-hole Integration and no sensors after a restart of HA.

  host: ''
  ssl: false
  verify_ssl: false
  api_key: !secret pi_hole_key

Is it possible to create a switch that Enable’s or Disable’s an Adlists under Group Management?

This is awesome! just set it up and works fantastic

Quick question, how can I add Pi-Hole to the sidebar of home assistant? Thanks!

1 Like

Use panel_iframe: in your configuration.yaml.

    title: 'PiHole'
    icon: 'mdi:pi-hole'
    url: 'http://<URL TO PIHOLE>'

Yes, I am an idioi. Sorry. The problem is that I have home assistant with SSL and iframe does not support talking to http servers. Created a self-signed certificate, but after manually accepting this on chrome and doing other stuff on crome to accept local certificate, it didn’t work either. Therefore, i just disregard the idea of adding it to an URL from Hassio.
Thank you very much anyway for your response!!!

I also want to add a switch to HA for enable/diable pihole

I used already some exaples but without good result

Which one is working now?

To perform the request in iOS shortcuts, you can call the pihole Get URL in shortcuts and set quick access in Safari’s share sheets.

Hi all, maybe a dumb question but am I the only one who does not see the pi_hole service? I see all sensors but the service is not present

ok, interesting. I deleted the integration and set it up again. I see 15 sensors instead of 12 and got the service. The integration does not update with home assistant updates?

I hope this saves someone the frustration, but Vahaldor’s post tipped me off to the true reason for my problem: you must delete your pi-hole integration from Home Assistant, but when adding your Pihole again, there’s a very easy-to-miss checkbox that’s by-default checked that says “Statistics Only”. You want to UNCHECK that. It will then ask you for your API key. From there, you’ll have access to the built-in Pi-Hole switch.

1 Like

I know it’s an old topic but my PiHole integration is not working anymore for some reason (old version of HA, running on docker, I assume… I should really upgrade)

I have now two kids that start surfing the web, and I needed a way to contol the time in which they are allowed to what certain site (EG Youtube) and block others altogether (EG TikTok and Facebook).

I created a script that I run as a service on my PyHole instance on a Raspberry PI, and exposes the group management to HA. Now I have automation (or manual option) to quickly turn the blocking on or off.

If someone wants to use it, test it or provide feedback, find it here :slight_smile: