flabbamann/aha_region

Sensors gone since core 2024.1.6

Closed this issue · 7 comments

All worked without problems but since the update the sensors were not available anymore.

I would be very thankful for any guidance

Same issue here on core 2024.2.1

Log entry:
`Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:344
Integration: Sensor (documentation, issues)
First occurred: February 11, 2024 at 14:30:31 (1 occurrences)
Last logged: February 11, 2024 at 14:30:31

Error while setting up aha_region platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/aha_region/sensor.py", line 71, in async_setup_platform
async_add_entities(
^
TypeError: 'NoneType' object is not iterable
`

Short update. I just activated debug logging for the component to get some details about the issue, but this time it initialized without issues and sensors are available.
Maybe it is a timeout issue in either communication with the website or between HA and the component?

Another restart. Entities are unavailable again. It seems to be a timeout on the aha website

2024-02-12 14:43:01.763 INFO (MainThread) [homeassistant.setup] Setting up aha_region
2024-02-12 14:43:01.764 INFO (MainThread) [homeassistant.setup] Setup of domain aha_region took 0.0 seconds
2024-02-12 14:43:02.616 INFO (MainThread) [homeassistant.components.sensor] Setting up aha_region.sensor
2024-02-12 14:43:02.650 DEBUG (MainThread) [custom_components.aha_region] Start async_update_data()
2024-02-12 14:43:02.650 DEBUG (MainThread) [custom_components.aha_region] Request data: {'gemeinde': '*redacted*', 'strasse': '*redacted*', 'hausnr': '*redacted*', 'hausnraddon': '', 'ladeort': ''}
2024-02-12 14:43:12.995 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform aha_region is taking over 10 seconds.
2024-02-12 14:43:13.372 ERROR (MainThread) [custom_components.aha_region] Timeout fetching aha Region data
2024-02-12 14:43:13.372 DEBUG (MainThread) [custom_components.aha_region] Finished fetching aha Region data in 10.723 seconds (success: False)
2024-02-12 14:43:13.976 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up aha_region platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/aha_region/sensor.py", line 71, in async_setup_platform
    async_add_entities(
                      ^
TypeError: 'NoneType' object is not iterable

Proposed changes in PR
#105

Hi @derolli1976 @ernsm
thanks for reporting and the PR!
The aha website seems to be a bit unreliable at times. Did increasing the timeout help for you?

Additionally I added a check to prevent the NoneType Error in #106. When this occurs, HA should automatically try again later.

Hi @flabbamann ,

Hi @derolli1976 @ernsm thanks for reporting and the PR! The aha website seems to be a bit unreliable at times. Did increasing the timeout help for you?

The timeout helped and I am running a locally modified version, which is working fine.

Additionally I added a check to prevent the NoneType Error in #106. When this occurs, HA should automatically try again later.

Thanks!