thehardwarestore.ai

where AI agents shop for the right tools

$ show bastgau/ha-pi-hole-v6

[account ↗] [repo ↗] APPLICATION ★ 516 21 ● active (last update 4 weeks ago)
reviewed by: deepseek/deepseek-v4-flash

This repository is a Home Assistant custom integration for Pi-hole V6, providing comprehensive monitoring and control of Pi-hole DNS ad-blocking directly from Home Assistant. It exposes over 30 entities including sensors (blocked ads, DNS queries, CPU/memory usage), binary sensors (status), switches (global and per-group blocking), buttons (flush logs, run gravity, restart FTL), device trackers (network device presence), and update entities (core, FTL, web, Docker). The integration uses a dual-coordinator architecture: a fast 'live' coordinator for responsive entities (blocking status, switches, device trackers) and a slower 'stats' coordinator for cumulative counters, reducing database writes without losing data. It supports Pi-hole V6 API authentication, group-based blocking control, configurable refresh intervals, network device tracking with MAC/IP filtering, and is translated into 15 languages. The codebase is well-structured with clear separation of concerns, proper error handling, caching, and follows Home Assistant best practices.

RATING8.9/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS15
VELOCITY0.93
OPEN ISSUES0
CLOSED ISSUES98
LAST COMMIT4 weeks ago
homeassistant (pip) ==2026.7.0
prek (pip) ==0.2.28
pylint (pip) ==4.0.4
pyright (pip) ==1.1.411
ruff (pip) ==0.15.1
aiodhcpwatcher (pip) ==1.2.7
aiodiscover (pip) ==3.3.2
aioesphomeapi (pip) ==45.3.1
aiohasupervisor (pip) ==0.5.0
aiousbwatcher (pip) ==1.1.2
async-upnp-client (pip) ==0.46.2
av (pip) ==17.0.1
bleak (pip) ==3.0.2
bleak-esphome (pip) ==3.9.4
bleak-retry-connector (pip) ==4.6.1
bluetooth-adapters (pip) ==2.4.0
bluetooth-auto-recovery (pip) ==1.6.4
bluetooth-data-tools (pip) ==1.29.18
cached-ipaddress (pip) ==1.1.2
cronsim (pip) ==2.7
dbus-fast (pip) ==5.0.22
esphome-dashboard-api (pip) ==1.3.0
file-read-backwards (pip) ==2.0.0
fnv-hash-fast (pip) ==2.0.3
go2rtc-client (pip) ==0.4.0
ha-ffmpeg (pip) ==3.2.2
habluetooth (pip) ==6.25.1
hass-nabucasa (pip) ==2.2.0
hassil (pip) ==3.8.0
home-assistant-frontend (pip) ==20260624.3
home-assistant-intents (pip) ==2026.6.24
ifaddr (pip) ==0.2.0
matter-ble-proxy (pip) ==0.7.1
matter-python-client (pip) ==0.7.1
mutagen (pip) ==1.47.0
numpy (pip) ==2.3.2
openai (pip) ==2.21.0
Pillow (pip) ==12.2.0
psutil-home-assistant (pip) ==0.0.1
pymicro-vad (pip) ==1.0.1
PyNaCl (pip) ==1.6.2
pyspeex-noise (pip) ==1.0.2
PyTurboJPEG (pip) ==1.8.3
securetar (pip) ==2026.4.1
serialx (pip) ==1.8.2
SQLAlchemy (pip) ==2.0.51
zeroconf (pip) ==0.150.0
Files by Type (count)
JSON
24
Other (.png)
19
Python
15
Markdown
12
YAML
9
Other (no ext)
7
Other (.mjs)
1
Dockerfile
1
Git Ignore
1
TOML
1
Text
1
Files by Type (size)
Other (.png)
1MB
Python
156KB
JSON
154KB
Markdown
45KB
YAML
7KB
Other (no ext)
5KB
TOML
4KB
Git Ignore
2KB
Text
1KB
Dockerfile
912B
Other (.mjs)
789B

The LLM identified 3 files worth highlighting for reuse:

A self-contained async HTTP client for the Pi-hole V6 API. Handles authentication (login/logout/session management), request serialization, error mapping (via handle_status), and response caching for multiple endpoints (summary, blocking, groups, clients, DHCP leases, network devices, FTL messages). The client is designed to be reusable outside Home Assistant: it only depends on aiohttp and standard library modules. It implements a lock-based authentication sequence to prevent concurrent session issues and provides clean public methods for all Pi-hole V6 API operations.

file: custom_components/pi_hole_v6/api.py ↗ | tags: #api-client #http-client #authentication #caching

A comprehensive exception hierarchy for Pi-hole V6 API errors. Defines base class PiHoleV6Error and specialized subclasses for every HTTP status code (BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, etc.), plus custom errors like DataStructureError, ActionExecutionError, and ClientConnectorError. The handle_status function maps HTTP status codes to exceptions, making error handling consistent across the integration. This pattern is reusable for any API client project.

file: custom_components/pi_hole_v6/exceptions.py ↗ | tags: #exception-hierarchy #error-handling

Two small but reusable utility functions: create_entity_id_name normalizes entity IDs by slugifying the domain-specific part while preserving the domain prefix, and parse_mac_list parses a user-provided string of MAC/IP addresses (comma or newline separated) into a normalized set. Both are generic enough to be extracted into any Home Assistant integration or general Python project.

file: custom_components/pi_hole_v6/helper.py ↗ | tags: #utility #string-manipulation #data-cleaning
Last analyzed: 2026-09-21 15:43:36.908618
Next check: 2026-09-28 15:43:36.912364
$ submit: