home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.65k stars 30.41k forks source link

pi-hole: Can not load data from *hole: xxx.xxx.xxx.xxx #26806

Closed tiagofreire-pt closed 3 years ago

tiagofreire-pt commented 5 years ago

Home Assistant release with the issue: 0.99.2

Last working Home Assistant release (if known): 0.98.5

Operating environment (Hass.io/Docker/Windows/etc.): Hassio

Component/platform: Pi-hole

Description of problem:

Can not load data from *hole: xxx.xxx.xx.xxx

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

pi_hole:
  host: !secret pi-hole_host

Traceback (if applicable):

Can not load data from *hole: xxx.xxx.xx.xxx

Additional information: This was working until the 0.99.2 HA upgrade.

probot-home-assistant[bot] commented 5 years ago

Hey there @fabaff, @johnluetke, mind taking a look at this issue as its been labeled with a integration (pi_hole) you are listed as a codeowner for? Thanks!

mh-daedalus commented 5 years ago

Have you tried below? I'm assuming you're using the pihole addon with hass.io

pi_hole:
  host: localhost:4865
johnluetke commented 5 years ago

@tiagofreire-pt please try adding :4865 to the end of the hostname

tiagofreire-pt commented 5 years ago

@tiagofreire-pt please try adding :4865 to the end of the hostname

No luck either.

tiagofreire-pt commented 5 years ago

@johnluetke, the solution is here: https://community.home-assistant.io/t/0-99-withings-device-automations-launch-home-assistant-cast-from-python/137960/175?u=redalert

Maybe the default value should be "false", as it's the standard for a default setting pi-hole installation.

johnluetke commented 5 years ago

Good thought. The default SSL values for the HA integration were not changed during the refactor, but this is a good place to start investigating

fenio commented 5 years ago

For me it still doesn't work. I'm not using addon but separate pi_hole instance on another machine. Since upgrade to 0.99.x whatever I set in configuration.yaml I'm getting:

2019-10-02 07:58:02 ERROR (MainThread) [hole] Can not load data from *hole: 192.168.0.200:8080 2019-10-02 07:58:02 ERROR (MainThread) [homeassistant.components.pi_hole] Unable to fetch data from Pi-hole

My config is: pi_hole: host: '192.168.0.200:8080' ssl: false verify_ssl: false

It worked fine before update (of course assuming it wasn't separate component but part of sensors). What else can I check here?

Coolie1101 commented 5 years ago

Experiencing issues as well on Hassbian, HA 0.99.3, with Pi-hole Version v4.3.2 running on a different machine.

Config

sensor:
  - platform: pi_hole
    host: 192.168.200.209:80
    verify_ssl: false

HA Log

2019-10-02 10:26:14 ERROR (MainThread) [homeassistant.setup] Error during setup of component pi_hole
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/setup.py", line 168, in _async_setup_component
    hass, processed_config
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/pi_hole/__init__.py", line 47, in async_setup
    conf = config[DOMAIN]
KeyError: 'pi_hole'
2019-10-02 10:26:14 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform pi_hole.sensor: Unable to set up component.
johnluetke commented 5 years ago

@Coolie1101 You'll need to change your config. See the new Pi-hole component configuration: https://www.home-assistant.io/integrations/pi_hole

johnluetke commented 5 years ago

@fenio After 5 minutes or so, the Pi-Hole component should refresh its data. Does the error occur then as well?

Coolie1101 commented 5 years ago

All good. Moved Pi-Hole to configuration.yaml as below.

pi_hole
  host: 192.168.200.209:80
  verify_ssl: false

Can we not use Pi-hole in packages?

johnluetke commented 5 years ago

@Coolie1101 Configuration packages? Like include_dir_named? Thats how my instance is configured and it's working.

fenio commented 5 years ago

Yeah it turned out that I've got that entry in log just after bootup... otherwise it actually works. Which makes me think that maybe that component is being started before network or something like that? No idea about HA internals... just guessing ;)

Coolie1101 commented 5 years ago

@Coolie1101 Configuration packages? Like include_dir_named? Thats how my instance is configured and it's working.

Not working for me with the following in Includes>Packages>pihole.yaml, but worked prior.

sensor:
  - platform: pi_hole
    host: 192.168.200.209:80
    verify_ssl: false
fenio commented 5 years ago

@Coolie1101 since HA 0.99.x pi_hole is separate component. Take a look into current configuration.

It can't be under sensor.

So instead of

sensor:
  - platform: pi_hole

it needs to be: pi_hole:

Coolie1101 commented 5 years ago

it needs to be: pi_hole:

Awesome, thanks for the clarification, works great.

joaopsys commented 4 years ago

Having this exact issue on hassio 0.101 as well. For some reason this doesn't work (while the previous sensor structure worked flawlessly):

pi_hole:
  host: pihole-01.domain.sh
  name: pihole1
  ssl: true           
  verify_ssl: true

The server has a valid certificate, signed by a trusted CA. I can curl the pihole admin interface from hassio. Getting this error from home asssistant:

2019-11-07 00:03:29 ERROR (MainThread) [hole] Can not load data from *hole: pihole-01.domain.sh
2019-11-07 00:03:29 ERROR (MainThread) [homeassistant.components.pi_hole] Unable to fetch data from Pi-hole
joaopsys commented 4 years ago

It seems that after leaving it for 5 minutes, it starts working on the next refresh :)

tiagofreire-pt commented 4 years ago

This is weird, as the pi-hole has all the the data availability from the start.

shack31b commented 4 years ago

Facing the same issue with HA (0.100.3) running in venv. curl commands are working on standard port 80 to communicate (disable/enable/state), sensors are showing up but no data is provided.

pkishino commented 4 years ago

Yeah, this is a problem that keeps coming back for me as well..I can even curl and use the pihole python lib correctly on my osx install to fetch data.. but somehow HA cannot

johnluetke commented 4 years ago

Thanks for the info all. I've traced this down to a race condition when HA first starts up. Like @joaopsys mentioned, it will update on the next refresh. I have another change in the pipeline right now, but will be tackling this one next

whattheschnell commented 4 years ago

I'm still seeing this issue even after attempted refresh.

HA v0.103.5

dkalinai commented 4 years ago

Just encountered the same... worked fine before now just always hitting this on hass.os restart...

dominate4life commented 4 years ago

I was able to fix mine by changing to port from '4865' to '80' and haven't had issue. I am running the PiHole on a different VM. Not within my Home Assistant.

networkpotato commented 4 years ago

Same "problem" here on 0.106.2

Getting the error on startup but after 5 minutes the entities load fine.

lbouriez commented 4 years ago

Hello, getting this error on the last update. Didn't notice it before. I have a pi_hole.yaml with the following content:

pi_hole:
  host: localhost:4865
ochstobi commented 4 years ago

Hello I have the same problem with HA 0.107.7

I try to integrate pi-hole to my home assistant. Just a little bit about my general setup. Iā€™m running all services as docker container on an synology nas (HA with HTTPS, pi-hole HTTP). To integrate pi-hole I added:

pi_hole:
  - host: http://myserver:8181
    ssl: false
    verify_ssl: false

In the HA logs I get the following error:

2020-03-24 18:21:27 ERROR (MainThread) [hole] Can not load data from *hole: http://myserver:8181
2020-03-24 18:21:27 ERROR (MainThread) [homeassistant.components.pi_hole] Unable to fetch data from Pi-hole

I have tried to curl from my host network on synology curl -X GET http://myserver:8181/admin/api.php and then I get the informations, so I think pi-hole is working correctly and is available.

Because I have connected HA to the internet I have enabled HTTPS and gave certificates to HA. Could this be a problem? That HA runs with HTTPS and pi-hole with HTTP?

gaving commented 4 years ago

For anybody stumbling across this I had to explicitly set verify_ssl to false despite having certs mounted and being able to curl on the container.

pi_hole:
  - host: pihole.nuc.local
   ssl: true
   verify_ssl: false

Couldn't work out how to enable more verbose debugging, but this sorted it through trial and error!

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment šŸ‘ This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

NeoPolus commented 4 years ago

Still happens on last version (0.114.0). On launch it gives this error + warning on the log (but the pi-hole sensors are available on HA afterwards):

2020-08-13 11:38:41 ERROR (MainThread) [hole] Can not load data from *hole: localhost:80
2020-08-13 11:38:41 WARNING (MainThread) [homeassistant.config_entries] Config entry for pi_hole not ready yet. Retrying in 5 seconds

This is my config:

pi_hole:
  host: localhost:80
  ssl: false
  verify_ssl: false
  api_key: !secret pihole_api_key

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment +1 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

pw-sys commented 4 years ago

Still present in Home Assistant 0.114.4 for me. I cannot add it via the gui nor the configuration.yaml. Can not load data from *hole: xxxxxxxxxxxxx:80

maurerle commented 4 years ago

I used the Pi-Hole integration (by going to integrations-> add -> Pihole) which works very well so far. Make sure, that you can wget the site you want to access from inside the docker container

viktak commented 3 years ago

I also have this error showing up in the logs on the latest version of HA (0.118.2). However, the sensor is working fine: pihole1

rocket4321 commented 3 years ago

I've seen this error as well, so will share what I've pushed forward with.

Can not load data from *hole: xxxxxxxxxxxxx:80

This error is from the 'hole' python package, not the pi_hole component. The package's definition of 'async def get_data(self)' includes a hard-code timeout value of 5 seconds, which cannot be overridden without a code change.

My preference would be to allow the component to define this timeout value, especially since at startup, this value should be increased due to increased resource demands (IMHO).

As such, I have opened an issue here: https://github.com/home-assistant-ecosystem/python-hole/issues/6

If a code changes are supported, we could then alter the pi_hole component to allow the user to define both a timeout for connection with each pi-hole instance, and a scan interval to define how often the data is updated.

lindsaymarkward commented 3 years ago

Thanks for the update @rocket4321 - I hope we can move forward with fixing this error.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment šŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.