Monitoring 2 Pi-Hole Servers in 0.99+

HI All

I have upgraded from 0.98.5 to 100.3 and as part of that there is a breaking change where the pi_hole monitor moves from been a sensor to its own component.
I have been using 2 Pi-Holes as primary and secondary DNS and this worked quiet well
Below is my old sensor config

sensor:
 - platform: pi_hole
   host: 192.168.1.20
   monitored_conditions:
      - xxx
 - platform: pi_hole
   host: localhost:4865
   monitored_conditions:
    - xxx

Anyway as I migrated up to 0.100 i adjusted my settings to the new config.

pi_hole:
  host: 'localhost:4865'

I was able to get this working however whenever I add the second server to monitor like below:

pi_hole:
  host: 'localhost:4865'
  host: 192.168.1.20

It doesn’t like it.
So my question is, Is it possible to monitor more than one pi-hole with the new component.

As I said, I have been using two pi-hole sensors for quiet a while and have not had any issues.
Cheers

follow, i’ve 2 pi hole servers and i can’t configure it

Have a look at this issue I rasied. You can crete a temporary custom component untill it is fixed.

news of it?

I’m not sure when it changed, but as of today, the Pi-Hole integration documentation says that you can add multiple Pi-Hole hosts.

From Pi-hole - Home Assistant

Multiple Pi-holes:

pi_hole:
  - host: '192.168.0.2'
  - host: '192.168.0.3'
    name: 'Secondary Pi-Hole'

However, when I attempt to configure both of my Pi-Hole instances, I get a configuration file error:

Configuration invalid 
CHECK CONFIG
Invalid config for [pi_hole]: expected a dictionary for dictionary value @ data['pi_hole']. Got [OrderedDict([('host', '192.168.1.199'), ('name', 'Primary Pi-Hole'), ('api_key', 'xxx')]), OrderedDict([('host', '192.168.1.9:4865'), ('name', 'Secondary Pi-Hole')])]. (See /config/configuration.yaml, line 93). Please check the docs at https://home-assistant.io/integrations/pi_hole/

So I think an enhancement is coming, but needs to wait for an update to Home Assistant itself.

Try this:

pi_hole:
  - host: '192.168.0.4'
    name: 'dns-1'
    ssl: False
    verify_ssl: False
  - host: '192.168.0.7'
    name: 'dns-2'
    ssl: False
    verify_ssl: False

Yes, that’s the syntax that works once multiple hosts are allowed by the software.

My error is due to me not yet having updated to .104, which was announced yesterday, but had not yet shown up on my HA instance as an available update. (HASS.IO 3.8 has shown up, so maybe I need to do that update first.)

That’s entirely expected. I should have been more clear: this isn’t a problem I’m trying to solve, just a reply to the OP that the feature appears to be imminent.

Now working! saved config did not have the space between the - and host.

Has anyone tried this with .104.2? I tried it last night with 2 -host lines and it would not take the config after the reboot. It still appears not to be fixed.

Added per the doc at Pi-hole integration.

pi_hole:
  - host: '192.168.1.4'
  - host: '192.168.1.7'
    name: 'Pihole2'

The error in the configuration editor:

duplicated mapping key at line 106, column 3:
      -host: '192.168.1.7'
2 Likes