[Re-Release | Pi-Hole On/Off Toggle Driver ]

  1. yes, the turning on does nothing as well. i did manually turn off in pi-hole and it did reflect as off in HE

[dev:1329](http://{HE IP}/logs#dev1329)2023-01-11 11:46:07.792 am [error](http://{HE IP}/device/edit/1329)java.lang.NullPointerException: Cannot get property 'FTLnotrunning' on null object on line 109 (method parse)
[dev:1329](http://{HE IP}/logs#dev1329)2023-01-11 11:46:07.787 am [debug](http://{HE IP}/device/edit/1329)Received 'null'
[dev:1329](http://{HE IP}/logs#dev1329)2023-01-11 11:46:07.782 am [debug](http://{HE IP}/device/edit/1329)Parsing 'hubitat.device.HubResponse@1335f09'
[dev:1329](http://{HE IP}/logs#dev1329)2023-01-11 11:45:56.854 am [error](http://{HE IP}/device/edit/1329)java.lang.NullPointerException: Cannot get property 'FTLnotrunning' on null object on line 109 (method parse)
[dev:1329](http://{HE IP}/logs#dev1329)2023-01-11 11:45:56.849 am [debug](http://{HE IP}/device/edit/1329)Received 'null'
[dev:1329](http://{HE IP}/logs#dev1329)2023-01-11 11:45:56.843 am [debug](http://{HE IP}/device/edit/1329)Parsing 'hubitat.device.HubResponse@1ec0cc1'

  1. Not behind a different port, it's the default


That tells me that your_ip/api.php?status isn't returning anything to this app unlike your browser where you get {"status":"enabled"}.

Could your vlan be blocking traffic between your HE and rPi or maybe the IP in the settings is wrong, or you need to add the auth key back?

I do have my firewall set up for access from my HE to Pi-Hole. I do see the "combined" details on HE with my Queries, Blocked, and Clients, so not sure why it's not properly pulling the status. I'll have to take a look more when I get out of work

Any chance that a toggle could be added to enable/disable logging?

1 Like

it's weird because when i do a refresh, it gets the information

dev:1329 2023-01-12 05:15:22.052 pm debugReceived '[reply_NOTIMP:0, reply_DOMAIN:838, reply_NXDOMAIN:4954, reply_RRNAME:0, reply_DNSSEC:0, gravity_last_updated:[file_exists:true, absolute:1673169024, relative:[hours:14, minutes:4, days:4]], queries_forwarded:28745, clients_ever_seen:58, reply_NONE:0, unique_domains:9416, privacy_level:0, reply_UNKNOWN:2170, reply_NODATA:1580, ads_blocked_today:27025, dns_queries_all_types:77408, dns_queries_all_replies:77408, dns_queries_today:77408, reply_OTHER:0, reply_SERVFAIL:2, reply_IP:49547, queries_cached:21377, reply_CNAME:18311, reply_REFUSED:0, domains_being_blocked:751393, ads_percentage_today:34.912411, unique_clients:37, reply_BLOB:6, status:enabled]'
dev:1329 2023-01-12 05:15:22.047 pm debugParsing 'hubitat.device.HubResponse@e69496'

it gets everything, but it's not able to control the status

Super weird, as a refresh is the exact thing as a "poll". The code literately calls poll.

That sounds to me like a rights issue. Are you sure you don't need an Auth Key? Or if not, can you check that you removed the auth key item from line 149
def path = getApiPath() + "?" + toggle + "&auth=" + apiToken

Yep. I'll add that to the list of things;
So far;

  1. Make API Key Optional
  2. Make Debug Toggle-able

that was it! i removed "+ apiToken" from lines 88 and 149 and it can now control it. i wonder what apiToken was providing since I had it blank.

to make this work for me, the updates i did:
33: input name: "apiToken", type: "text", title: "API token", required: false
88: def path = getApiPath() + "?summaryRaw" + "&auth="
149: def path = getApiPath() + "?" + toggle + "&auth="

just updated the code to see what apiToken was giving and it is "null". i wonder if having an if statement in the script to say "if apiToken = null THEN apiToken = "" " would suffice

played with it a bit more, made the following changes and it still works:

def path = ""
if (apiToken == null) {
path = getApiPath() + "?summaryRaw" + "&auth="
} else{
path = getApiPath() + "?summaryRaw" + "&auth=" + apiToken

149 (now 154 after making the above change):
def path = ""
if (apiToken == null) {
path = getApiPath() + "?" + toggle + "&auth="
} else{
path = getApiPath() + "?" + toggle + "&auth=" + apiToken

not sure why it wouldn't let me leave the def path in the if statement, but it is what it is

1 Like

New update posted to GitHub with the following additions;

  • Added toggle for debugging &
  • API Token is now optional
  • Simplified the code (streamlined repeated code into one function, reducing the size and maintainability)

I think right now you could create a virtual switch in HE which does work with the homekit integration, then set it up to be a two way mirror.

e.g. the create two simple RM Rules that mirror each other.
1 triggers off of a change in this device and sets the virtual switch to the same state if not already set, and then the another triggers off of a change in on the virtual switch and sets this device to the same state if not already set

1 Like

updated to the latest version (v 2023.01.12) and now i can't control the on/off again

[dev:1329](http://{HE IP}/logs#dev1329)2023-01-13 10:02:59.348 am [error](http://{HE IP}/device/edit/1329)java.lang.NullPointerException: Cannot get property 'FTLnotrunning' on null object on line 127 (method parse)

Let me PM you, I think I know what the issue is for those without the security.

1 Like

Thanks to @dadarkgtprince - We figured out the issue for password-less pi-holes and the device code has been updated. Thank you!

1 Like

just tested v 2023.01.13 and it works as expected. thanks @SoundersDude !

1 Like

Very good idea - I might just do that… :blush:

1 Like

So, curious how hard it would be to add a presence sensor to this driver? I notice that if my Pi Hole server is offline, the switch status just indicates the last known status. It would be pretty cool if the driver could report "Offline" if the Pi Hole server has gone down for whatever reason..

1 Like

Very interesting. That shouldn't be too hard, my only concern would be false positives, but maybe that is fine.

I'd always be willing to try!

it's deprecated now since HE introduced a ping feature locally, but this can help you if needed

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.