JonasJoKuJonas / homeassistant-WebUntis

Custom component to access data from Web Untis in Home Assistant
https://community.home-assistant.io/t/webuntis-timetable-in-ha/568273
MIT License
52 stars 12 forks source link

Error if no subjects in lesson #97

Closed YuulGer closed 11 months ago

YuulGer commented 11 months ago

The problem

Tried to setup the integration.

Now I get "Fehler beim Einrichten".

It seems that I'm logged in, because I can see our subject names.

Don't know if I made a mistake in the setup or if our Webuntis don't wanna share it's secrets :)

Version of Home Assistant?

2023.11.0

What type of installation are you running?

Home Assistant OS

Version of WebUntis

2024.4.0 3c9b163a4fae7de3828e92c6ef3e0aed59888002

Last working WebUntis version

No response

Traceback/Error logs

Logger: homeassistant.config_entries Source: config_entries.py:402 First occurred: 15:59:59 (2 occurrences) Last logged: 16:00:52

Error setting up entry ln for webuntis Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/webuntis/init.py", line 56, in async_setup_entry await server.async_update() File "/config/custom_components/webuntis/init.py", line 206, in async_update await self._async_status_request() File "/config/custom_components/webuntis/init.py", line 285, in _async_status_request self.next_class = await self._hass.async_add_executor_job(self._next_class) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/webuntis/init.py", line 504, in _next_class if lesson.start > now and self.check_lesson(lesson): ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/webuntis/init.py", line 717, in check_lesson if not lesson.subjects: ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/webuntis/utils/misc.py", line 30, in get obj.dict[self.name] = result = self.fget(obj) ^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/webuntis/objects.py", line 355, in subjects return self._session.subjects(from_cache=True).filter( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/webuntis/objects.py", line 163, in filter data=[self.filter({key: v})[0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/webuntis/objects.py", line 163, in data=[self.filter(**{key: v})[0]


  File "/usr/local/lib/python3.11/site-packages/webuntis/objects.py", line 180, in __getitem__
    data = self._data[i]  # fails if there is no such item
           ~~~~~~~~~~^^^
IndexError: list index out of range

### Additional information

_No response_
JonasJoKuJonas commented 11 months ago

should be working in next release