homebridge-pihole
v1.1.0
Published
Pi-hole Switch for Homebridge: https://github.com/nfarina/homebridge
Readme
Homebridge Pi-hole 
Pi-hole plugin for Homebridge. This plugin publishes a virtual switch that disables Pi-hole, making it easier to temporarily turn off the ad-blocker. Supports SSL connections and can be configured with a timer to turn Pi-hole back on.
Requirements
- Homebridge - HomeKit support for the impatient
- Pi-hole - A black hole for Internet advertisements
Installation
- Install this plugin
npm install -g homebridge-pihole - Update your configuration file. See sample-config.json in this repository for a sample.
See the Pi-hole installation section for more details.
Configuration
There are the following options:
nameRequired. Accessory name, default is Pi-hole.
Pi-hole Configuration
authPi-hole password or app password when using 2FA, see the section on how to get an app password.baseUrlPi-hole base URL, default ishttp://localhost.pathThe directory where the Pi-hole dashboard is located. Default is/api.rejectUnauthorizedIf the HTTPS agent should check the validity of SSL cert, set it tofalseto allow self-signed certs to work. Default istrue.timeHow long Pi-hole will be disabled, in seconds, default is 0 that means permanently disabled.reversedWhen set totruereverse the status of Pi-hole. When Pi-hole is off the plugin will be set to on and when Pi-hole is on the plugin will be set to off. Default isfalse.persistSessionIf the session should be persisted to disk. Default isfalse.logLevelLogging level, three different levels: 0: logging disabled, 1: logs only HTTP errors, 2: logs each HTTP response. Default is set to 1.
Device Information
manufacturerCustom manufacturer, default is Raspberry Pi.modelCustom model, default is Pi-hole.serial-numberShould be a 9 digit number in the string format 123-456-789.
See the sample-config.json file to see an example of how to configure the accessory. In the example the configured accessory will disable Pi-hole for a time interval of two minutes (120 seconds).
How to get a Pi-hole app password
- Login into your Pi-hole Admin Console.
- Navigate to the Settings page and then to the Web interface / API tab, and enable the Expert settings.
- In the Advanced Settings panel, click on the Configure app password button, a popup window will ask for confirmation, go ahead and copy the app password then click on Enable new app password.
- Paste your App password in the homebridge-pihole configuration file.
Common Errors
api_seats_exceeded
This error occurs when the maximum number of Pi-hole API sessions is reached. By default, the plugin does not persist sessions, so each time Homebridge restarts, a new session is created. To fix this, you can:
- Enable
persistSessionin the configuration. - Delete old sessions that are not expired (from Pi-hole
/admin/settings/apipage remove session with userAgenthomebridge-pihole). - Increase the
webserver.api.max_sessionPi-hole setting.
