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

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

Error adding entities #6

Closed b3cksy closed 2 years ago

b3cksy commented 2 years ago

Hi there @PiotrMachowski, I've made installation via HACS and cannot get any enitities.

hydro_imgw sensor in configuration.yaml looks like:

  - platform: hydro_imgw
    name: Pilica
    station_id: "250190210"

Logger: homeassistant.components.sensor Source: custom_components/hydro_imgw/sensor.py:93 Integration: Sensor (documentation, issues) First occurred: 14:38:37 (2 occurrences) Last logged: 14:38:39

Error adding entities for domain sensor with platform hydro_imgw Error while setting up hydro_imgw platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 614, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 799, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state if (state := self.state) is None: File "/config/custom_components/hydro_imgw/sensor.py", line 53, in state self._state = HydroImgwSensor.extractor(self._data, "status.currentState.value") File "/config/custom_components/hydro_imgw/sensor.py", line 95, in extractor return extractor_arr(json, path.split(".")) File "/config/custom_components/hydro_imgw/sensor.py", line 92, in extractor_arr return extractor_arr(json_obj[path_array[0]], path_array[1:]) File "/config/custom_components/hydro_imgw/sensor.py", line 92, in extractor_arr return extractor_arr(json_obj[path_array[0]], path_array[1:]) File "/config/custom_components/hydro_imgw/sensor.py", line 93, in extractor_arr return json_obj[path_array[0]] TypeError: 'NoneType' object is not subscriptable

PiotrMachowski commented 2 years ago

This is a meteo station, not hydro, so it's not supported