8000 Pi_hole integration doesn't work on pi_hole V6 · Issue #130245 · home-assistant/core · GitHub
[go: up one dir, main page]

Skip to content
Pi_hole integration doesn't work on pi_hole V6 #130245
@Marcoevich

Description

@Marcoevich

The problem

On pi-hole V6, of which release is imminent, the integration no longer works. This is probably because the API has moved from pi.hole/admin/api to pi.hole/api

See:

image

image

Please make the integration recognize the new location.

What version of Home Assistant Core has the issue?

core-2024.11.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

pi_hole

Link to integration documentation on our website

https://www.home-assistant.io/integrations/pi_hole

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 111, in native_value
    return round(self.api.data[self.entity_description.key], 2)  # type: ignore[no-any-return]
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ads_blocked_today'

=========================================================

2024-11-09 21:48:25.790 DEBUG (MainThread) [hole] Response from *hole: 400
2024-11-09 21:48:25.791 DEBUG (MainThread) [hole] {'error': {'key': 'bad_request', 'message': 'Bad request', 'hint': 'The API is hosted at pi.hole/api, not pi.hole/admin/api'}, 'took': 0.0004820823669433594}
2024-11-09 21:48:25.863 DEBUG (MainThread) [hole] Response from *hole: 400
2024-11-09 21:48:25.863 DEBUG (MainThread) [hole] {'error': {'key': 'bad_request', 'message': 'Bad request', 'hint': 'The API is hosted at pi.hole/api, not pi.hole/admin/api'}, 'took': 0.0003046989440917969}
2024-11-09 21:48:25.864 DEBUG (MainThread) [homeassistant.components.pi_hole] Finished fetching Pi-Hole data in 0.154 seconds (success: True)
2024-11-09 21:48:25.865 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 266, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 481, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 176, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 561, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 544, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 111, in native_value
    return round(self.api.data[self.entity_description.key], 2)  # type: ignore[no-any-return]
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ads_blocked_today'

=========================================================

Logger: homeassistant.components.binary_sensor
Source: helpers/entity_platform.py:728
integration: Binary sensor (documentation, issues)
First occurred: 14:03:25 (2 occurrences)
Last logged: 21:31:33

pi_hole: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 728, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1302, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 599, in async_update
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 273, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 114, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 358, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 481, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 176, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 561, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 544, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 111, in native_value
    return round(self.api.data[self.entity_description.key], 2)  # type: ignore[no-any-return]
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ads_blocked_today'

=====================================================

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:918
integration: Sensor (documentation, issues)
First occurred: 14:03:25 (18 occurrences)
Last logged: 21:31:33

Error adding entity sensor.pi_hole_domains_blocked_2 for domain sensor with platform pi_hole
Error adding entity sensor.pi_hole_dns_queries_cached_2 for domain sensor with platform pi_hole
Error adding entity sensor.pi_hole_dns_queries_forwarded_2 for domain sensor with platform pi_hole
Error adding entity sensor.pi_hole_dns_unique_clients_2 for domain sensor with platform pi_hole
Error adding entity sensor.pi_hole_dns_unique_domains_2 for domain sensor with platform pi_hole
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 918, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1368, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 544, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 111, in native_value
    return round(self.api.data[self.entity_description.key], 2)  # type: ignore[no-any-return]
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ads_blocked_today'

Additional information

The integration setup only allows a hostname or ip adress, but it doesn't allow to point the api to pi.hole/api instead of pi.hole/admin/api

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0