Python Plugin: PiHole Control
Moderator: leecollings
-
voyo
- Posts: 40
- Joined: Monday 17 February 2020 19:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Poland
- Contact:
Python Plugin: PiHole Control
hi
I've created new version of Pi-hole plugin for PiHole v6 API, based on Xorfor's original idea. ( viewtopic.php?t=20834 )
**Features:**
- Monitor Pi-hole statistics in real-time
- Control block lists as switches in Domoticz
- Auto-sync with Pi-hole (detects added/removed lists)
- Works with Pi-hole groups for ie. parental controls
**My use case:** Schedule kids' block lists - enable YouTube blocking during homework time, disable in the evening.
**Repo:** https://github.com/voyo/Domoticz_PiHole-Control
Works with Pi-hole v6.x. Tested on v6.1.2 + Domoticz 2024.7.
I've created new version of Pi-hole plugin for PiHole v6 API, based on Xorfor's original idea. ( viewtopic.php?t=20834 )
**Features:**
- Monitor Pi-hole statistics in real-time
- Control block lists as switches in Domoticz
- Auto-sync with Pi-hole (detects added/removed lists)
- Works with Pi-hole groups for ie. parental controls
**My use case:** Schedule kids' block lists - enable YouTube blocking during homework time, disable in the evening.
**Repo:** https://github.com/voyo/Domoticz_PiHole-Control
Works with Pi-hole v6.x. Tested on v6.1.2 + Domoticz 2024.7.
-
sloeber70
- Posts: 45
- Joined: Wednesday 08 July 2020 10:59
- Target OS: Linux
- Domoticz version: latest
- Location: Bruges
- Contact:
Re: Python Plugin: PiHole Control
Hi,
Nice work!!
Nice work!!
Kind regards,
Sloeber70
Linux Debian 13 standard edition
Domoticz latest beta on ProxmoxVE Virtual Machine
Sloeber70
Linux Debian 13 standard edition
Domoticz latest beta on ProxmoxVE Virtual Machine
-
WouterO
- Posts: 66
- Joined: Sunday 14 May 2023 19:23
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: PiHole Control
Impressive, especially the blocklist control via timed switches adds functionality to Pihole via Domoticz, originally not available in Pihole itself. I like that!
-
mark.sellwood
- Posts: 107
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Python Plugin: PiHole Control
Great work, I have added the plugin & configured, now in Domoticz I get switches for each of Lists & I can Enable / Disable
Is it possible to control the Groups listed on PiHole under Group Management?
Thanks
Is it possible to control the Groups listed on PiHole under Group Management?
Thanks
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
-
voyo
- Posts: 40
- Joined: Monday 17 February 2020 19:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Poland
- Contact:
Re: Python Plugin: PiHole Control
maybe ? what functionality you'd like to achieve with groups , please elaborate ?mark.sellwood wrote: Wednesday 19 November 2025 21:32 Great work, I have added the plugin & configured, now in Domoticz I get switches for each of Lists & I can Enable / Disable
Is it possible to control the Groups listed on PiHole under Group Management?
Thanks
-
mark.sellwood
- Posts: 107
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Python Plugin: PiHole Control
Hi, I'm just looking to control the Groups in the same way as Lists Enable / Disable
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
-
voyo
- Posts: 40
- Joined: Monday 17 February 2020 19:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Poland
- Contact:
Re: Python Plugin: PiHole Control
Ok, I added group functionality (same as with Lists). TBH Im not sure whether I see this useful for my usecase, not sure if I will be using it.
Beside of this - I found and fixed problem with clearing metadata (comments) when Lists status was changed, and fixed it.
Please test.
Beside of this - I found and fixed problem with clearing metadata (comments) when Lists status was changed, and fixed it.
Please test.
-
mark.sellwood
- Posts: 107
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Python Plugin: PiHole Control
Many thanks for making the change.
I have tested today, the groups show up correctly & the status reflects PiHole & changes when I change a Group in PiHole.
The control from Domoticz does not work, if I issue a switch command I see the below in the log but the status does not change in PiHole.
2025-11-22 20:04:29.181 PiHole: Successfully set group 82 ('Phone') to enabled
2025-11-22 20:04:29.184 PiHole: Group ID 82 ('Group: Phone') set to enabled
Thanks
I have tested today, the groups show up correctly & the status reflects PiHole & changes when I change a Group in PiHole.
The control from Domoticz does not work, if I issue a switch command I see the below in the log but the status does not change in PiHole.
2025-11-22 20:04:29.181 PiHole: Successfully set group 82 ('Phone') to enabled
2025-11-22 20:04:29.184 PiHole: Group ID 82 ('Group: Phone') set to enabled
Thanks
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
-
voyo
- Posts: 40
- Joined: Monday 17 February 2020 19:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Poland
- Contact:
Re: Python Plugin: PiHole Control
Wasted 2 hours debugging why group control wasn't working - turns out Pi-hole's API uses group NAME in the URL not ID (like /api/groups/TV instead of /api/groups/3), even though it returns success either way. Classic API inconsistency.
Had to open browser devtools and watch what the actual UI sends because the docs don't mention this anywhere. Fixed in latest commit , thanks God for Claude and LLMs
PLease check
Had to open browser devtools and watch what the actual UI sends because the docs don't mention this anywhere. Fixed in latest commit , thanks God for Claude and LLMs
PLease check
-
mark.sellwood
- Posts: 107
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Python Plugin: PiHole Control
Thanks or the update.
Using the ID would be the best way as I have found an issue using a Groups name
If the Group Name has a space in it switching fails One of my Groups is named "Black List"
2025-11-23 08:21:53.057 Error: PiHole: Error setting group state: URL can't contain control characters. '/api/groups/"Black List"' (found at least ' ')
2025-11-23 08:21:53.057 Error: PiHole: Failed to change state of group ID 74
Using the ID would be the best way as I have found an issue using a Groups name
If the Group Name has a space in it switching fails One of my Groups is named "Black List"
2025-11-23 08:21:53.057 Error: PiHole: Error setting group state: URL can't contain control characters. '/api/groups/"Black List"' (found at least ' ')
2025-11-23 08:21:53.057 Error: PiHole: Failed to change state of group ID 74
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
-
voyo
- Posts: 40
- Joined: Monday 17 February 2020 19:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Poland
- Contact:
Re: Python Plugin: PiHole Control
Im afraid this is Pihole fault. It is just not supporting groups with multiple words in name.
Check it yourself - try to add such group using PiHole interface directly.
This is my try (I especially upgraded to latest-greatest pihole version)
Check it yourself - try to add such group using PiHole interface directly.
This is my try (I especially upgraded to latest-greatest pihole version)
-
voyo
- Posts: 40
- Joined: Monday 17 February 2020 19:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Poland
- Contact:
Re: Python Plugin: PiHole Control
Ok, I played some more. It helped when I added group with ' " ' ("test group") .
New fixed code is available, please check
New fixed code is available, please check
-
mark.sellwood
- Posts: 107
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Python Plugin: PiHole Control
Many thanks for the great work, works fine.
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
-
JayDotR
- Posts: 11
- Joined: Thursday 02 January 2025 21:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Lux
- Contact:
Re: Python Plugin: PiHole Control
Big like for your work and time invested to make an old version of the plugin working again (also for me). I permitted myself to make a branch of your code is working when the PiHole is not using http, but https 
https://github.com/janreimen/Domoticz-PiHole-Control
https://github.com/janreimen/Domoticz-PiHole-Control
--
Domoticz Beta on Raspberry 3b (2x), and 4 (2x) on Rasbian Bullseye / Raspbian Bookworm / OSMC
Using: PiHole, SolarEdge Modbus, Sainlogic / Weather Underground, MQTT, Fritzbox, P1 Meter(s), dzvents Scripting
Domoticz Beta on Raspberry 3b (2x), and 4 (2x) on Rasbian Bullseye / Raspbian Bookworm / OSMC
Using: PiHole, SolarEdge Modbus, Sainlogic / Weather Underground, MQTT, Fritzbox, P1 Meter(s), dzvents Scripting
- waltervl
- Posts: 6677
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Python Plugin: PiHole Control
It would be more helpful to the community that you made a PR on the original plugin as then there is just one plugin to look at.JayDotR wrote: Saturday 03 January 2026 21:39 Big like for your work and time invested to make an old version of the plugin working again (also for me). I permitted myself to make a branch of your code is working when the PiHole is not using http, but https
https://github.com/janreimen/Domoticz-PiHole-Control
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
voyo
- Posts: 40
- Joined: Monday 17 February 2020 19:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Poland
- Contact:
Re: Python Plugin: PiHole Control
This is a bad approach. The plugin shouldn’t add an option to patch chain.pem just to support self-signed certs or your own CA - that’s a hack and will create maintenance problems down the line. If you really want to experiment, you could modify the plugin to ignore self-signed cert issues, but that’s a workaround at best. The proper way is to add the cert system-wide so all applications trust it, keeping things stable and maintainable.JayDotR wrote: Saturday 03 January 2026 21:39 Big like for your work and time invested to make an old version of the plugin working again (also for me). I permitted myself to make a branch of your code is working when the PiHole is not using http, but https
https://github.com/janreimen/Domoticz-PiHole-Control
But now its your branch , enjoy
(but please only correct credits, its 'Voyo' not 'YoYo' )
-
JayDotR
- Posts: 11
- Joined: Thursday 02 January 2025 21:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Lux
- Contact:
Re: Python Plugin: PiHole Control
I will fix your credits, thanks for making me aware of the Typo.
For the http/https point, ignoring the checks on ssl is from the "Secure by design" Scheme a no-go (I am working in IT, so I am perhaps "work-damaged" over the years). My certs and RootCA/SubCA were known systemwide, and as the Raspberry is part of an IT Network, it has to follow the standards of the infra
For the http/https point, ignoring the checks on ssl is from the "Secure by design" Scheme a no-go (I am working in IT, so I am perhaps "work-damaged" over the years). My certs and RootCA/SubCA were known systemwide, and as the Raspberry is part of an IT Network, it has to follow the standards of the infra
--
Domoticz Beta on Raspberry 3b (2x), and 4 (2x) on Rasbian Bullseye / Raspbian Bookworm / OSMC
Using: PiHole, SolarEdge Modbus, Sainlogic / Weather Underground, MQTT, Fritzbox, P1 Meter(s), dzvents Scripting
Domoticz Beta on Raspberry 3b (2x), and 4 (2x) on Rasbian Bullseye / Raspbian Bookworm / OSMC
Using: PiHole, SolarEdge Modbus, Sainlogic / Weather Underground, MQTT, Fritzbox, P1 Meter(s), dzvents Scripting
Who is online
Users browsing this forum: No registered users and 1 guest