core: Pi_hole integration doesn't work on pi_hole V6

The problem

On pi-hole V6, of which release is imminent, the integration no longer works. This is probably because the API has moved from pi.hole/admin/api to pi.hole/api

See:

image

image

Please make the integration recognize the new location.

What version of Home Assistant Core has the issue?

core-2024.11.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

pi_hole

Link to integration documentation on our website

https://www.home-assistant.io/integrations/pi_hole

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 111, in native_value
    return round(self.api.data[self.entity_description.key], 2)  # type: ignore[no-any-return]
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ads_blocked_today'

=========================================================

2024-11-09 21:48:25.790 DEBUG (MainThread) [hole] Response from *hole: 400
2024-11-09 21:48:25.791 DEBUG (MainThread) [hole] {'error': {'key': 'bad_request', 'message': 'Bad request', 'hint': 'The API is hosted at pi.hole/api, not pi.hole/admin/api'}, 'took': 0.0004820823669433594}
2024-11-09 21:48:25.863 DEBUG (MainThread) [hole] Response from *hole: 400
2024-11-09 21:48:25.863 DEBUG (MainThread) [hole] {'error': {'key': 'bad_request', 'message': 'Bad request', 'hint': 'The API is hosted at pi.hole/api, not pi.hole/admin/api'}, 'took': 0.0003046989440917969}
2024-11-09 21:48:25.864 DEBUG (MainThread) [homeassistant.components.pi_hole] Finished fetching Pi-Hole data in 0.154 seconds (success: True)
2024-11-09 21:48:25.865 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 266, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 481, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 176, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 561, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 544, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 111, in native_value
    return round(self.api.data[self.entity_description.key], 2)  # type: ignore[no-any-return]
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ads_blocked_today'

=========================================================

Logger: homeassistant.components.binary_sensor
Source: helpers/entity_platform.py:728
integration: Binary sensor (documentation, issues)
First occurred: 14:03:25 (2 occurrences)
Last logged: 21:31:33

pi_hole: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 728, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1302, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 599, in async_update
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 273, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 114, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 358, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 481, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 176, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 561, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 544, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 111, in native_value
    return round(self.api.data[self.entity_description.key], 2)  # type: ignore[no-any-return]
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ads_blocked_today'

=====================================================

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:918
integration: Sensor (documentation, issues)
First occurred: 14:03:25 (18 occurrences)
Last logged: 21:31:33

Error adding entity sensor.pi_hole_domains_blocked_2 for domain sensor with platform pi_hole
Error adding entity sensor.pi_hole_dns_queries_cached_2 for domain sensor with platform pi_hole
Error adding entity sensor.pi_hole_dns_queries_forwarded_2 for domain sensor with platform pi_hole
Error adding entity sensor.pi_hole_dns_unique_clients_2 for domain sensor with platform pi_hole
Error adding entity sensor.pi_hole_dns_unique_domains_2 for domain sensor with platform pi_hole
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 918, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1368, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 544, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 111, in native_value
    return round(self.api.data[self.entity_description.key], 2)  # type: ignore[no-any-return]
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ads_blocked_today'

Additional information

The integration setup only allows a hostname or ip adress, but it doesn’t allow to point the api to pi.hole/api instead of pi.hole/admin/api

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 135
  • Comments: 147 (18 by maintainers)

Most upvoted comments

hey folks!

I’m not sure flooding this issue with more “it’s broken now” kind of replies will do any good. subscribe to the issue using this button

Image

or just add your 👍🏻 reaction.

I guess someone from the Core team is aware but since there is a fix (e.g. do no upgrade yet), this issue might not be a priority soon

I’ve successfully implemented support for the Pi-hole v6 API in the original Python library python-hole. The main changes include:

  • Updated API endpoint from pi.hole/admin/api to pi.hole/api
  • Added compatibility with new v6 API response format
  • Maintained backward compatibility
  • Added example code demonstrating the new functionality

The changes are currently in PR and can be referenced for implementing similar updates in the Home Assistant integration. The key change was updating the base API endpoint and adjusting the data parsing to match the v6 API structure.

Feel free to check out the implementation for reference: https://github.com/LeonKohli/python-hole/pull/new/feature/v6-api

No offense to the guys creating these workarounds, as they are great, but it’s kind of ridiculous that this is an official HA integration and the core team is entirely MIA. I understand these things take time and the teams are small, but at least some acknowledgement that it’s an issue would be nice

Just swapped over to @bastgau Pi-Hole-V6 integration, didn’t even have to change anything on the dashboard, just worked ! Removed the old “official” integration, added new via HACS and back in action.

Image

Will be sticking to this going forward

Hello.

I have implemented the new Pi-home API inside a custom integration available here : https://github.com/bastgau/ha-pi-hole-v6

Only a few main sensors and two services to enable or disable blocking are currently implemented.

/!\ The Home Assistant v2025.03 is required to use the integration (released next week).

The python-hole dependency now officially supports v6, as the pull request has finally been merged: https://github.com/home-assistant-ecosystem/python-hole/pull/29#event-16980813327

A few ours ago the dependency with the latest Pi-hole V6 changes has been released: https://github.com/home-assistant-ecosystem/python-hole/releases/tag/0.9.0

Guess it is possible to move forward and update the core integration in Home Assistant then?

I thought about modifying the original library @shenxn used, but I decided to write a separate client library for this new version of pi-hole’s API. I plan on adding more endpoints soon, but most of the ones “hole” was using are there.

pyhole6

I hope you guys find it useful.

Basically a good point.

I guess someone from the Core team is aware but since there is a fix (e.g. do no upgrade yet), this issue might not be a priority soon

  1. Not sure if someone is aware, I did not check the whole issue and all involved users precisely.
  2. Which fix? Not upgrading is one which will likely not work for the majority of users. They’ll upgrade Pi-Hole, discover the integration is broken, and find this issue.
  3. Therefore I think this issue will be a priority soon. At least it should. Looking at Pi-Hole and HA history there’s not much HA core inner motivation, so the only priority comes from (affected) users.

Feel free to minimize this comment as it does not add anything substantial to fix this issue. It just puts the issue’s relevance into context.

For normal users: which HA release is expected to contain a Pi-Hole version capable of communicating with the v6 API?

2025.8

I dug into this today and it looks like the issue is very likely to be related to the hole package, which is a dependency that is used to make the actual api call. It doesn’t look like the package has been updated for v6.

seems like the code owner for this integration has abandoned it; so now there is a fork to fix it.

Can you point me to that card?

The card is just a card stack, with an image and an entities card at the top, and bar-cards at the bottom that use Glances to show hard disk, memory, and processor information.

The middle part is a HTML Template card, with the following settings and content to match the Pi-hole web UI:

  - type: custom:html-template-card
    ignore_line_breaks: true
    entities:
      - sensor.pi_hole_dns_queries_today
      - sensor.pi_hole_ads_blocked_today
      - sensor.pi_hole_ads_percentage_blocked_today
      - sensor.pi_hole_domains_blocked
      - sensor.pi_hole_dns_unique_clients
    content: |-
      <style>
        .icon {
          -webkit-transition: all .3s linear;
          -o-transition: all .3s linear;
          transition: all .3s linear;
          position: absolute;
          top: 8px;
          right: 8px;
          z-index: 0;
          font-size: 90px;
          color: rgba(0,0,0,0.15);
          display: inline-block;
          font-size: inherit;
          height: .7em;
          width: .575em;
          overflow: visible;
          vertical-align: -.125em;
          z-index: -1;
        }
        .grid-container {
          display: grid;
          grid-template-columns: auto auto;
          gap: 8px;
          margin: 0;
          padding: 0;
        }
        .small-box {
          color: #FFF;
          border-radius: 10px;
          z-index: 0; /* fix the small-box z-index (related to '.small-box .icon') */
          overflow: hidden;
          position: relative;
        }
        .small-box p {
          margin: 0 0 5px;
        }
        .small-box > .inner {
          padding: 10px 10px 0;
        }
        .small-box > .small-box-footer {
          color: rgba(255, 255, 255, 0.75);
          transition: all 0.5s;
          position: relative;
          text-align: right;
          padding: 3px 8px;
          display: block;
          z-index: 10;
          background: rgba(0,0,0,0.1);
          text-decoration: none
        }
        .small-box .icon {
          font-size: 76px;
          z-index: -1; /* sends the icon behind the text */
        }
        .small-box h3 {
          color: #FFF;
          font-size: 38px;
          font-weight: bold;
          margin: 0 0 10px 0;
          white-space: nowrap;
          padding: 0
        }
        .bg-aqua {
          background-color: #00c0ef !important
        }
        .bg-red {
          background-color: #dd4b39 !important
        }
        .bg-yellow {
          background-color: #f39c12 !important
        }
        .bg-green {
          background-color: #00a65a !important
        }
      </style> 
      <div class="grid-container">
      <div class="small-box bg-aqua no-user-select">
        <div class="inner">
          <p>Total queries</p>
          <h3 class="statistic">{{ '{0:,.0f}'.format(states('sensor.pi_hole_dns_queries_today') | int(0)) }}</h3>
        </div>
        <div class="icon">
          <svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M248 8C111.03 8 0 119.03 0 256s111.03 248 248 248 248-111.03 248-248S384.97 8 248 8zm82.29 357.6c-3.9 3.88-7.99 7.95-11.31 11.28-2.99 3-5.1 6.7-6.17 10.71-1.51 5.66-2.73 11.38-4.77 16.87l-17.39 46.85c-13.76 3-28 4.69-42.65 4.69v-27.38c1.69-12.62-7.64-36.26-22.63-51.25-6-6-9.37-14.14-9.37-22.63v-32.01c0-11.64-6.27-22.34-16.46-27.97-14.37-7.95-34.81-19.06-48.81-26.11-11.48-5.78-22.1-13.14-31.65-21.75l-.8-.72a114.792 114.792 0 0 1-18.06-20.74c-9.38-13.77-24.66-36.42-34.59-51.14 20.47-45.5 57.36-82.04 103.2-101.89l24.01 12.01C203.48 89.74 216 82.01 216 70.11v-11.3c7.99-1.29 16.12-2.11 24.39-2.42l28.3 28.3c6.25 6.25 6.25 16.38 0 22.63L264 112l-10.34 10.34c-3.12 3.12-3.12 8.19 0 11.31l4.69 4.69c3.12 3.12 3.12 8.19 0 11.31l-8 8a8.008 8.008 0 0 1-5.66 2.34h-8.99c-2.08 0-4.08.81-5.58 2.27l-9.92 9.65a8.008 8.008 0 0 0-1.58 9.31l15.59 31.19c2.66 5.32-1.21 11.58-7.15 11.58h-5.64c-1.93 0-3.79-.7-5.24-1.96l-9.28-8.06a16.017 16.017 0 0 0-15.55-3.1l-31.17 10.39a11.95 11.95 0 0 0-8.17 11.34c0 4.53 2.56 8.66 6.61 10.69l11.08 5.54c9.41 4.71 19.79 7.16 30.31 7.16s22.59 27.29 32 32h66.75c8.49 0 16.62 3.37 22.63 9.37l13.69 13.69a30.503 30.503 0 0 1 8.93 21.57 46.536 46.536 0 0 1-13.72 32.98zM417 274.25c-5.79-1.45-10.84-5-14.15-9.97l-17.98-26.97a23.97 23.97 0 0 1 0-26.62l19.59-29.38c2.32-3.47 5.5-6.29 9.24-8.15l12.98-6.49C440.2 193.59 448 223.87 448 256c0 8.67-.74 17.16-1.82 25.54L417 274.25z"></path></svg>
        </div>
        <div class="small-box-footer">
          {{ states('sensor.pi_hole_dns_unique_clients') }} active clients
        </div>
      </div>
      <div class="small-box bg-red no-user-select">
        <div class="inner">
          <p>Queries Blocked</p>
          <h3 class="statistic">{{ '{0:,.0f}'.format(states('sensor.pi_hole_ads_blocked_today') | int(0)) }}</h3>
        </div>
        <div class="icon">
          <svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M408.781 128.007C386.356 127.578 368 146.36 368 168.79V256h-8V79.79c0-22.43-18.356-41.212-40.781-40.783C297.488 39.423 280 57.169 280 79v177h-8V40.79C272 18.36 253.644-.422 231.219.007 209.488.423 192 18.169 192 40v216h-8V80.79c0-22.43-18.356-41.212-40.781-40.783C121.488 40.423 104 58.169 104 80v235.992l-31.648-43.519c-12.993-17.866-38.009-21.817-55.877-8.823-17.865 12.994-21.815 38.01-8.822 55.877l125.601 172.705A48 48 0 0 0 172.073 512h197.59c22.274 0 41.622-15.324 46.724-37.006l26.508-112.66a192.011 192.011 0 0 0 5.104-43.975V168c.001-21.831-17.487-39.577-39.218-39.993z"></path></svg>
        </div>
        <div class="small-box-footer">&nbsp;
        </div>
      </div>
      <div class="small-box bg-yellow no-user-select">
        <div class="inner">
          <p>Percentage Blocked</p>
          <h3 class="statistic">{{ states('sensor.pi_hole_ads_percentage_blocked_today', with_unit=True) }}</h3>
        </div>
        <div class="icon">
          <svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 544 512"><path fill="currentColor" d="M527.79 288H290.5l158.03 158.03c6.04 6.04 15.98 6.53 22.19.68 38.7-36.46 65.32-85.61 73.13-140.86 1.34-9.46-6.51-17.85-16.06-17.85zm-15.83-64.8C503.72 103.74 408.26 8.28 288.8.04 279.68-.59 272 7.1 272 16.24V240h223.77c9.14 0 16.82-7.68 16.19-16.8zM224 288V50.71c0-9.55-8.39-17.4-17.84-16.06C86.99 51.49-4.1 155.6.14 280.37 4.5 408.51 114.83 513.59 243.03 511.98c50.4-.63 96.97-16.87 135.26-44.03 7.9-5.6 8.42-17.23 1.57-24.08L224 288z"></path></svg>
        </div>
        <div class="small-box-footer">&nbsp;
        </div>
      </div>
      <div class="small-box bg-green no-user-select">
        <div class="inner">
          <p>Domains on Adlists</p>
          <h3 class="statistic">{{ '{0:,.0f}'.format(states('sensor.pi_hole_domains_blocked') | int(0)) }}</h3>
        </div>
        <div class="icon">
          <svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 480H48c-26.51 0-48-21.49-48-48V80c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v352c0 26.51-21.49 48-48 48zM128 120c-22.091 0-40 17.909-40 40s17.909 40 40 40 40-17.909 40-40-17.909-40-40-40zm0 96c-22.091 0-40 17.909-40 40s17.909 40 40 40 40-17.909 40-40-17.909-40-40-40zm0 96c-22.091 0-40 17.909-40 40s17.909 40 40 40 40-17.909 40-40-17.909-40-40-40zm288-136v-32c0-6.627-5.373-12-12-12H204c-6.627 0-12 5.373-12 12v32c0 6.627 5.373 12 12 12h200c6.627 0 12-5.373 12-12zm0 96v-32c0-6.627-5.373-12-12-12H204c-6.627 0-12 5.373-12 12v32c0 6.627 5.373 12 12 12h200c6.627 0 12-5.373 12-12zm0 96v-32c0-6.627-5.373-12-12-12H204c-6.627 0-12 5.373-12 12v32c0 6.627 5.373 12 12 12h200c6.627 0 12-5.373 12-12z"></path></svg>
        </div>
        <div class="small-box-footer">&nbsp;
        </div>
      </div>
      </div>
rest:
  - resource_template: "{{ states('input_text.pihole_url') }}/api/stats/summary" # I have configured input text on home assistant UI in my case, you can also hardcode url
    verify_ssl: false
    method: GET
    headers:
      sid: "aodnowwac=" # you can hard code value since the more you use, its expiration time will increase automatically
      # sid: "{{ states('input_text.pihole_sid') }}" # if you want to use input text from home assistant
    timeout: 10
    scan_interval: 10
    sensor:
      - name: "Total Queries"
        value_template: "{{ value_json.queries.total }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_total_queries"
  
      - name: "Blocked Queries"
        value_template: "{{ value_json.queries.blocked }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_blocked_queries"
  
      - name: "Blocked %"
        value_template: "{{ value_json.queries.percent_blocked | round(2) }}"
        unit_of_measurement: "%"
        unique_id: "pi_hole_percent_blocked"
  
      - name: "Queries Forwarded"
        value_template: "{{ value_json.queries.forwarded }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_forward_queries"
  
      - name: "Queries from Cache"
        value_template: "{{ value_json.queries.cached }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_cached_queries"
# you can add more sensor according to your needs, by inspecting the response of API using curl

To create sid, use this curl request –

curl -s "http://pi.hole/api/auth" --data '{"password":"your-password-in-plain-text"}' -A "Home Assistant" # setting user agent so that it will be uniquely indentified when removing from UI.

with totp if configured –

curl -s "http://pi.hole/api/auth" --data '{"password":"your-password-in-plain-text","totp":"123456"}' -A "Home Assistant" # setting user agent so that it will be uniquely indentified when removing from UI.

More info on here – https://docs.pi-hole.net/api/auth/

Since changes seem to be required for both the integration and the underlying library, I put togehter a POC (https://github.com/user-08-151/hole_v6) which works for my HA instance togehter with my PiHole v6 instance.

As hinted prior, the padd endpoint has most of the wanted data:

the padd endpoint might be a good starting point as well.

Originally posted by @mwoolweaver in #130245

Thanks for all the hard work HarvsG. Greatly appreciated.

I have finished the first draft of the pull request. #145890 If you are able please do review the code to speed up the chance of a merge. Particularly look at the tests, I do not have experience mocking APIs before and getting the tests working appropriately was a real struggle. If you are not able to contribute to the PR, please do not comment on the PR, but you can react to the first post if you wish.

so 2025.4.4 is not yet fixing this issue? just updated and still cannot integrate my PiHole v6 😦

I’m not sure anyone is working on fixing it?? Instead, you should switch to @bastgau new unofficial v6 integration which is easily installed via HACS (it’s really very good).

https://github.com/bastgau/ha-pi-hole-v6

Guys, please remember to star the repo to give the shout-out it deserves.

For the time being I removed the integration and implemented this: https://docs.pi-hole.net/guides/misc/homeassistant/

Better than nothing.

I have started a PR - I hoped it would only be a path change, but many of the endpoints have also been chanaged, so this will be quite a lot of work. So for I have got the sensors working but the following still needs doing:

  1. Confirm V5 not broken
  2. Get switch status working
  3. Get diagnostics working
  4. Write V6 tests

Guys - this has been open since November '24???

Is the minimal HA version needed (2025.3.x) for technical reasons or can it be tweaked to be used in previous HA versions?

@bastgau maybe you can answer that remaining question. Thanks a lot 👍


Otherwise on a long-term view I’m only highly interested in what happens with this official/core integration.

  • Will it get removed from core?
  • Will @bastgau’s custom one replace/become the official one? Who would be the new maintainer?

I’m still a bit surprised on the lack of information (official statement) regarding a broken and unmaintained official/core integration. All that ratings like silver/gold/… level of integrations sound kind of strange in this context. Somehow I expected a bit more. Maybe official 2.1 % usage of active installations is not enough to be relevant.

I have implemented the blocking mechanism as well as update status, using purely yaml.

Image

@CoolnsX Would you mind posting your YAML config for those sensors? Thanks.

I only used Pi-Hole integration to notify me on a dashboard (conditional display) whether there is an update to Pi-Hole. That functionality is gone for now.

V6 is officially out today. It’s time

Support for both V5 and V6 would be trivial for now as there are still a lot of devices with V5 in production.

I have not received any reply for my attempts to contact @shenxn. I am afraid this repo is abandoned by its author.

@frenck sorry to ping you directly, but what happens when an integration is abandoned by its author? Would it be possible for someone else to become the code owner?

1. They are working on a fix (dependency update) mentioned above

Just to clarify this statement, “they” (assuming you’re referring to official HomeAssistant team) are not working on the fix.

The community that built the integration is responsible for keeping it up to date. But – as we’ve seen – all it takes is one unresponsive/absent dependency owner to break the entire chain and keep things from moving forward.

I’m not sure I understand what’s going on here. Has it been updated and will be out in a future release?

@Sawtaytoes

No the native home assistant PiHole integration has not been updated, everyone just switched to newer plugin that someone else made: https://github.com/bastgau/ha-pi-hole-v6

I would like to also confirm that Bastgau HACS integration works perfectly and is very easy to set-up. My existing cards were all auto-updated, with no need to edit any of them.

Thank you!

Thanks for the new HACS v6 integration! I’m back up and running without having to tinker with my dashboard or automations.

Image

TBH, we don’t know what happened to shenxn, the developer of the previous PiHole Integration (which no longer works). Sometimes people get tired of maintaining their creations, sometimes life gets in the way (child being born, family calamity, cancer [ my own personal case, stage 4 ]), or just overwhelmed w/ new job. Not a weepy violin tune from me, but it is just how it is…

Sorry to hear about your illness, and I don’t disagree that things happen that get in the way of maintaining these integrations, especially as many are done on a volunteer basis. What is frustrating is having no sort of fallback process for when that happens. Part of making something an official integration vs something in HACS should be a more robust process for when these things come up. Some way to escalate, transfer ownership, etc. Again even so much as having somebody pop in and say, “yes, we see you, we are trying to find somebody to work on the issue”. To me, that would be enough.

There was even a PR created a couple of weeks ago that would likely resolve the issue, but without having somebody to approve and merge it, we’re still stuck.

at the end of the day there is no difference between HACS and Official integrations

The Home Assistant core repo has much more stringent standards for its code, which includes the official plugins. While this is nice and good for code quality, I can totally understand how it might make a maintainer less likely to want to come back to it.

HACS integrations, each in their own repos have no such standard of code quality. It’s basically, “you get what you get and you don’t get upset”. But at the same time, a plugin implementation can be rolled out very quickly, as is the case with the new pi-hole, HACS-based plugin.

There is good and bad with both models.

note : I use shields, which is actually the dns blocking, please don’t get confused. Right now, only blocking enable/disable works, I haven’t integrated live status of pihole dns blocking (though u can see the rest api in configuration below).

Configuration

# in configuration.yaml
# this is the shield button.
input_boolean:
  pihole_blocking_button:
    name: Pi-hole Blocking Button
    initial: on

Also you have to make some more inputs in helper

  1. Pihole Blocking Disable Input - of type input number - for setting the seconds to be disabled.
  2. Pihole disable blocking timer - of type timer - to show countdown of pihole shields down.
# in configuration.yaml
rest:
  #  Pihole stats sensors (the top 5 in image)
  - resource_template: "http://pi.hole/api/stats/summary"
    verify_ssl: false
    method: GET
    timeout: 10
    scan_interval: 10
    sensor:
      - name: "Total Queries"
        value_template: "{{ value_json.queries.total }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_total_queries"
  
      - name: "Blocked Queries"
        value_template: "{{ value_json.queries.blocked }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_blocked_queries"
  
      - name: "Blocked %"
        value_template: "{{ value_json.queries.percent_blocked | round(2) }}"
        unit_of_measurement: "%"
        unique_id: "pi_hole_percent_blocked"
  
      - name: "Queries Forwarded"
        value_template: "{{ value_json.queries.forwarded }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_forward_queries"
  
      - name: "Queries from Cache"
        value_template: "{{ value_json.queries.cached }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_cached_queries"
  
  #  Pihole update status sensors (the bottom 3)
  - resource_template: "http://pi.hole/api/info/version"
    verify_ssl: false
    method: GET
    timeout: 10
    scan_interval: 10
    sensor:
      - name: "Pihole Core"
        unique_id: "pi_hole_core"
        value_template: >-
          {% if value_json.version.core.local.hash == value_json.version.core.remote.hash %}
            {{ value_json.version.core.local.version }}
          {% else %}
            {{ value_json.version.core.local.version }} -> {{ value_json.version.core.remote.version }}
          {% endif %}
  
      - name: "Pihole Web"
        unique_id: "pi_hole_web"
        value_template: >-
          {% if value_json.version.web.local.hash == value_json.version.web.remote.hash %}
            {{ value_json.version.web.local.version }}
          {% else %}
            {{ value_json.version.web.local.version }} -> {{ value_json.web.version.remote.version }}
          {% endif %}
  
      - name: "Pihole FTL"
        unique_id: "pi_hole_ftl"
        value_template: >-
          {% if value_json.version.ftl.local.hash == value_json.version.ftl.remote.hash %}
            {{ value_json.version.ftl.local.version }}
          {% else %}
            {{ value_json.version.ftl.local.version }} -> {{ value_json.version.ftl.remote.version }}
          {% endif %}
  
  # Pihole dns blocking status sensor, haven't used it, will do for showing live status of dns by changing the state of shield button.
  - resource_template: "http://pi.hole/api/dns/blocking"
    verify_ssl: false
    method: GET
    timeout: 10
    scan_interval: 10
    sensor:
      - name: "DNS Blocking"
        unique_id: "pi_hole_dns_blocking"
        value_template: "{{ value_json.blocking }}"
# in configuration.yaml

# for setting pihole dns blocking enable/disable
shell_command:
  pi_hole_blocking: >
    curl
    -sX POST 'http://pi.hole/api/dns/blocking'
    -d '{"blocking": {{ blocking | default(true) | to_json }} ,"timer": {{ timer | default(null) | to_json }} }'

Automation

# For when the shield button is turned off (by default it will be on, from above configuration.yaml)
alias: Pihole Disable Blocking
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_boolean.pihole_blocking_button
    to: "off"
    from: "on"
conditions: []
actions:
  - action: shell_command.pi_hole_blocking
    data:
      blocking: false
      timer: |-
        {% if states('input_number.pihole_blocking_disable_input') | int > 0 %}
          {{ states('input_number.pihole_blocking_disable_input') | int }}
        {% else %}
          null
        {% endif %}
  - if:
      - condition: numeric_state
        entity_id: input_number.pihole_blocking_disable_input
        above: 0
    then:
      - target:
          entity_id: timer.pihole_disable_blocking_timer
        data:
          duration: "{{ states('input_number.pihole_blocking_disable_input') | int }}"
        action: timer.start
      - delay: "{{ (states('input_number.pihole_blocking_disable_input') | int) + 2 }}"
      - target:
          entity_id: input_boolean.pihole_blocking_button
        action: input_boolean.turn_on # this triggers the button on automation.
        data: {}
      - action: input_number.set_value
        target:
          entity_id: input_number.pihole_blocking_disable_input
        data:
          value: 0
mode: single
# For when the shield button is turned on
alias: Pihole Enable Blocking
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_boolean.pihole_blocking_button
    to: "on"
    from: "off"
conditions: []
actions:
  - action: shell_command.pi_hole_blocking
    data:
      blocking: true
      timer: null

Core [v6.0.4] FTL [v6.0.2] Web interface [v6.0.1] No PASS

test in JSON format:

curl -X GET "http://IP_Pi-Hole/api/stats/summary"

rest:
  - resource_template: "http://**IP_Pi-Hole**/api/stats/summary"
    verify_ssl: false
    method: GET
    headers:
      sid: "null"
    timeout: 10
    scan_interval: 600
    sensor:
      - name: "Total Queries"
        value_template: "{{ value_json.queries.total }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_total_queries"

      - name: "Blocked Queries"
        value_template: "{{ value_json.queries.blocked }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_blocked_queries"
  
      - name: "Blocked %"
        value_template: "{{ value_json.queries.percent_blocked | round(2) }}"
        unit_of_measurement: "%"
        unique_id: "pi_hole_percent_blocked"
  
      - name: "Queries Forwarded"
        value_template: "{{ value_json.queries.forwarded }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_forwarded_queries"
  
      - name: "Queries from Cache"
        value_template: "{{ value_json.queries.cached }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_cached_queries"

      - name: "Active Clients"
        value_template: "{{ value_json.clients.active }}"
        unit_of_measurement: "clients"
        unique_id: "pi_hole_active_clients"

      - name: "Total Clients"
        value_template: "{{ value_json.clients.total }}"
        unit_of_measurement: "clients"
        unique_id: "pi_hole_total_clients"

      - name: "Blocked Domains"
        value_template: "{{ value_json.gravity.domains_being_blocked }}"
        unit_of_measurement: "domains"
        unique_id: "pi_hole_blocked_domains"

      - name: "Last Gravity Update"
        value_template: "{{ value_json.gravity.last_update | timestamp_custom('%Y-%m-%d %H:%M:%S') }}"
        unit_of_measurement: "datetime"
        unique_id: "pi_hole_last_gravity_update"

      - name: "NXDOMAIN Queries"
        value_template: "{{ value_json.replies.NXDOMAIN }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_nxdomain_queries"

      - name: "A Records"
        value_template: "{{ value_json.queries.types.A }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_a_records"

      - name: "AAAA Records"
        value_template: "{{ value_json.queries.types.AAAA }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_aaaa_records"

      - name: "SERVFAIL Queries"
        value_template: "{{ value_json.replies.SERVFAIL }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_servfail_queries"

      - name: "Blocked by Denylist"
        value_template: "{{ value_json.queries.status.DENYLIST }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_blocked_by_denylist"

      - name: "Refused Queries"
        value_template: "{{ value_json.replies.REFUSED }}"
        unit_of_measurement: "queries"
        unique_id: "pi_hole_refused_queries"

hey folks!

I’m not sure flooding this issue with more “it’s broken now” kind of replies will do any good. subscribe to the issue using this button

<img alt=“Image” width=“423” src="https://private-user-images.githubusercontent.com/112706/414429314-4c7cd960-822a-4efc-a514-9bc87cab3755.png?

Basically a good point.

I guess someone from the Core team is aware but since there is a fix (e.g. do no upgrade yet), this issue might not be a priority soon

  1. Not sure if someone is aware, I did not check the whole issue and all involved users precisely.
  2. Which fix? Not upgrading is one which will likely not work for the majority of users. They’ll upgrade Pi-Hole, discover the integration is broken, and find this issue.
  3. Therefore I think this issue will be a priority soon. At least it should. Looking at Pi-Hole and HA history there’s not much HA core inner motivation, so the only priority comes from (affected) users.

Feel free to minimize this comment as it does not add anything substantial to fix this issue. It just puts the issue’s relevance into context.

Doesn’t help that PiHole wont let you roll back to v5 easily. Then since this issue was raised in November when the first beta’s came out its not like this comes as a surprise.

Without a release tag, it cannot be included through pip/uv (technically it could but all HA requirements are referenced using release tags). Also the HA pihole integration code needs to reflect that users must choose if they’re using v5 or v6 of Pihole. So it’s not a mere replacement of the underlying hole lib.

Since Pi-hole v5 isn’t supported by Pi-hole developers anymore due to v6 being released the v5 HA Integration should likely be removed.

Pi-hole v5 is basically EOL at this point.

NordFreak, please ping back if you find the “buyacoffee link”. I’m grateful.

TBH, we don’t know what happened to shenxn, the developer of the previous PiHole Integration (which no longer works). Sometimes people get tired of maintaining their creations, sometimes life gets in the way (child being born, family calamity, cancer [ my own personal case, stage 4 ]), or just overwhelmed w/ new job. Not a weepy violin tune from me, but it is just how it is…

On Thu, Mar 6, 2025 at 2:34 AM NordFreak @.***> wrote:

I have implemented the new Pi-home API inside a custom integration available here : https://github.com/bastgau/ha-pi-hole-v6

Only a few main sensors and two services to enable or disable blocking are currently implemented.

thanks for your work, pihole v6 is working with the new core version of ha.

i’m searching for your buyacoffee link 😉

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/130245#issuecomment-2703157865, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANA3ZVJ3F3H3TAS5MFUPO32TACBPAVCNFSM6AAAAABRPOYGTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMBTGE2TOOBWGU . You are receiving this because you commented.Message ID: @.***> [image: NordFreak]NordFreak left a comment (home-assistant/core#130245) https://github.com/home-assistant/core/issues/130245#issuecomment-2703157865

I have implemented the new Pi-home API inside a custom integration available here : https://github.com/bastgau/ha-pi-hole-v6

Only a few main sensors and two services to enable or disable blocking are currently implemented.

thanks for your work, pihole v6 is working with the new core version of ha.

i’m searching for your buyacoffee link 😉

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/130245#issuecomment-2703157865, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANA3ZVJ3F3H3TAS5MFUPO32TACBPAVCNFSM6AAAAABRPOYGTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMBTGE2TOOBWGU . You are receiving this because you commented.Message ID: @.***>

at the end of the day there is no difference between HACS and Official integrations

The last piece to the puzzle, syncing button to pihole dns blocking status –

alias: Sync Pi-hole Blocking State with Button
description: >-
  Watch sensor.dns_blocking changes and update
  input_boolean.pihole_blocking_button without triggering its automation.
triggers:
  - entity_id: sensor.dns_blocking
    trigger: state
conditions: []
actions:
 # this is custom notification service I use, you can remove it if you want
  - action: shell_command.ntfy
    data:
      title: Pi-Hole
      message: DNS Blocking is {{ trigger.to_state.state }}.
      icon: https://wp-cdn.pi-hole.net/wp-content/uploads/2016/12/Vortex-R.png

# the main automation starts from here.
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.from_state.state == 'disabled' and
              trigger.to_state.state == 'enabled' }}
        sequence:
          - action: automation.turn_off
            metadata: {}
            data:
              stop_actions: false
            target:
              entity_id: automation.pihole_enable_blocking
          - target:
              entity_id: input_boolean.pihole_blocking_button
            action: input_boolean.turn_on
            data: {}
          - action: automation.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: automation.pihole_enable_blocking
      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.from_state.state == 'enabled' and
              trigger.to_state.state == 'disabled' }}
        sequence:
          - action: automation.turn_off
            metadata: {}
            data:
              stop_actions: false
            target:
              entity_id: automation.pihole_disable_blocking
          - target:
              entity_id: input_boolean.pihole_blocking_button
            action: input_boolean.turn_off
            data: {}
          - action: automation.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: automation.pihole_disable_blocking
mode: single

I ditched this integration and went to the way of controlling pihole via restful integration. So far I have successfully setup pihole stats. Now working on controlling pihole using restful command integration.

Image

Я успешно реализовал поддержку API Pi-hole v6 в оригинальной библиотеке Python python-hole . Основные изменения включают в себя:

  • Обновлена ​​конечная точка API с pi.hole/admin/apiнаpi.hole/api
  • Добавлена ​​совместимость с новым форматом ответа API v6.
  • Поддерживается обратная совместимость.
  • Добавлен пример кода, демонстрирующий новую функциональность.

Изменения в настоящее время находятся в стадии PR и могут быть использованы для внедрения аналогичных обновлений в интеграции Home Assistant. Ключевым изменением было обновление базовой конечной точки API и корректировка анализа данных для соответствия структуре API v6.

Не стесняйтесь ознакомиться с реализацией для справки: https://github.com/LeonKohli/python-hole/pull/new/feature/v6-api

how to use this?

V6 is here https://pi-hole.net/blog/2025/02/18/introducing-pi-hole-v6

Image

Luckily I was having that “let’s see if HA side is ready for that major release” thought and found this issue very quickly. Unfortunately it seems like there’s not a solution for the Pi-Hole integration yet. What a pity 😦

So I can and will simply not upgrade Pi-Hole until HA has adopted to the V6 API changes (if that’s the only change needed).

Looking at the diagnostics you can download from the integration in Home Assistant, I see there following in the JSON file:

"versions": {
      "error": {
        "key": "bad_request",
        "message": "Bad request",
        "hint": "The API is hosted at pi.hole/api, not pi.hole/admin/api"
      },
      "took": 0.000858306884765625
    }

So it looks like it the api URL has changed at least. Hope this helps for any updates to the integration.

so 2025.4.4 is not yet fixing this issue? just updated and still cannot integrate my PiHole v6 😦

I’m not sure anyone is working on fixing it?? Instead, you should switch to @bastgau new unofficial v6 integration which is easily installed via HACS (it’s really very good).

https://github.com/bastgau/ha-pi-hole-v6

I’d suspect a replacement for the official integration would need to both support v5 and v6 to be compatible with existing installations that might still connect to a pihole 5 instance. You wouldn’t want to break those installations on a Home Assistant update.

What would be nice, but don’t know if it is possible, is an addition to the https://www.home-assistant.io/integrations/pi_hole/ site to add an info box that this only works with pihole v5 and have a link to the custom integration for v6 users. Might make it easier to discover and solve issues for users that update their pihole instance.

Keep in mind, to disable for ‘n’ seconds, please input value first (0 for indefinite), then toggle the switch to off.

the lovelace card…

type: vertical-stack
cards:
  - type: conditional
    conditions:
      - condition: state
        entity: timer.pihole_disable_blocking_timer
        state_not: idle
    card:
      type: tile
      entity: timer.pihole_disable_blocking_timer
      show_entity_picture: false
      vertical: false
      hide_state: false
      name: ETA until Pihole Shield will be UP...
  - type: horizontal-stack
    cards:
      - type: tile
        entity: sensor.pi_hole_total_queries
        name: Total
        show_entity_picture: false
        vertical: false
        hide_state: false
  - type: horizontal-stack
    cards:
      - type: tile
        entity: sensor.queries_forwarded
        color: primary
        name: Forwarded
      - type: tile
        entity: sensor.queries_from_cache
        color: green
        name: From Cache
  - type: horizontal-stack
    cards:
      - type: tile
        entity: sensor.pi_hole_blocked_queries
        color: red
        name: Blocked
      - type: tile
        entity: sensor.pi_hole_percent_blocked
        color: red
  - type: entities
    entities:
      - entity: input_boolean.pihole_blocking_button
        name: Pihole Shield
        icon: mdi:shield-home
      - entity: input_number.pihole_blocking_disable_input
        name: Disable for
  - type: entities
    entities:
      - entity: sensor.pihole_core
        icon: mdi:update
        name: Core
      - entity: sensor.pihole_web
        name: Web
        icon: mdi:update
      - entity: sensor.pihole_ftl
        name: FTL
        icon: mdi:update
title: Pihole

This looks good. Thank you for sharing!

I will test it. Hopefully this can replace the current core integration of pi-hole.

It’s just a craft integration.

  • The tests are improvable.
  • Backward compatibility with older versions of HA is non-existent.
  • SSL support has not been tested.

Just sharing in response to my own need.

Correct. I tested it out in Home Assistant this weekend.

Then I realized I can’t run Gravity with the official version and went back to my unofficial integration 😕.

so 2025.4.4 is not yet fixing this issue? just updated and still cannot integrate my PiHole v6 😦

I’m not sure anyone is working on fixing it?? Instead, you should switch to @bastgau new unofficial v6 integration which is easily installed via HACS (it’s really very good).

https://github.com/bastgau/ha-pi-hole-v6

done, thanks for the hint 😉

you should switch to @bastgau new unofficial v6 integration which is easily installed via HACS (it’s really very good).

https://github.com/bastgau/ha-pi-hole-v6

I held out hope for a long time that the official integration would get updated, but it seems that the owner of the python-hole repo isn’t very active or responsive, so I bit the bullet and switched to the unofficial integration. Works like a charm and has all the same functionality that the official one did.

@ccheath in stable the earliest you will see it is in 2025.4 which is scheduled for 2nd April (first Wednesday of the month). there is however no guarantee that it will be included at this stage. There is a process and its happening.

On the other hand it optimizes a suboptimal situation. My previous post was about a technical and communications solution on this. In short: what is happening with this broken and unmaintained, still labeled as official/core integration.

I don’t know why this is “on the other hand” – short of a dev stepping up to make the official integration compatible with both v5 and v6, or even pulling a v6 version together under HA’s official process as a breaking change (honestly, that’s probably the most viable approach, since the two are so very different), this is the best solution we could hope for… short of full removal of the v5 version from ha-core.

Hey!

Is the minimal HA version needed (2025.3.x) for technical reasons or can it be tweaked to be used in previous HA versions?

@bastgau maybe you can answer that remaining question. Thanks a lot 👍

The integration development was based on the HA beta version 2025.03.

When I installed the integration on HA 2025.02 an error occurs and I have not tried to resolve it 🤣

After that, I made the integration publicly available.

Otherwise on a long-term view I’m only highly interested in what happens with this official/core integration.

  • Will it get removed from core?
  • Will @bastgau’s custom one replace/become the official one? Who would be the new maintainer?

There are many constraints (or there should be) to being an official integration. I prefer to maintain a custom integration.

In my opinion, all core integrations should be gold or more : https://www.home-assistant.io/docs/quality_scale/

Thanks for the new HACS v6 integration! I’m back up and running without having to tinker with my dashboard or automations.

Image

Can you point me to that card?

Does anyone have a suggestion for why i dont get anything out of the integration?

Image

(edit) It is bastgau’s new integration, and i am logged on the Pi-hole API with Home Assistant

Image

Click on ADD SERVICE Depending on whether or not you’re using SSL, it’d be either http or https

Try http://XXX.XXX.XXX.XXX:8080/api

Your port might also be 80 (instead of 8080, in this case)

Does anyone have a suggestion for why i dont get anything out of the integration?

Image

(edit) It is bastgau’s new integration, and i am logged on the Pi-hole API with Home Assistant

Image

I don’t plan to submit my work to become the official basic version, as there are a lot of constraints. Maintaining an alternative version seems simpler, even if one day it may become deprecated because of an official version. That’s life 😄

Don’t hesitate to help me for translation or new ideas.

@NordFreak @davygravy : Just added a buyacoffee link 😉

The stronger likelihood is they pull the official integration out if the current code owner doesn’t make any moves to update it.

Some of these smaller integrations are throwbacks to when there wasn’t a HACS option.

I don’t plan to submit my work to become the official basic version, as there are a lot of constraints. Maintaining an alternative version seems simpler, even if one day it may become deprecated because of an official version. That’s life 😄

Don’t hesitate to help me for translation or new ideas.

@NordFreak @davygravy : Just added a buyacoffee link 😉

Or even better: make the HACS one the new official one. (Currently functionality and speed is in focus of course. In a few weeks stability (= core integration) should become a priority in my opinion.)

Do you have a link to that HACS version?

https://github.com/bastgau/ha-pi-hole-v6

OHHHH, I thought you meant the official core integration. Yes, the HACS one works great.

My opinion: Forget the official one. Take the HACS version 😉

I’m running the latest, just updated to 2025.03 today, and it’s still not working for me. The HACS integration works however.

But then I would think you have a completely different problem. With the new core and the new version of here: https://github.com/bastgau/ha-pi-hole-v6 (I installed it via HACS) it worked right away. Even better than the old integration.

What exactly is your error? What do the logs say?

OHHHH, I thought you meant the official core integration. Yes, the HACS one works great.

No offense to the guys creating these workarounds, as they are great, but it’s kind of ridiculous that this is an official HA integration and the core team is entirely MIA. I understand these things take time and the teams are small, but at least some acknowledgement that it’s an issue would be nice

Absolutely true, their integrations are just like in HACS when the developer doesn’t take care of them nothing works they need to write everywhere that they will only work if the community takes care of it, I reported a bug in the integration for more than half a year no one is doing anything about it, and I got a reply that they are working hard on it and there has been no change for half a year XDDD, I expect hate without argument.

Hello.

I have implemented the new Pi-home API inside a custom integration available here : https://github.com/bastgau/ha-pi-hole-v6

Only a few main sensors and two services to enable or disable blocking are currently implemented.

*/!* The Home Assistant v2025.03 is required to use the integration (released next week).

This looks good. Thank you for sharing!

I will test it. Hopefully this can replace the current core integration of pi-hole.

For a PiHole 6 integration, I’m hoping to see more integration with the PiHole API to allow for advanced scenarios.

One scenario I’d like to be able to tackle is conditionally enabling/disabling groups on the PiHole. I use this to block certain websites at certain times (eg: YouTube on devices the kids have access to, such as tv’s, while they are not at school). With PiHole 5 there’s no API to do this, I do it by executing SQLite commands via SSH and updating HA entities to report state, but it looks to be achievable via the new APIs that are available.

At the very least, having actions that can be called to pull the state of a group and update group states would be a good first step.

@NordFreak - Probably best to take this off of this thread and into a new issue https://github.com/user-08-151/hole_v6/issues/new. ~Though, I am also running into the same problem.~

Edit: ~See https://github.com/user-08-151/hole_v6/issues/1~ Make sure to use your password rather than API key here.

In addition to that, docs can be found here: https://ftl.pi-hole.net/development/docs/

@shenxn I can confirm @Marcoevich’s issue as well. Fresh install of Pihole v6 with its new API is completely broken.

Pull request updated and ready for review again

Thanks for the link!

Why isn’t Home Assistant swapping the integration in favor of the new one that works better? Do they want Core Integrations that don’t work?

@Sawtaytoes

Its likely that they have many issues and things they have to focus on right now, and this is probably a low priority especially since the community already has “a fix”.

But seeing as this ticked has been open since [Nov 9, 2024], (6 months and 6 days ago) perhaps there arent any core homeassistant developers right now using pihole toggles in their own setup 🤷

The current status is still that the library had the fix merged but has not yet had a release which is needed for it to filter down the chain. there is an issue about creating a release here https://github.com/home-assistant-ecosystem/python-hole/issues/31

Support for both V5 and V6 would be trivial for now as there are still a lot of devices with V5 in production.

I have not received any reply for my attempts to contact @shenxn. I am afraid this repo is abandoned by its author.

@frenck sorry to ping you directly, but what happens when an integration is abandoned by its author? Would it be possible for someone else to become the code owner?

Assume you never heard from @frenck or @shenxn . The python library being updated should resolve but looking at this thread there are many who would contribute but like an untended part of your lawn it goes to weeds making the whole lawn look untidy (i.e. my wife liked being able to use Home Assistant to turn on ads and gave me grief). I can count a meaningful percentage of abandoned integrations in the CORE and thats like leaving old farm equipment to rot in the field. Prolly doesnt hurt but you have to plow around it and people notice it. Dont want to see Home Assistant get crushed by its own weight.

The python-hole dependency now officially supports v6, as the pull request has finally been merged: https://github.com/home-assistant-ecosystem/python-hole/pull/29#event-16980813327

Merged != released

Hey!

Is the minimal HA version needed (2025.3.x) for technical reasons or can it be tweaked to be used in previous HA versions?

@bastgau maybe you can answer that remaining question. Thanks a lot 👍

The integration development was based on the HA beta version 2025.03.

When I installed the integration on HA 2025.02 an error occurs and I have not tried to resolve it 🤣

After that, I made the integration publicly available.

Just as a FYI for anyone who tried this initially on 2025.02 (I suspect there are very, very few), I installed the beta integration while on 2025.02 and encountered some errors. This was before the minimum version was fixed to 2025.03 only.

After upgrading to 2025.03, I ran into an odd “Unknown error” issue that would not allow the integration to work properly.

It turns out I started too many active sessions on my pi-hole while on 2025.02. I needed to go to pihole Web Interface - API Settings and delete the multiple old active sessions to get it to work.

100 % agree, an official integration should support both v6 and <v6 setups.

That docs edit is easily possible (done similar edits few times already) - once someone approves the PR. I think that’s a good idea and would probably also pin this thread so it is more easily discoverable in the issues section (Gitahub + official docs: best thing possible, next to maybe releasing a new version without any changes but putting a hint in the release notes, maybe promoting the custom integration).

On the other hand it optimizes a suboptimal situation. My previous post was about a technical and communications solution on this. In short: what is happening with this broken and unmaintained, still labeled as official/core integration.

Thank you @bastgau Works out of the box!

Just swapped over to @bastgau Pi-Hole-V6 integration, didn’t even have to change anything on the dashboard, just worked ! Removed the old “official” integration, added new via HACS and back in action. Image Will be sticking to this going forward

Two questions comparing @bastgau 's custom integration to the official (broken) one here:

  1. Is it a drop-in replacement in terms of providing 1:1 exactly the same entities (sensors, switches etc.)?
  2. Is the minimal HA version needed (2025.3.x) for technical reasons or can it be tweaked to be used in previous HA versions?

For me, it was a 100% drop-in replacement, as per the image everything I needed worked on my dashboard for PI-Hole. I can’t comment on the minimum version required as I’m running 2025.3+

http://XXX.XXX.XXX.XXX:80/api

Thanks!! my mistake was not adding http: I just copied from the old setup

Glad it worked.

http://XXX.XXX.XXX.XXX:80/api

Thanks!! my mistake was not adding http: I just copied from the old setup

On devrait lui acheter des cafés ☕️!    Your choice is yours… I bought him a few coffees. 👍🙏☕️Sent from my iPhoneOn Mar 8, 2025, at 10:36 AM, Rick @.> wrote: @bastgau You are the best. This new integration works perfectly 🥳🙏—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.>

Marcoevich left a comment (home-assistant/core#130245) @bastgau You are the best. This new integration works perfectly 🥳🙏

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

@bastgau You are the best. This new integration works perfectly 🥳🙏

Is there a way to include blocked queries in the custom integration? Oh and the visit button on the device page should probably take me the url without the /api part, just a thought @bastgau

Please open a new issue if you need new features 😉

I don’t plan to submit my work to become the official basic version, as there are a lot of constraints. Maintaining an alternative version seems simpler, even if one day it may become deprecated because of an official version. That’s life 😄

Don’t hesitate to help me for translation or new ideas.

@NordFreak @davygravy : Just added a buyacoffee link 😉

https://github.com/bastgau/ha-pi-hole-v6/issues/2#issue-2888750805

I would like to inform you that the Pi-hole V6 integration is not compatible with versions of Home Assistant prior to 2025.03.

Originally, this integration was developed specifically to meet my personal needs and is based on the source code of version 2025.03.

I’m running the latest, just updated to 2025.03 today, and it’s still not working for me. The HACS integration works however.

But then I would think you have a completely different problem. With the new core and the new version of here: https://github.com/bastgau/ha-pi-hole-v6 (I installed it via HACS) it worked right away. Even better than the old integration.

What exactly is your error? What do the logs say?

I have implemented the new Pi-home API inside a custom integration available here : https://github.com/bastgau/ha-pi-hole-v6

Only a few main sensors and two services to enable or disable blocking are currently implemented.

thanks for your work, pihole v6 is working with the new core version of ha.

i’m searching for your buyacoffee link 😉

Just a small correction for the version template

 - name: "Pihole Web"
        unique_id: "pi_hole_web"
        value_template: >-
          {% if value_json.version.web.local.hash == value_json.version.web.remote.hash %}
            {{ value_json.version.web.local.version }}
          {% else %}
-            {{ value_json.version.web.local.version }} -> {{ value_json.web.version.remote.version }}
+            {{ value_json.version.web.local.version }} -> {{ value_json.version.web.remote.version }}
          {% endif %}

In addition to that, docs can be found here: https://ftl.pi-hole.net/development/docs/

I’m getting this error when trying to install: “This version requires Home Assistant 2025.2.9 or newer.” I’m on the latest 2025.2.5.

You either need the latest beta version 2025.3.0b0 or wait till next week when 2025.3.0 is officially released.

Since changes seem to be required for both the integration and the underlying library, I put togehter a POC (https://github.com/user-08-151/hole_v6) which works for my HA instance togehter with my PiHole v6 instance.

hey @user-08-151 !

Thank you for sharing this with us. I have also integrated this directly and am now integrating it. However, when I try to connect, I get the error below.

Do you have a tip for me?

[%key:common::config_flow::error::cannot_connect%]

Image

I installed pihole for first time today (v6 - WOW! so far) and also encountered this issue when using the addon.

seems like the code owner for this integration has abandoned it; so now there is a fork to fix it.

Looks like this fork https://github.com/mastermc0/python-hole/commit/ee5cd890e19f835727bba963d5d9d1d672bf0081 has a hole API update with fallback in place

I tested that fork and it still doesn’t work. It doesn’t handle the session properly. I tested the package by itself with the “example.py” file and no luck.

I’ll see if I can get it working and submit a PR.

I dug into this today and it looks like the issue is very likely to be related to the hole package, which is a dependency that is used to make the actual api call. It doesn’t look like the package has been updated for v6.

Doesn’t help that PiHole wont let you roll back to v5 easily. Then since this issue was raised in November when the first beta’s came out its not like this comes as a surprise.

Mine rolled back ok. Started with a teleport/backup before doing the docker image pull. After I decided to roll back, just change:

docker pull pihole/pihole:latest
to
docker pull pihole/pihole:2024.07.0

Then teleport/restore. I think I had to manually restart DHCP, but it’s back to how it was an hour ago.

the padd endpoint might be a good starting point as well.

it’s what is used for PADD to reduce the number of API calls. Should give enough data to provide a small dashboard in home assistant.

Since the integration maintainer @shenxn seems to be not responding, what can we do to get this fixed? Can we get someone to take over the integration?