sheyabernstein / MMM-pihole-stats

Pi-Hole stats for MagicMirror2
MIT License
75 stars 16 forks source link

Module is stuck on loading #35

Closed BerkSmash1984 closed 8 months ago

BerkSmash1984 commented 9 months ago

Just installed this module fresh, but it is stuck on loading:

image

Here is my config:

image

Here is what I am seeing in the logs:

image

Any thoughts?

sheyabernstein commented 9 months ago

Hi @BerkSmash1984, can you see a request to your Pi-Hole instance in the network logs? If so, what does the response look like?

The Pi-Hole API returns responses as application/json, perhaps it is not loading. Also, the apiURL should contain the port if it is not the default 80 for http.

BerkSmash1984 commented 9 months ago

The Pi-hole is actually running on the same device as the MagicMirror (my RPI 4B) and is using standard port 80 for http traffic.

Dev mode on the browser is not showing anything revealing. Which network logs did you want me to check, specifically? Pi-hole itself is not showing anything, but again, it is talking to itself since it is all on the same device.

sheyabernstein commented 9 months ago

Can you see the HTTP response from the pihole requests in the network console?

37 will not throw exceptions on HTTP error in this module, so it should not continue to interrupt MagicMirror's startup.

BerkSmash1984 commented 9 months ago

Appreciate your responses. I'll check in the morning via the network dev console and get back to you, but it doesn't prevent my MagicMirror from loading, it's just the pihole stats module never loads.

BerkSmash1984 commented 9 months ago

I just checked the Network tab in the Dev console but not seeing any requests related to the pi-hole stats module:

image

robklingler commented 8 months ago

I am seeing the same thing (i.e. stuck on "Loading.")

My Magic Mirror logs shows " [ERROR] MMM-pihole-stats: TypeError: fetch failed"

sheyabernstein commented 8 months ago

Hi, are you running the latest version of this module and magicmirror?

AWSW-de commented 8 months ago

Hi, just installed a new MM and this module today and can confirm this loading stuck issue.

Thanks for a fix in advance =)

robklingler commented 8 months ago

I think I found the issue/solution.

First, background:

I first tried creating an API token, which also required establishing a password. Did both of these, no change.

I then noted that the apiURL wasn't working, as it wasn't picking up the correct port. (I previously had a "port: " configuration in my MM config file, but now see that option is not listed in the current module configuration options.)

I added the port to by apiURL (http://192.168.1.1:808/admin/api.php) and rebooted MM.

Everything now is back to working. And works with and without API and/or password.

sheyabernstein commented 8 months ago

@robklingler the port config was indeed removed recently. Will add it to the readme too.

AWSW-de commented 8 months ago

Hi, the port was not the solution for my setup although I changed it too.

I got it working meanwhile by changing the apiURL to the IP-address instead of the pi.hole url:

apiURL: "http://192.168.1.15/admin/api.php"

Now it shows the data.

Thanks and kind regards =)

robklingler commented 8 months ago

(And thank you for removing the dependency on fetch, which through an error every time I updated the MM container. I knew how to fix it, but it required manual steps, and ultimately caused me not to regularly update the MM container.)

sheyabernstein commented 8 months ago

The README has been updated to highlight the removal of the port config option in #38 . Thanks all for raising this issue.

BerkSmash1984 commented 8 months ago

Maybe update the code snippet showing the port in the apiURL config so it is clear. Right now the code doesn’t show absolute URL; it doesn’t have the port.

Respectfully,

Jordan Berkebile

On Sun, Mar 10, 2024 at 6:53 PM Sheya Bernstein @.***> wrote:

The README has been updated to highlight the removal of the port config option in #38 https://github.com/sheyabernstein/MMM-pihole-stats/pull/38 . Thanks all for raising this issue.

— Reply to this email directly, view it on GitHub https://github.com/sheyabernstein/MMM-pihole-stats/issues/35#issuecomment-1987390919, or unsubscribe https://github.com/notifications/unsubscribe-auth/AY6X2WJKCLBWHNU2QOPAPVTYXTP5NAVCNFSM6AAAAABD6WT2B6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGM4TAOJRHE . You are receiving this because you were mentioned.Message ID: @.***>

BerkSmash1984 commented 8 months ago

@sheyabernstein This still is not working for me, even with absolute URL

image

image

Yes, I am using latest MM and latest module (just downloaded it this AM to retest.

In the logs, it is still showing this: image

sheyabernstein commented 8 months ago

@BerkSmash1984 please verify that you can ping the Pi-hole URL from the MagicMirror devtools.

BerkSmash1984 commented 8 months ago

@sheyabernstein the MM and Pihole are running on the same device, a Raspberry Pi 4.

sheyabernstein commented 8 months ago

@BerkSmash1984 the apiURL in your config is not pointing to the Pi-hole API. Please check your config.

BerkSmash1984 commented 8 months ago

@sheyabernstein it 100% is pointing to the correct URL. It doesn't matter if I use IP or actual URL, with port 80 specified, or without

Directly from my RPI4:

image

image

MM config:

image

image

image

^^^ I tried all possible configs...

Still stuck on loading

image

sheyabernstein commented 8 months ago

The url in your screenshots point to the admin/dashboard page at /admin/index.php and the login page at /admin/login.php. Your url should end with admin/api.php for the API as defined in the readme.

This is also why you are seeing Expected JSON but received text/html in your errors. The url was pointing to a path that returns HTML.

Please open a new issue if you continue to have any trouble.

BerkSmash1984 commented 8 months ago

Ah let me take another look I must have missed that somehow, and will do. Thanks!

BerkSmash1984 commented 8 months ago

@sheyabernstein appreciate you handing in there with me! That was in fact the issue and the module is now working:

image

Thanks again!