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

Exception because schoolyear is null #134

Closed mtdcr closed 2 months ago

mtdcr commented 2 months ago

The problem

While trying to add the account for next school year during the summer holidays, an exception occurred. Using the account in Untis Mobile was already possible (without any data in it).

Version of Home Assistant?

2024.8.1

What type of installation are you running?

Home Assistant Container

Version of WebUntis

v1.1.4

Last working WebUntis version

No response

Traceback/Error logs

2024-08-17 13:35:02.716 ERROR (SyncWorker_34) [webuntis] {'jsonrpc': '2.0', 'id': '2024-08-17 13:35:02.648815', 'error': {'message': 'Cannot invoke "com.grupet.web.basic.Schoolyear.getEndDate()" because "schoolyear" is null', 'code': -8998}}
2024-08-17 13:35:02.717 ERROR (MainThread) [custom_components.webuntis.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/.local/lib/python3.12/site-packages/webuntis/utils/remote.py", line 123, in _parse_result
    return result_body[u'result']
           ~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'result'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/webuntis/config_flow.py", line 165, in async_step_user
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/webuntis/config_flow.py", line 93, in validate_input
    klassen = await hass.async_add_executor_job(session.klassen)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.local/lib/python3.12/site-packages/webuntis/utils/misc.py", line 156, in inner
    data = self._request(jsonrpc_method, jsonrpc_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.local/lib/python3.12/site-packages/webuntis/session.py", line 118, in _request
    data = rpc_request(self.config, method, params or {})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.local/lib/python3.12/site-packages/webuntis/utils/remote.py", line 91, in rpc_request
    return _parse_result(request_body, result_body)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.local/lib/python3.12/site-packages/webuntis/utils/remote.py", line 125, in _parse_result
    _parse_error_code(request_body, result_body)
  File "/.local/lib/python3.12/site-packages/webuntis/utils/remote.py", line 143, in _parse_error_code
    raise exc
webuntis.errors.RemoteError: Cannot invoke "com.grupet.web.basic.Schoolyear.getEndDate()" because "schoolyear" is null

Additional information

No response