flabbamann/aha_region

Error when setting up, even with example data

Closed this issue · 3 comments

gafk commented

I tried to setup with my address and failed. But even when entering the example data from the docu into my configurtation.yaml, I get the following error after restarting HA:

Logger: custom_components.aha_region
Source: helpers/update_coordinator.py:197
Integration: aha region ([documentation](https://github.com/flabbamann/aha_region), [issues](https://github.com/flabbamann/aha_region/issues))
First occurred: 06:32:15 (1 occurrences)
Last logged: 06:32:15
Timeout fetching aha Region data
Logger: homeassistant
Source: custom_components/aha_region/sensor.py:77
Integration: aha region ([documentation](https://github.com/flabbamann/aha_region), [issues](https://github.com/flabbamann/aha_region/issues))
First occurred: 06:32:25 (1 occurrences)
Last logged: 06:32:25
Error doing job: Task exception was never retrieved

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in async_add_entities
    tasks = [
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in <listcomp>
    tasks = [
  File "/config/custom_components/aha_region/sensor.py", line 62, in <genexpr>
    AhaWasteSensor(coordinator, wastetype) for wastetype in ABFALLARTEN
  File "/config/custom_components/aha_region/sensor.py", line 77, in __init__
    self._attr_native_value = self.coordinator.data[self._name]
TypeError: 'NoneType' object is not subscriptable

Anything I am doing wrong?

There is a timeout when loading the data. Is https://www.aha-region.de/ reachable from your HA installation?
Or maybe 10 seconds is too low in case you have a bad connection. You could try to set a higher timeout value in this line:
https://github.com/flabbamann/aha_region/blob/master/custom_components/aha_region/coordinator.py#L75

gafk commented

Sorry for the late reply. I finally did some further testing and putting quotation marks around the entries in the YAML fixed it. I just recently moved from Openhab to Home Assistant and am still learning...

sensor:
  - platform: aha_region
    gemeinde: "Hannover"
    strasse: "00152@Am Küchengarten / Linden-Mitte@Linden-Mitte"
    hausnr: "11"

Hi @gafk, thanks for letting me know. Happy it's working now 😃. I'll update the readme 👍