Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looks like version 5.8.1 pihole does not work correctly #2

Closed
EagleDTW opened this issue Feb 6, 2022 · 28 comments
Closed

Looks like version 5.8.1 pihole does not work correctly #2

EagleDTW opened this issue Feb 6, 2022 · 28 comments

Comments

@EagleDTW
Copy link

EagleDTW commented Feb 6, 2022

Hi,

Looks like version 5.8.1 pihole does not work correctly to turn pihole active on and off.

Thank you,
Dan

@Ramias1
Copy link
Owner

Ramias1 commented Feb 6, 2022

Thanks for letting me know. I'm running this version:
Docker Tag 2022.01.1 Pi-hole [v5.8.1] FTL [v5.13] Web Interface [v5.10.1]
and it turns them off/on just fine but does not detect status so always shows as off. I will try to take a look at it this week.

@Ramias1
Copy link
Owner

Ramias1 commented Feb 6, 2022

Looks like a bug on their end or they've deprecated something. Try yourself after confirming Pi Hole is enabled. Then check here:

http://pihole_name_or_ip/admin/api.php?status&auth=

if you have an auth token add it to the end of that line. Refresh that page after enabling/disabling pi hole in the UI.

@EagleDTW
Copy link
Author

EagleDTW commented Feb 6, 2022 via email

@Ramias1
Copy link
Owner

Ramias1 commented Feb 7, 2022

Pi hole team is tracking this issue here: pi-hole/web#2051

If this is critical you can edit line 132 of plugin.py and make the new line appear as:
url = u"http://" + dev.pluginProps["address"] + "/admin/api.php&auth=" + dev.pluginProps["password"]

@EagleDTW
Copy link
Author

EagleDTW commented Feb 7, 2022 via email

@EagleDTW
Copy link
Author

EagleDTW commented Feb 7, 2022 via email

@Ramias1
Copy link
Owner

Ramias1 commented Feb 7, 2022

@EagleDTW
Copy link
Author

EagleDTW commented Feb 8, 2022 via email

@Ramias1
Copy link
Owner

Ramias1 commented Feb 8, 2022

Do you use a webtoken password or is that blank?

@EagleDTW
Copy link
Author

EagleDTW commented Feb 8, 2022 via email

@Ramias1
Copy link
Owner

Ramias1 commented Feb 8, 2022

Interesting. I do not use a web token password and it works for me — status, enable and disable.

they must have had another change. That may be related to why you could not enable or disable when I could (even though status was broken due to that api change).

let me check to see how far out they are from a new release.

@EagleDTW
Copy link
Author

EagleDTW commented Feb 8, 2022 via email

@Ramias1
Copy link
Owner

Ramias1 commented Feb 13, 2022

New release of PiHole appears to have fixed their status api. Please upgrade and try again.

@EagleDTW
Copy link
Author

Hi @Ramias1,

It appears that the issue of the warning message:
Traceback (most recent call last):
File "plugin.py", line 163, in runConcurrentThread
File "plugin.py", line 140, in udpateStatus
UnboundLocalError: local variable 'response' referenced before assignment

Pi Hole DNS Controller Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Pi Hole DNS Controller Error Error in plugin execution runConcurrentThread:

Has come back again or was never fully handled, is there a change to the code that can assign 'response' before being referenced in the plugin.py?

Thank you,
Daniel

@Ramias1
Copy link
Owner

Ramias1 commented May 13, 2023

Hi @EagleDTW I've moved to Home Assistant (though I still love the awesome Indigo community) and no longer have an Indigo platform to reproduce this one. Does this only happen when you press the Update Status button in the GUI?

If so, can you edit line 131 in the code from:

url = u"http://" + dev.pluginProps["address"] + "/admin/api.php"
to:

url = u"http://" + dev.pluginProps["address"] + "/admin/api.php?auth=" + dev.pluginProps["password"]

and reload and see what happens?

@EagleDTW
Copy link
Author

Hi @Ramias1,

This happens every 10 seconds filling up the event log on the screen. Not sure if this change will solve it but I'll try it out and report back.

I've also moved to HA for the most part but still link back to indigo for some core features and the WAF of the homepages.

Thank you,
Daniel

@EagleDTW
Copy link
Author

Hi @Ramias1,

That actually didn't fix it!

@Ramias1
Copy link
Owner

Ramias1 commented May 13, 2023

ok what happens if you do curl http://PIHOLE_IP/admin/api.php?auth=AUTHTOKEN ?

@EagleDTW
Copy link
Author

I get no matches found response from terminal

@EagleDTW
Copy link
Author

Hi @Ramias1,

I escaped the zsh ? error and the response was []%

I don't know if that is helpful or more confusing?

Thank you,
Daniel

@Ramias1
Copy link
Owner

Ramias1 commented May 13, 2023

Is your Pi Hole the latest version? To eliminate any curl issues you could try that same string in like Chrome or Firefox. But looks like you are getting an empty response.

@EagleDTW
Copy link
Author

Hi @Ramias1,

Yes, pihole is 5.16.2 latest version and in the web browser with that command it is getting the raw result of [] - don't know what that means as I have the correct webpassword from both the pihole itself or the api password (same value) from within the pihole interface itself?

@EagleDTW
Copy link
Author

it seems as though the variable response is being referenced too early in code is that possible or is the fact that it is empty reference throwing something off?

@Ramias1
Copy link
Owner

Ramias1 commented May 13, 2023

Issue is the empty response.

I redeployed my docker with a Webpassword variable (I normally run it with no password).

I then saw this:
https://pi-hole.net/blog/2022/11/17/upcoming-changes-authentication-for-more-api-endpoints-required/#page-content

It could be that the other API calls just work because they ignore the password entirely?

I get a valid response with:

➜  ~ curl http://pihole.home.arpa/admin/api.php\?status\&auth\=2591e703aadcaaaaa7234238472389734534aaa7d6283ead9c691de4e
{"status":"enabled"}%

Are you using your web password or an API key? (Settings/Api/Show API Token)

If you do get a valid response with curl and an API key then change line 131 to:
url = u"http://" + dev.pluginProps["address"] + "/admin/api.php?status&auth=" + dev.pluginProps["password"]

@EagleDTW
Copy link
Author

Hi @Ramias1,

I did finally get an enabled response and changed the line to the mentioned code you have and it worked like a charm! Closing as solved!

Thank you,
Daniel

@Ramias1
Copy link
Owner

Ramias1 commented May 14, 2023

Ok. If you want I can initialize response to “unavailable” which should prevent log spam but it may be harder to see if you have a connectivity or api issue in that case.

@Ramias1
Copy link
Owner

Ramias1 commented May 14, 2023

Released version 2.1.1. It handles the new Pi Hole API. Should reduce log spam except for when Pi Hole is unavailable.

@Ramias1 Ramias1 closed this as completed May 14, 2023
@EagleDTW
Copy link
Author

EagleDTW commented May 14, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants