Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] EDUPAGE unexpected login error: list index out of range #70

Open
mgrfilipmarek opened this issue Dec 18, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@mgrfilipmarek
Copy link
Collaborator

Describe the bug
login error and after that next issues with getStudents and unidecode.
(I guess) this issue occurs in this scenario:

  • HA with edupage integration is down for some time
  • login session is time-outed
  • login method throws "list index out of range"
  • get_students() throws NotLoggedInException
  • unidecode throws error because student_name = unknown

This error originated from a custom integration.
Logger: custom_components.homeassistantedupage.homeassistant_edupage
Source: custom_components/homeassistantedupage/homeassistant_edupage.py:45
integration: homeassistantedupage (documentation, issues)
First occurred: 8:07:46 AM (9 occurrences)
Last logged: 8:25:10 AM
EDUPAGE unexpected login error: list index out of range

This error originated from a custom integration.
Logger: custom_components.homeassistant_edupage
Source: custom_components/homeassistantedupage/init.py:133
integration: homeassistant_edupage
First occurred: 8:11:03 AM (6 occurrences)
Last logged: 8:25:12 AM
INIT Failed to fetch timetable: EDUPAGE error updating get_students() data from API:

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:365
integration: Sensor (documentation, issues)
First occurred: 8:22:04 AM (2 occurrences)
Last logged: 8:25:12 AM
Error while setting up homeassistantedupage platform for sensor
Traceback (most recent call last):
File "/workspaces/core/homeassistant/helpers/entity_platform.py", line 365, in _async_setup_platform
await asyncio.shield(awaitable)
File "/workspaces/core/config/custom_components/homeassistantedupage/sensor.py", line 45, in async_setup_entry
notify = EduPageNotificationSensor(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/core/config/custom_components/homeassistantedupage/sensor.py", line 121, in init
self.student_name = unidecode(student_name).replace(' ', '').lower()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/ha-venv/lib/python3.12/site-packages/unidecode/init.py", line 60, in unidecode_expect_ascii
bytestring = string.encode('ASCII')
^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'

Screenshots
image

@mgrfilipmarek mgrfilipmarek added the bug Something isn't working label Dec 18, 2024
@bbirnbach
Copy link
Collaborator

  • HA with edupage integration is down for some time

Without taking a deeper look I'm pretty sure that this is a problem because of the saved session (which is needed to not handle 2FA). I think the session is timed out and needs a re-login. For users without 2FA it could be a solution to catch that specific error and continue with "normal" login.
Sounds like the whole login process has to be refactored :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants