PiotrMachowski / Home-Assistant-custom-components-Hydro-IMGW

This custom integration retrieves data from hydro stations from hydro.imgw.pl.
MIT License
14 stars 6 forks source link

Error adding hydro entitie #14

Closed MichalBiegajlo closed 2 months ago

MichalBiegajlo commented 2 months ago

hydro_imgw sensor in configuration.yaml looks like:

- platform: hydro_imgw
   station_id: "152230070"
   name: "KrznaMalowaGora"

Output from plugin debug:

Rejestrator: homeassistant.components.sensor Źródło: helpers/entity_platform.py:736 integracja: Sensor (dokumentacja, Problemy) Pierwsze zdarzenie: 10:24:21 (1 zdarzenia) Ostatnio zalogowany: 10:24:21

Error adding entity sensor.hydro_imgw_152230070 for domain sensor with platform hydro_imgw Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 736, in _async_add_entity entity_name = entity.name ^^^^^^^^^^^ File "/config/custom_components/hydro_imgw/sensor.py", line 43, in name name = self._station_id if self._data is None else self.extra_state_attributes["name"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/hydro_imgw/sensor.py", line 70, in extra_state_attributes attr_value = HydroImgwSensor.extractor(self._data, json_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/hydro_imgw/sensor.py", line 94, in extractor return extractor_arr(json, path.split(".")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/hydro_imgw/sensor.py", line 91, in extractor_arr return extractor_arr(json_obj[path_array[0]], path_array[1:]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/hydro_imgw/sensor.py", line 91, in extractor_arr return extractor_arr(json_obj[path_array[0]], path_array[1:]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/hydro_imgw/sensor.py", line 88, in extractor_arr if path_array[0] not in json_obj: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: argument of type 'NoneType' is not iterable

Other stations are working correctly; the problem occurs only with this one.

PiotrMachowski commented 2 months ago

Ta stacja nie zwraca aktualnych wartości: image

Dodatkowo, aktualnie w HA jest wbudowana integracja z Hydro IMGW: https://www.home-assistant.io/integrations/imgw_pib/