arendruni / homebridge-pihole Goto Github PK
View Code? Open in Web Editor NEWPi-hole switch for Homebridge
Home Page: https://www.npmjs.com/package/homebridge-pihole
License: MIT License
Pi-hole switch for Homebridge
Home Page: https://www.npmjs.com/package/homebridge-pihole
License: MIT License
I'm not sure if this is just me, but after updating both of my Pi-holes to the latest version (Pi-hole v5.4, Web Interface v5.6, FTL v5.9) the on/toggle for them either works or they don't. Sometimes it would work but very delayed while it stopped working for my second Pi. Curious if under-the-hood changes to Pi-hole were made that somehow affected this plugin.
Is there any way to allow a switch to toggle a block url or ideally a group of rules?
It would be so useful to be able to block a set list of urls via a toggle (that could then be set via a timer if required) so I could easily block say Netflix, prime, YouTube etc while the kids should be doing homeschooling/homework etc.
I just try to run the plunin in a client bridge. I've two switches (pihole1 and pihole2).
When scanning the QR Code and try to add the device to HomeKit, it fail after several minuts (can't add the device)
All softare compontens are up to date
Even after updating PiHole and re-installing the homebridge-pihole plugin the HomeKit switch is not working. The switch is set to Off regardless of the status of the PiHole, and toggling the switch instantly cycles it from on back to off with no change in the PiHole status.
PiHole 5.9
FTL 5.14
homebridge-pihole running on Synology Hoobs 3.3.5
Since the latest update, the HomeKit switch does not change the active state of Pihole anymore.
Steps to reproduce the behavior:
OS: Raspbian GNU/Linux 10 (buster)
Pi-hole v5.8.1
FTL v5.13
Web Interface v5.10.1
Homebridge v 1.3.9
Node.js v16.13.1
npm v8.3.0
Homebridge (nodejs 12.14.1, npm 6.16.6) runs very stable.
No Problems with latest UI X 4.9.0
Up to now with Piholke v0.0.5 no problems.
Upgrade to 0.0.8 and restart Homebridge -> Homebridge on the GUI seems to be o.k.
However, all devices in Homekit becomes unresponsive.
The plugin reports an error:
Feb 2 17:27:19 hb homebridge[1294]: [2/2/2020, 5:27:19 PM] [Pihole1 10 min. aus] Error: socket hang up
Feb 2 17:27:19 hb homebridge[1294]: at connResetException (internal/errors.js:570:14)
Feb 2 17:27:19 hb homebridge[1294]: at Socket.socketOnEnd (_http_client.js:440:23)
Feb 2 17:27:19 hb homebridge[1294]: at Socket.emit (events.js:228:7)
Feb 2 17:27:19 hb homebridge[1294]: at endReadableNT (_stream_readable.js:1185:12)
Feb 2 17:27:19 hb homebridge[1294]: at processTicksAndRejections (internal/process/task_queues.js:81:21) {
Feb 2 17:27:19 hb homebridge[1294]: code: 'ECONNRESET'
Feb 2 17:27:19 hb homebridge[1294]: }
https connect works great, checked with wget
I have no clue why this plugin exists and what it does. I know what is pihole and have it running on my pi zero. Ditto for homebridge. Nada for homebridge-pihole.
Is there a way to get the switch display the status of the PiHole? If I turn off PiHole for 1 minute, the "switch" still display "On" after this delay.
Testing Homebridge 1.3.0-beta 40 and I got this message in my logs:
Received warning for the plugin 'homebridge-pihole' from the characteristic 'On': SET handler returned write response value, though the characteristic doesn't support write response! [On@Homebridge 9A0C] SET handler returned write response value, though the characteristic doesn't support write response!
Anything is working well though.
Describe the bug
If the port is set to 443, the plugin does not work (a error 400 is thrown).
I make a workaround with invoking https library instead of http.
Describe the bug
Sometimes when starting homebridge it gets stuck at
[5/25/2020, 12:18:49 AM] [Pi-hole] Initializing Pihole accessory...
Most of the times it works fine but roughly 1 / 10 fail.
To Reproduce
Steps to reproduce the behavior:
restart homebridge and watch output till it gets stuck
Using:
homebridge-pihole v0.2.0
node v12.16.3
homebridge v1.1.0
Hi there - I cannot get this to work. Running Homebridge. Only one other plugin for Nest. Following creating the config.json file and restarting Homebridge this plugin (or my config) causes the Nest plugin to stop work. The Pi-hole appears in Apple Home and switches between updating and no response.
Additionally when running with your plugin my Nest account keeps email me to say a new sign in detected, so presumably something keeps restarting.
Config file:
{
"bridge": {
"name": "Homebridge",
"username": "",
"port": 51826,
"pin": "--"
},
"description": "blah": [
{
"accessory": "Pihole",
"name": "Pi-hole",
"auth": "32c9922b72785d54b2e0c7018aba490e655082a",
"host": "192.168.1.10"
}
],
"platforms": [
{
"platform": "Nest",
"email": "",
"password": "***********",
"options": [
"Thermostat.Fan.Disable"
]
}
]
}
When your plugin is running this line appears in the logs
[11/4/2019, 8:47:08 PM] Error: connect ECONNREFUSED 127.0.0.1:80
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)
Any ideas? Thanks for developing this plugin. I look forward to being able to disable the Pihole using the HomeKit framework - will be great for the family to be able to disable it!
I looked online if someone had a similar idea, but couldn't find anything. Basically, I have two PiHoles for redundancy, so I'd like to control them both from HomeKit over Homebridge, but when I tried adding two accessories, the whole thing just crashes. Am I doing something wrong or is this impossible?
Thanks!
Describe the bug
It appears the debugging part of _makeRequest function is causing an issue:
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'TLSSocket'
| property '_httpMessage' -> object with constructor 'ClientRequest'
--- property 'socket' closes the circle
at JSON.stringify (<anonymous>)
at PiholeSwitch._makeRequest (/usr/lib/node_modules/homebridge-pihole/src/index.ts:161:11)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at On.<anonymous> (/usr/lib/node_modules/homebridge-pihole/src/index.ts:120:19)
(node:2381729) UnhandledPromiseRejectionWarning: Error: This callback function has already been called by someone else; it can only be called one time.
at /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:6:13
at On.<anonymous> (/usr/lib/node_modules/homebridge-pihole/src/index.ts:132:7)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Specifically, it seems the config
is where the circular reference is coming from (inferred from typings of AxiosResponse and AxiosRequestConfig).
I'm going to open a PR in a few minutes to (hopefully) fix this by creating a custom request
/config
attribute that doesn't attempt to read Axios' config structure.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Anything
Desktop (please complete the following information):
Describe the bug
The Plugin dosen't get the current State from my PiHole
To Reproduce
Steps to reproduce the behavior:
Expected behavior
If my PiHole is turned on the Plugin should tell me its turned on, if off it should show off
Desktop (please complete the following information):
Additional context
The Plugin only works if i turn on and off my PiHole with the Plugin., then it shows the state correct, if i turn it on or off in the PiHole UI the State is not projected correct to the Plugin
I am getting the error:
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at IncomingMessage.res.on (/usr/local/lib/node_modules/homebridge-pihole/index.js:56:59)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
Got SIGTERM, shutting down Homebridge...
All setup correctly and installed:
{ "accessory": "Pihole", "name": "Homelab pi-hole", "auth": "<APIKEY>", "host": "192.168.1.x" }
It only shows when I view in the Home app? Any ideas?
Hello thank you for the plugin !
I can't get it to work..
Than's a lot!
homebridge.log (1).txt
"accessories": [
{
"name": "PUB off",
"auth": "yICm2Fbh",
"ssl": false,
"host": "localhost",
"port": 80,
"baseDirectory": "/admin/",
"time": 120,
"reversed": true,
"logLevel": 2,
"accessory": "Pihole"
Hello,
Due to the way homekit handles switch on/off i would prefer the pihole to be considered “off” when it is actually on, and “on” when it is off. So in other words i’d like for the switch to be considered a “pi-hole bypass” switch.
Is it possible to add this as an option in the future?
Thank you!
I recently setup a new instance based on v6 of piHole. It looks like the API for v6 has completely changed.
It would be great if this plugin will be compatible with the future api.
I'm also happy to support with testing.
PiHole FTL v5.20 and Web v5.18 have been released with some API changes.
This has broken connectivity with HomeKit (turning Pi-Hole off an on causes no action).
When homebridge ist startet, I have to switch on/off the pihole switch, before it works as expected.
This is independet of the setting of the "reverse" option.
I.e.: The first switch does nothing change on the pihole.
Config:
"name": "Pihole1 10 min. off", "auth": "###### my long auth code #####", "ssl": true, "rejectUnauthorized": false, "host": "192.168.Z.XY", "port": 443, "baseDirectory": "/admin/", "time": 600, "reversed": true, "logLevel": 2, "accessory": "Pihole"
Describe the bug
Turning the PiHole HomeKit Accessory (switch) on has no effect on pihole.
Expected behavior
PiHole disabled for configured time - 30s.
Desktop (please complete the following information):
Additional context
HomeKit Accessory changes from Off to On (and On to Off) but PiHole Status does not change. PiHole running in Docker on Ubuntu - same host as HomeBridge container. HTTP, no SSL.
Describe the bug
[04/03/2021, 11:00:57] [homebridge-pihole] This plugin slows down Homebridge. The read handler for the characteristic 'On' didn't respond at all!. Please check that you properly call the callback! See https://git.io/JtMGR for more info.
To Reproduce
restarting Homebridge brings up this error
Expected behavior
no warning
Desktop (please complete the following information):
not relevant
Additional context
Add any other context about the problem here.
First of all thanks for creating this plugin. Just installed it but it seems not to work for me? The tile appears in the Homekit app and i can flip the switch but on the Pihole WebUI the services keeps enabled (yes i refreshed the page). I'm running the latest update of PI, WebUI and FTL.
Pi-hole v5.2.1 Web Interface v5.2.1 FTL v5.3.2
{
"name": "Pihole",
"auth": "MyTokenIsHere",
"ssl": false,
"host": "MyIPaddress",
"port": 80,
"baseDirectory": "/etc/pihole/",
"time": 0,
"reversed": false,
"logLevel": 1,
"accessory": "Pihole"
}
If Pihole is not available, Homebridge and all other devices are also unavailable.
Please implement an availability check of the PiHole server instead of blocking the entire Homebridge.
For more details on how a single accessory blocks the entire Homebridge, see homebridge/homebridge#948.
Unable to get it to work - log attached
PiHole is accessible on 192.168.1.121 for me - not using https
Homebridge is running on Unraid (https://github.com/oznu/docker-homebridge/wiki/Homebridge-on-Unraid)
LOG
[12/5/2020, 12:04:19 AM] [Pihole] Error: connect EHOSTUNREACH 192.168.1.121:80
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
errno: -113,
code: 'EHOSTUNREACH',
syscall: 'connect',
address: '192.168.1.121',
port: 80,
config: {
url: 'api.php',
method: 'get',
params: { status: 1 },
headers: {
Accept: 'application/json, text/plain, */*',
'User-Agent': 'axios/0.19.2'
},
baseURL: 'http://192.168.1.121:80/admin/',
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
responseType: 'json',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
data: undefined
},
request: <ref *1> Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false
},
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
protocol: 'http:',
maxRedirects: 21,
maxBodyLength: 10485760,
path: '/admin/api.php?status=1',
method: 'GET',
headers: [Object],
agent: undefined,
agents: [Object],
auth: undefined,
hostname: '192.168.1.121',
port: '80',
nativeProtocols: [Object],
pathname: '/admin/api.php',
search: '?status=1'
},
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Socket],
_header: 'GET /admin/api.php?status=1 HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'User-Agent: axios/0.19.2\r\n' +
'Host: 192.168.1.121\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/admin/api.php?status=1',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: '192.168.1.121',
protocol: 'http:',
_redirectable: [Circular *1],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'http://192.168.1.121:80/admin/api.php?status=1',
[Symbol(kCapture)]: false
},
response: undefined,
isAxiosError: true,
toJSON: [Function (anonymous)]
}
Yet navigating to http://192.168.1.121:80/admin/api.php?status=1
yields {"status":"enabled"}
as a response.
The most recent update breaks the ability to disable/enable pihole through the API.
Describe the bug
I'm doing some work on my NAS which hosts my pi-hole server, and with the pi-hole docker not running I noticed all of my homebridge accessories went offline. When I checked homebridge, it was crashing in a loop.
I suspected the issue had to do with my NAS being down, and when I changed the IP used for the Pi-hole plugin in homebridge config to something else, homebridge was able to stay online. It seems the server being online, but not responsive causes this issue and using a random non-existant IP does not.
I have logging set to info level, but all I ever see is:
[12/7/2021, 5:49:15 PM] [Pihole] Initializing Pihole accessory...
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Pi-hole plugin should be able to handle communication issues without bringing down Homebridge.
Desktop (please complete the following information):
Hi, I use a self signed certificate pair to use SSL.
Your Plugin reports then:
Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1502:34)
at TLSSocket.emit (events.js:314:20)
at TLSSocket._finishInit (_tls_wrap.js:937:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:711:12) {
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
config: {
url: 'api.php',
method: 'get',
params: { status: 1 },
headers: {
Accept: 'application/json, text/plain, */*',
'User-Agent': 'axios/0.19.2'
},
baseURL: 'https://pi.hole:443/admin/',
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
responseType: 'json',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
data: undefined
},
Where can I place the certificate to get it work again?
Regards,
Describe the bug
Recently started experiencing odd behavior with pihole plugin.
Toggling the switch in iOS home app would appear to turn the pihole off, but there would be no indication it would turn back on via home app.
Checking the webUI of pihole, the plugin appears to be working (e.g. turning off would disable pihole, which would automatically restart after 120 second interval; but home app wouldn't reflect this).
Checking the homebridge web UI I revealed a problem with the plugin. On homebridge boot, I receive the following error with the homebridge-pihole plugin:
[12/30/2022, 10:37:36 PM] [Pihole] Error: Request failed with status code 403 at createError (/usr/lib/node_modules/homebridge-pihole/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/lib/node_modules/homebridge-pihole/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/lib/node_modules/homebridge-pihole/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1359:12) at processTicksAndRejections (node:internal/process/task_queues:82:21) { config: { url: 'api.php', method: 'get', headers: { Accept: 'application/json, text/plain, */*', 'User-Agent': 'axios/0.21.4' }, params: { status: 1, auth: '54a6673c814b32309806ff1067ede0155de1af6c0550d6ce51d6f62ba76e4101' }, baseURL: 'http://localhost:80/admin/', transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: httpAdapter], responseType: 'json', xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, httpsAgent: Agent { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, defaultPort: 443, protocol: 'https:', options: [Object: null prototype], requests: [Object: null prototype] {}, sockets: [Object: null prototype] {}, freeSockets: [Object: null prototype] {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256, scheduling: 'lifo', maxTotalSockets: Infinity, totalSocketCount: 0, maxCachedSessions: 100, _sessionCache: [Object], [Symbol(kCapture)]: false }, validateStatus: [Function: validateStatus], transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, data: undefined }, request: <ref *1> ClientRequest { _events: [Object: null prototype] { abort: [Function (anonymous)], aborted: [Function (anonymous)], connect: [Function (anonymous)], error: [Function (anonymous)], socket: [Function (anonymous)], timeout: [Function (anonymous)], finish: [Function: requestOnFinish] }, _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: false, socket: Socket { connecting: false, _hadError: false, _parent: null, _host: 'localhost', _closeAfterHandlingError: false, _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, parser: null, _httpMessage: [Circular *1], [Symbol(async_id_symbol)]: 1160, [Symbol(kHandle)]: [TCP], [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: null, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false, [Symbol(kSetNoDelay)]: true, [Symbol(kSetKeepAlive)]: false, [Symbol(kSetKeepAliveInitialDelay)]: 0, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0 }, _header: 'GET /admin/api.php?status=1&auth=54a6673c814b32309806ff1067ede0155de1af6c0550d6ce51d6f62ba76e4101 HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'User-Agent: axios/0.21.4\r\n' + 'Host: localhost\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: nop], agent: Agent { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, defaultPort: 80, protocol: 'http:', options: [Object: null prototype], requests: [Object: null prototype] {}, sockets: [Object: null prototype], freeSockets: [Object: null prototype] {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256, scheduling: 'lifo', maxTotalSockets: Infinity, totalSocketCount: 2, [Symbol(kCapture)]: false }, socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, path: '/admin/api.php?status=1&auth=54a6673c814b32309806ff1067ede0155de1af6c0550d6ce51d6f62ba76e4101', _ended: true, res: IncomingMessage { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 3, _maxListeners: undefined, socket: [Socket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [Array], rawTrailers: [], aborted: false, upgrade: false, url: '', method: null, statusCode: 403, statusMessage: 'Forbidden', client: [Socket], _consuming: false, _dumped: false, req: [Circular *1], responseUrl: 'http://localhost:80/admin/api.php?status=1&auth=54a6673c814b32309806ff1067ede0155de1af6c0550d6ce51d6f62ba76e4101', redirects: [], [Symbol(kCapture)]: false, [Symbol(kHeaders)]: [Object], [Symbol(kHeadersCount)]: 14, [Symbol(kTrailers)]: null, [Symbol(kTrailersCount)]: 0 }, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: 'localhost', protocol: 'http:', _redirectable: Writable { _writableState: [WritableState], _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, _options: [Object], _ended: true, _ending: true, _redirectCount: 0, _redirects: [], _requestBodyLength: 0, _requestBodyBuffers: [], _onNativeResponse: [Function (anonymous)], _currentRequest: [Circular *1], _currentUrl: 'http://localhost:80/admin/api.php?status=1&auth=54a6673c814b32309806ff1067ede0155de1af6c0550d6ce51d6f62ba76e4101', [Symbol(kCapture)]: false }, [Symbol(kCapture)]: false, [Symbol(kBytesWritten)]: 0, [Symbol(kEndCalled)]: true, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] { accept: [Array], 'user-agent': [Array], host: [Array] }, [Symbol(kUniqueHeaders)]: null }, response: { status: 403, statusText: 'Forbidden', headers: { 'content-type': 'text/html', 'x-pi-hole': 'The Pi-hole Web interface is working!', 'x-frame-options': 'DENY', 'content-length': '341', connection: 'close', date: 'Sat, 31 Dec 2022 04:37:36 GMT', server: 'lighttpd/1.4.53' }, config: { url: 'api.php', method: 'get', headers: [Object], params: [Object], baseURL: 'http://localhost:80/admin/', transformRequest: [Array], transformResponse: [Array], timeout: 0, adapter: [Function: httpAdapter], responseType: 'json', xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, httpsAgent: [Agent], validateStatus: [Function: validateStatus], transitional: [Object], data: undefined }, request: <ref *1> ClientRequest { _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: false, socket: [Socket], _header: 'GET /admin/api.php?status=1&auth=54a6673c814b32309806ff1067ede0155de1af6c0550d6ce51d6f62ba76e4101 HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'User-Agent: axios/0.21.4\r\n' + 'Host: localhost\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: nop], agent: [Agent], socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, path: '/admin/api.php?status=1&auth=54a6673c814b32309806ff1067ede0155de1af6c0550d6ce51d6f62ba76e4101', _ended: true, res: [IncomingMessage], aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: 'localhost', protocol: 'http:', _redirectable: [Writable], [Symbol(kCapture)]: false, [Symbol(kBytesWritten)]: 0, [Symbol(kEndCalled)]: true, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype], [Symbol(kUniqueHeaders)]: null }, data: '<?xml version="1.0" encoding="iso-8859-1"?>\n' + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n' + ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n' + '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n' + ' <head>\n' + ' <title>403 Forbidden</title>\n' + ' </head>\n' + ' <body>\n' + ' <h1>403 Forbidden</h1>\n' + ' </body>\n' + '</html>\n' }, isAxiosError: true, toJSON: [Function: toJSON] }
Additional context
I've tried removing the homebridge-pihole plugin and re-installing, but no dice.
All software is up to date.
DietPi OS - v8.12.1
Homebridge - v1.6.0
homebridge-pihole - v0.4.2
NPM - v9.2.0
Node JS - v18.12.1
Pihole - v5.14.2, FTL - v5.20, Web Interface v5.18
Running home bridge 1.3.0
Guessing I've done something wrong, cannot access pinhole admin gui, apologies if it's something simple this is new to me.
Config:
bridge": {
"name": "Homebridge ",
"username": "",
"port": 51591,
"pin": "****"
},
"accessories": [
{
"name": "Pihole",
"ssl": false,
"rejectUnauthorized": false,
"host": "localhost",
"port": 80,
"baseDirectory": "/admin/",
"time": 60,
"reversed": false,
"logLevel": 1,
"accessory": "Pihole"
}
],
"platforms": [
{
"name": "Config",
"port": 8581,
"platform": "config"
Error Log:[2/22/2021, 1:24:14 PM] Homebridge v1.3.0 (Homebridge *****) is running on port 51591.
[2/22/2021, 1:24:15 PM] [Pihole] Error: connect ECONNREFUSED 127.0.0.1:80
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 80,
config: {
url: 'api.php',
method: 'get',
headers: {
Accept: 'application/json, text/plain, /',
'User-Agent': 'axios/0.21.1'
},
params: { status: 1 },
baseURL: 'http://localhost:80/admin/',
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
responseType: 'json',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
httpsAgent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: {},
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'fifo',
maxTotalSockets: Infinity,
totalSocketCount: 0,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
validateStatus: [Function: validateStatus],
data: undefined
},
request: <ref *1> Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false
},
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
maxRedirects: 21,
maxBodyLength: 10485760,
protocol: 'http:',
path: '/admin/api.php?status=1',
method: 'GET',
headers: [Object],
agent: undefined,
agents: [Object],
auth: undefined,
hostname: 'localhost',
port: '80',
nativeProtocols: [Object],
pathname: '/admin/api.php',
search: '?status=1'
},
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Socket],
_header: 'GET /admin/api.php?status=1 HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'User-Agent: axios/0.21.1\r\n' +
'Host: localhost\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/admin/api.php?status=1',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'localhost',
protocol: 'http:',
_redirectable: [Circular *1],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'http://localhost:80/admin/api.php?status=1',
[Symbol(kCapture)]: false
},
response: undefined,
isAxiosError: true,
toJSON: [Function: toJSON]
}
Describe the bug
Install with npm install -g homebridge-pihole
Added
{
"accesory": "Pihole",
"name": "Pihole",
"auth": "<API TOKEN>",
"host": "192.168.18.6",
"time": 120
}
To the accessories section of my config.json and when I restart Homebridge in my Pi it says
TypeError: Cannot read property 'indexOf' of undefined
Dec 03 16:49:41 raspberrypi homebridge[13561]: at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:50:12)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:297:42)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:91:38)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:59:10)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at Module._compile (internal/modules/cjs/loader.js:689:30)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at Module.load (internal/modules/cjs/loader.js:599:32)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at startup (internal/bootstrap/node.js:283:19)
Dec 03 16:49:41 raspberrypi homebridge[13561]: at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
Hello,
I am trying to connect the plugin to my pihole installation but can't.
Ip and port are standard and working when doing a copy paste to any browser.
Can you please assist ?
syscall: 'connect',
address: '192.168.1.200',
port: 80,
config: {
url: 'api.php',
method: 'get',
params: { status: 1 },
headers: {
Accept: 'application/json, text/plain, /',
'User-Agent': 'axios/0.19.2'
},
baseURL: 'http://192.168.1.200:80/admin/',
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
responseType: 'json',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
data: undefined
},
request: Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object]
},
writable: true,
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
protocol: 'http:',
maxRedirects: 21,
maxBodyLength: 10485760,
path: '/admin/api.php?status=1',
method: 'GET',
headers: [Object],
agent: undefined,
agents: [Object],
auth: undefined,
hostname: '192.168.1.200',
port: '80',
nativeProtocols: [Object],
pathname: '/admin/api.php',
search: '?status=1'
},
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function],
_currentRequest: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Socket],
connection: [Socket],
_header: 'GET /admin/api.php?status=1 HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'User-Agent: axios/0.19.2\r\n' +
'Host: 192.168.1.200\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'GET',
insecureHTTPParser: undefined,
path: '/admin/api.php?status=1',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
_redirectable: [Circular],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'http://192.168.1.200:80/admin/api.php?status=1',
[Symbol(kCapture)]: false
},
response: undefined,
isAxiosError: true,
toJSON: [Function]
}
Describe the bug
the HomeKit switch has no function to the backend
To Reproduce
Steps to reproduce the behavior:
I press the switch . Only the color of the button changes .
Expected behavior
A clear and concise description of what you expected to happen.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The plugin in installed via HOOBS for Homebridge
Sorry not sure if this is the place for this, so please direct me to a forum if you have one for this. Great plugin by the way its great you have put this together.
I wanted to ask if it were possible to consider, now or in the future an update to add a disable timer. i.e. disable for 30mins as opposed to permanently until its turned back on. This would be a great new feature and prevent it being forgotten to turn back on. No issues if its not possible but i thought i would ask, and likewise sorry if this is not the place for it!
Describe the bug
The plug in reports fine in home kit but home bridge throwing errors.
home bridge shows:
Error: write EPROTO 3069736144:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) {
errno: -71,
code: 'EPROTO',
syscall: 'write',
config: {
url: 'api.php',
method: 'get',
headers: {
Accept: 'application/json, text/plain, /',
'User-Agent': 'axios/0.21.4'
},
params: {
enable: 1,
auth: 'cee9248c59bcf9bfc2ca7e4e84af5a22e55208aa6b5b8f1c59e67526165609b2'
},
baseURL: 'https://192.168.4.80:80/admin/',
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
responseType: 'json',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
httpsAgent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype],
freeSockets: [Object: null prototype] {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 1,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
validateStatus: [Function: validateStatus],
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
data: undefined
},
request: <ref *1> Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
maxRedirects: 21,
maxBodyLength: 10485760,
protocol: 'https:',
path: '/admin/api.php?enable=1&auth=cee9248c59bcf9bfc2ca7e4e84af5a22e55208aa6b5b8f1c59e67526165609b2',
method: 'GET',
headers: [Object],
agent: [Agent],
agents: [Object],
auth: undefined,
hostname: '192.168.4.80',
port: '80',
nativeProtocols: [Object],
pathname: '/admin/api.php',
search: '?enable=1&auth=cee9248c59bcf9bfc2ca7e4e84af5a22e55208aa6b5b8f1c59e67526165609b2'
},
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: [TLSSocket],
_header: 'GET /admin/api.php?enable=1&auth=cee9248c59bcf9bfc2ca7e4e84af5a22e55208aa6b5b8f1c59e67526165609b2 HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'User-Agent: axios/0.21.4\r\n' +
'Host: 192.168.4.80:80\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: [Agent],
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/admin/api.php?enable=1&auth=cee9248c59bcf9bfc2ca7e4e84af5a22e55208aa6b5b8f1c59e67526165609b2',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: '192.168.4.80',
protocol: 'https:',
_redirectable: [Circular *1],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'https://192.168.4.80:80/admin/api.php?enable=1&auth=cee9248c59bcf9bfc2ca7e4e84af5a22e55208aa6b5b8f1c59e67526165609b2',
[Symbol(kCapture)]: false
},
response: undefined,
isAxiosError: true,
toJSON: [Function: toJSON]
}
Hello! I have noticed the plugin has stopped working and in my logs I have:
10/20/2021, 11:54:16 AM RPi WARNING warning: config.json: hosts[0]: devices[0]: gpio: key missing
10/20/2021, 11:54:17 AM RPi WARNING warning: localhost: not a Raspberry Pi
Device is a Raspberry Pi 4
Hello, would it be possible that you include a way to set the time for disable in HomeKit?
There is a plugin that seems to have this feature but can't be installed. Maybe you can use some of the code?
https://github.com/thkl/homebridge-piholeOff
Would be cool if you can implement this function.
Thanks!
Many greetings
Nastras
As the subject says it would be nice if this could be done and combine these :)
Pi-hole switch always in position 'Off' in homekit.
Steps to reproduce the behavior:
The actions are well executed via API so connection is ok, API key is correct and working fine, the only issue is to see the Pi-hole switch back to 'Off' all the time.
This is happening since the latest Pi-hole update running under docker:
No a big issue as it's still working but annoying as we cannot get the correct state and it can break some automations.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.