Pi-Hole Integration not working

Hello. I have Home Assistant running on a Pi-400. I have two Pi 3b+ running Pihole. I added the Pi-Hole integration to Home Assistant, referenced the two Piholes by IP address, or by machine name. I can see that the core update, web update, and FTL update are all showing, and updating. But nont of the other statistics are being sent from the pi to Home Assistant. At one point in the past, this was working, but I havbe no idea why it recently stopped. Home ASsistant is latest version, as is Pi-Hole, and the OS that pihole is running on.

Any thoughts on where I should start to look to determine the issue?

There are some errors in the log, including the one below. I am unsure what I can do to fix this:

Logger: homeassistant.components.binary_sensor
Source: components/pi_hole/const.py:164
Integration: Binary sensor (documentation, issues)
First occurred: December 30, 2022 at 4:59:44 PM (30 occurrences)
Last logged: 12:50:47 AM

  • Error adding entities for domain binary_sensor with platform pi_hole
  • Error while setting up pi_hole platform for binary_sensor
  • pi_hole: Error on device update!
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 692, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 789, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state if (state := self.state) is None: File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 211, in state if (is_on := self.is_on) is None: File "/usr/src/homeassistant/homeassistant/components/pi_hole/binary_sensor.py", line 87, in is_on return self.entity_description.state_value(self.api) File "/usr/src/homeassistant/homeassistant/components/pi_hole/const.py", line 164, in <lambda> state_value=lambda api: bool(api.data.get("status") == "enabled"), AttributeError: 'list' object has no attribute 'get'
1 Like

A known issue in a python dependency. It is solved already and waiting for an HA-core update with the dependency update.

5 Likes

Oh, thank you for the info, I can put this one aside. I am new to HA, and still dealing with a lot of my devices that have intermittent issues, and am still looking for the best places to discover documentation, issue lists, etc. Thanks for the link.

Updated my Pi-Hole installation today before seeing this; at least it’s a known issue. As a side note, the package version integrations are still working.

Quick report to say the update today fixed this for me.
Home Automation 2023.1.0

Upgraded to 2023.1.0 and is looks to have broken my Pi-Hole integration with the reported error messages above.

Pi-Hole is up to date (5.14.2).

Working here.

Pi-Hole Integration 2022.12 was broken with Pi-Hole Web-Interface 5.18 (current) but returned working with 2023.1:

  • go to the Pi-Hole Admin interface → Settings : Tab “API / Web Interface”. There, click on “Show API Token”, confirm and copy the API key below the QR code to clipboard
  • go to Home Assistant and remove the Pi-Hole integration instance (if present)
  • re-add a Pi-Hole integration instance, provide Pi-hole host’s details and uncheck the Statistics checkbox
  • in the next step, provide the API key you just copied to clipboard.

This way Pi-Hole integration came back to life, using HA 2023.1.0 and Pi-Hole 5.14.2 / 5.18 Admin Interface

10 Likes

I have two Pi-holes and installed the integration as per @m0wlheld – the primary Pi-hole added and worked fine. The secondary one (same subnet, different IP of course) fails to be reachable, although I can ping it fine, update it and access it otherwise. But HA refuses to “see” it when trying to add the second instance.

Any ideas?

Just to add to this, I had to do the same with HA:2023.1.1 and PiHole 5.14.2 / 5.18 Admin
Thanks very much for the post.

1 Like

I just spent over an hour trying to find this answer, it should definitely be added to the documentation for initial set up!

1 Like

This new method works for a “true” pi DNS-hole. But for my DNS-hole running in a Synology NAS container it does not. It has worked till late december. On the first Pi DNS-hole integration indeed a API key question comes on. And connects and works. But the DNS-hole in a container Docker Tag [2023.01.10] it keeps on failing to connect. no more error than “can not connect”. I’m not aware of any debug capability to find more explanation (log) on this error why this fails.
any help/clue… or is container acces integration no longer working as of the different port used as the default 80??

I have it working in Proxmox container (lxc) without any problem to have it displayed in HA. At least I could insert the API key and it worked strayed away. So it is not only for “true” pi DNS-hole like you mentioned. There must be something else on your NAS preventing you to connect.

No clue where to debug as the “real Pi” does work, asked on API key and the integration is running.
On the NAS no events, no firewal alerts. the admin gui works. the DNS-hole works. But the integration fails to come up with the question on the API key.
Anyone a clue how get this moving?
H.A. log shows:
2023-01-29 12:45:13.492 ERROR (MainThread) [hole] Can not load data from *hole: 10.10.100.93:8036
2023-01-29 12:45:14.615 ERROR (MainThread) [hole] Can not load data from *hole: 10.10.100.93:8036
2023-01-29 12:45:15.082 ERROR (MainThread) [hole] Can not load data from *hole: 10.10.100.93:8036
2023-01-29 12:45:26.197 ERROR (MainThread) [hole] Can not load data from *hole: http://10.10.100.93:8036
Even with the statistics box clicked it does not move on in the registration.
Before I removed the config to add the api key, both DNS-hole were active in my H.A. I set up H.A. alarms e.g. when there was a new version message. This worked ok. the only thing that broke was as of december the stat’s no longer working - as expected - as of the new access to the admin menu.

— RESOLVED –
The locatie must be left admin, so not the true location but the “Admin” access :slight_smile: is ment here. Please update documentation on this point.

I am trying to figure out how/where to add the API key when setting up da Pi-Hole integration instance. I don’t have a “Statistics” checkbox, at least I can’t see one.

Its in the next step

What do you think needs amending on which specific page?

There is no second step. Once I hit “Absenden”, the integration is created. I’m not asked to type in an API key.

Maybe I am reading it wrong.

And does it work?