Closed marcusramberg closed 5 years ago
Realized I was one version behind on pyruter. After upgrading I still get the error but the stack trace is different:
2018-10-22 14:28:27 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform ruter
Traceback (most recent call last):
File "/home/marcus/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/lib/python3.7/asyncio/tasks.py", line 412, in wait_for
return fut.result()
File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/marcus/homeassistant/custom_components/sensor/ruter.py", line 53, in setup_platform
add_devices([RuterSensor(stopid, destination, numer_of_departures)])
File "/home/marcus/homeassistant/custom_components/sensor/ruter.py", line 66, in __init__
self.update()
File "/home/marcus/homeassistant/custom_components/sensor/ruter.py", line 73, in update
self._line = result[self._index]['line']
IndexError: list index out of range
That API call does not return expected values.. It looks like subway lines (stations) have a different response from the Ruter API :/ Will look into it
Sorry for highjacking the same thread, but as the problem seems to be the same i'm writing here. I am experiencing the same problem with routes that are only trains. I get the same "IndexError: list index out of range". I tried from 7045100 to Oslo Sentralstasjon [tog] (Oslo).
Probably exactly the same error and reason, when I made this I only tested it with bus routes. I will probably have another version up soon (within a week or so)
@mkeeeey If you define a destination, that would have to be the final desination of the train, not where you are stepping off. for 7045100 I only see Eidsvoll
and Skien
@marcusramberg I will not update this sensor, the current version is the last version, I'm working on getting this into Home Assistant now. When that happens your stop ID will be available to use.
Departures: [{'destination': 'Mortensrud', 'line': '3', 'time': '2018-11-05T18:55:36+01:00'}, {'destination': 'Kolsås', 'line': '3', 'time': '2018-11-05T18:56:46+01:00'}, {'destination': 'Avløs', 'line': '3', 'time': '2018-11-05T19:02:46+01:00'}, {'destination': 'Mortensrud', 'line': '3', 'time': '2018-11-05T19:03:29+01:00'}, {'destination': 'Mortensrud', 'line': '3', 'time': '2018-11-05T19:11:32+01:00'}]
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Version of the custom_component 3.0.0 Describe the bug Component errors out on start I have the following config:
On startup I get this:
log