jonkristian / entur-card

Home Assistant Lovelace card card for the Entur public transport component.
MIT License
57 stars 6 forks source link

Error while setting up entur_public_transport platform for sensor #22

Closed palengh closed 3 years ago

palengh commented 3 years ago

This error occured the last days...

Logger: homeassistant.components.sensor Source: components/entur_public_transport/sensor.py:112 Integration: sensor (documentation, issues) First occurred: 15:02:26 (1 occurrences) Last logged: 15:02:26

Error while setting up entur_public_transport platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform await asyncio.shield(task) File "/usr/src/homeassistant/homeassistant/components/entur_public_transport/sensor.py", line 112, in async_setup_platform await data.expand_all_quays() File "/usr/local/lib/python3.8/site-packages/enturclient/api.py", line 108, in expand_all_quays if len(stop_place["quays"]) > 1: TypeError: 'NoneType' object is not subscriptable

Skjermbilde 2021-03-18 kl  22 33 27

The sensors are defined here:

Skjermbilde 2021-03-18 kl  22 34 20
jonkristian commented 3 years ago

This looks like something to do with the entur component itself. If you go to developer tools and look at the entities, can you see those sensors?

jonkristian commented 3 years ago

Closing this, feel free to re-open if you have any more information.

palengh commented 3 years ago

Hi, there! This issue is still there. Sorry for not getting back earlier. None of the sensors are available in the states view.

Error while setting up entur_public_transport platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/entur_public_transport/sensor.py", line 111, in async_setup_platform
    await data.expand_all_quays()
  File "/usr/local/lib/python3.8/site-packages/enturclient/api.py", line 108, in expand_all_quays
    if len(stop_place["quays"]) > 1:
TypeError: 'NoneType' object is not subscriptable
jonkristian commented 3 years ago

Hi. By looking at the error message, this seems to be related to the entur integration and not my card...

Kblund commented 3 years ago

Hi, there! This issue is still there. Sorry for not getting back earlier. None of the sensors are available in the states view.

Error while setting up entur_public_transport platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/entur_public_transport/sensor.py", line 111, in async_setup_platform
    await data.expand_all_quays()
  File "/usr/local/lib/python3.8/site-packages/enturclient/api.py", line 108, in expand_all_quays
    if len(stop_place["quays"]) > 1:
TypeError: 'NoneType' object is not subscriptable

I also stumbled on this error.

I figured the entur integration somehow got loaded before the configuration.YAML is read. which got me thinking: Perhaps the Entur Card is forcing the Entur integration to load up at the same time as Lovelace, which iguess in result also means it's loading up before the configuration.YAML is initialized.

Anyhow, i solved the error by uninstalling the Entur-card, and then i restarted the Core. Upon booting up all the sensors was loaded as expected. I then installed the card again and now everything is running as expected.

So, to reproduce this error:

  1. Start a clean install of Home Assistant.
  2. Install the Entur Card, and restart.
  3. setup the Entur integration, and restart.