core: pi-hole broken after updating pi-hole web to 5.18
The problem
After updating pi-hole (and FTL and AdminLTE), all sensors except the update information are no longer available. Release notes AdminLTE: https://github.com/pi-hole/AdminLTE/releases/tag/v5.18
What version of Home Assistant Core has the issue?
core-2022.12.8
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
pihole
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?
2022-12-22 07:59:53.460 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entities for domain binary_sensor with platform pi_hole
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 692, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 789, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 211, in state
if (is_on := self.is_on) is None:
File "/usr/src/homeassistant/homeassistant/components/pi_hole/binary_sensor.py", line 87, in is_on
return self.entity_description.state_value(self.api)
File "/usr/src/homeassistant/homeassistant/components/pi_hole/const.py", line 164, in <lambda>
state_value=lambda api: bool(api.data.get("status") == "enabled"),
AttributeError: 'list' object has no attribute 'get'
2022-12-22 07:59:53.471 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform pi_hole
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 69, in native_value
return round(self.api.data[self.entity_description.key], 2)
TypeError: list indices must be integers or slices, not str
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 692, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 789, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 680, in state
value = self.native_value
File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 71, in native_value
return self.api.data[self.entity_description.key]
TypeError: list indices must be integers or slices, not str
2022-12-22 07:59:53.555 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up pi_hole platform for binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 692, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 789, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 211, in state
if (is_on := self.is_on) is None:
File "/usr/src/homeassistant/homeassistant/components/pi_hole/binary_sensor.py", line 87, in is_on
return self.entity_description.state_value(self.api)
File "/usr/src/homeassistant/homeassistant/components/pi_hole/const.py", line 164, in <lambda>
state_value=lambda api: bool(api.data.get("status") == "enabled"),
AttributeError: 'list' object has no attribute 'get'
2022-12-22 07:59:53.561 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up pi_hole platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 69, in native_value
return round(self.api.data[self.entity_description.key], 2)
TypeError: list indices must be integers or slices, not str
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 692, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 789, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 680, in state
value = self.native_value
File "/usr/src/homeassistant/homeassistant/components/pi_hole/sensor.py", line 71, in native_value
return self.api.data[self.entity_description.key]
TypeError: list indices must be integers or slices, not str
2022-12-22 07:59:54.273 ERROR (MainThread) [homeassistant.components.binary_sensor] pi_hole: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 715, in async_device_update
await task
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 392, in async_update
await self.coordinator.async_request_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 175, in async_request_refresh
await self._debounced_refresh.async_call()
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 82, in async_call
await task
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 201, in async_refresh
await self._async_refresh(log_failures=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 316, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 121, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 381, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 211, in state
if (is_on := self.is_on) is None:
File "/usr/src/homeassistant/homeassistant/components/pi_hole/binary_sensor.py", line 87, in is_on
return self.entity_description.state_value(self.api)
File "/usr/src/homeassistant/homeassistant/components/pi_hole/const.py", line 164, in <lambda>
state_value=lambda api: bool(api.data.get("status") == "enabled"),
AttributeError: 'list' object has no attribute 'get'
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 8
- Comments: 60 (16 by maintainers)
not an issue đ will work on a fix later this day
Just updated to 2023.1.0 but I am still getting this:
I have already restarted HA as well.
What is needed to get it working again?
After 2023.1.0 I am still not having any success. I have unloaded and re-loaded Pi-hole integration, but am still only getting the update sensors. For all other sensors, Iâm getting this message: This entity is no longer being provided by the pi_hole integration. If the entity is no longer in use, delete it in settings.
Getting this in HA logs: Error adding entities for domain binary_sensor with platform pi_hole 7:50:24 PM â (ERROR) Binary sensor - message first occurred at 7:49:33 PM and shows up 6 times Error adding entities for domain sensor with platform pi_hole 7:50:24 PM â (ERROR) Sensor - message first occurred at 7:49:33 PM and shows up 4 times
Do I need to do something else?
Issue has been fiexed in 2023.1.0, and confirmed working.
Thanks everyone!
The fix from @mib1185 was released: https://github.com/home-assistant-ecosystem/python-hole/releases/tag/0.8.0
That sounds very promising. Could you tell me where to find this file? Iâm running HA OS, maybe I need to login to the homeassistant container first.
Update: found it, solved it (temporarily until I can update HA Core to latest 2022.12):
docker exec -it homeassistant bash
vi /usr/local/lib/python3.10/site-packages/hole/__init__.py
--> apply changes --> save@bcutter the issue is already tagged with milestone 2022.12.9 so will be probably fixed next release. But hey itâs Open source and anyone even you can participate by fixing, improving or helping to. Nobody to blame. Every release with any Software can fix and cause new bugs. And yeah If you want to know you can downgrade pihole by switching the branch/tag but could be risky as every downgrade, couple weeks ago had to downgrade pihole after random ftl crashes.
Thanks all! I had to take off the Statistics only, then it prompted for API key and was successful.
For what itâs worth, applying the changes in this PR, fixed the issue for me. So if this is causing you pain thatâs a potential stop-gap. Itâs just two lines in the init.py for hole.
Crap⌠had i know this⌠ah wellâŚ
I think there is a problem in the ui setup. Try unchecking âstatistics onlyâ. In the next step it should ask for api key.
Analyzing code I think it seems to not ask for that if statistic only is checked. But will try it later in my instance.
For me currently everything works and is running after 2023.1. But I had API key configuered before.
The API is not asked when adding the pi hole integration. Tried to see if thereâs a pi hole file in the config folder but didnât see anything
i think the api endpoint should be
summaryRaw
instead ofsummary
⌠will update it in https://github.com/home-assistant-ecosystem/python-hole/pull/14Thanks that did it.
I removed the integration and added it back. You uncheck the checkbox for âOnly Statisticsâ when you re-add the integration. Youâll be prompted for a Token then. You get the Token via settings/API in in the Pi Hole Web Interface.
But it is kinda fingepointing in my eyes. But what really makes be angry is on the one hand saying
linking a post from latest month that even when the pihole integration had this on the map and already implemented. Would it be probably fixed in the 2022.12 release but then telling
This really makes to sense to me on the one hand saying YOU did your homework and the pihole integrations maintainers not but even when they had this on the map YOU would have ran into this âavoidable issueâ ⌠contradictory
Sorry I know it is a little bit offtopic and not adding anything informative to the actual issue/topic. But I just want to point out that things like this happen and can not be expected from a free (excluding nabu casa users) product which rely on community contributions. This reminds me of javascript developers deleting their free to use libraries because of fingerpointing, threatening etc. I know that the issue has impact on some of the home assistant instances (mine included) but just be patient and polite đ
I am thankful for every âworkaroundâ and also for the fast reaction of initiating a fix of such impacting problems @mib1185 đ
as I wrote in https://github.com/home-assistant/core/issues/84422#issuecomment-1362814271 the used python library needs to be updated to use the token during api call
Look at https://pi-hole.net/blog/2022/11/17/upcoming-changes-authentication-for-more-api-endpoints-required/ API token required!