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
53 stars 12 forks source link

Schuljahrwechsel funktioniert nicht #141

Open chrfriese123 opened 1 month ago

chrfriese123 commented 1 month ago

The problem

Bei der Einrichtung der Integration wurde "Schüler" gewählt. Im alten Schuljahr (2023/2024) wurden die Daten auch zuverlässig abgerufen. Ich habe den Eindruck, dass auch jetzt das Einloggen problemlos funktioniert. Aber... es werden keine Einträge angezeigt.

Das Anlegen eines neuen Schülers hat auch nicht geholfen...

Das einzige, das mir in den Logs auffällt sind die zwei Zeilen:

2024-09-09 07:35:36.651 DEBUG (SyncWorker_5) [webuntis] Got data{"jsonrpc":"2.0","id":"2024-09-09 07:35:36.593417","result":[{"id":14,"name":"2023/2024","startDate" 2024-09-09 07:35:36.659 INFO (MainThread) [custom_components.webuntis] No active schoolyear 'kepi tuebingen@xxx@xxx.de'

Kann es sein, dass noch nach Terminen für das Schuljahr "2023/24" gesucht wird? Muss ich das irgendwo umstellen?

Vielen Dank für die Hilfe.

Version of Home Assistant?

2024.8.0

What type of installation are you running?

Home Assistant OS

Version of WebUntis

v1.2.0

Last working WebUntis version

No response

Traceback/Error logs

2024-09-09 07:35:36.081 DEBUG (MainThread) [custom_components.webuntis] Creating server instance for 'xxx@xxx.de' (kepi tuebingen) 2024-09-09 07:35:36.084 DEBUG (MainThread) [webuntis] The URL given doesn't seem to be a valid URL, just gonna prepend "https://" 2024-09-09 07:35:36.088 DEBUG (SyncWorker_48) [webuntis] Making new request: 2024-09-09 07:35:36.089 DEBUG (SyncWorker_48) [webuntis] URL: https://tipo.webuntis.com/WebUntis/jsonrpc.do?school=kepi tuebingen 2024-09-09 07:35:36.590 DEBUG (SyncWorker_48) [webuntis] Valid JSON found 2024-09-09 07:35:36.591 DEBUG (SyncWorker_48) [webuntis] Got data{"jsonrpc":"2.0","id":"2024-09-09 07:35:36.088863","result":{"sessionId":"xxx 2024-09-09 07:35:36.591 DEBUG (SyncWorker_48) [webuntis] Did get a jsessionid from the server: xxx 2024-09-09 07:35:36.593 DEBUG (SyncWorker_5) [webuntis] Making new request: 2024-09-09 07:35:36.593 DEBUG (SyncWorker_5) [webuntis] URL: https://tipo.webuntis.com/WebUntis/jsonrpc.do?school=kepi tuebingen 2024-09-09 07:35:36.594 DEBUG (SyncWorker_5) [webuntis] DATA: {'id': '2024-09-09 07:35:36.593417', 'method': 'getSchoolyears', 'params': {}, 'jsonrpc': '2.0'} 2024-09-09 07:35:36.651 DEBUG (SyncWorker_5) [webuntis] Valid JSON found 2024-09-09 07:35:36.651 DEBUG (SyncWorker_5) [webuntis] Got data{"jsonrpc":"2.0","id":"2024-09-09 07:35:36.593417","result":[{"id":14,"name":"2023/2024","startDate" 2024-09-09 07:35:36.659 INFO (MainThread) [custom_components.webuntis] No active schoolyear 'kepi tuebingen@xxx@xxx.de' 2024-09-09 07:35:36.669 DEBUG (SyncWorker_21) [webuntis] Making new request: 2024-09-09 07:35:36.669 DEBUG (SyncWorker_21) [webuntis] URL: https://tipo.webuntis.com/WebUntis/jsonrpc.do?school=kepi tuebingen 2024-09-09 07:35:36.669 DEBUG (SyncWorker_21) [webuntis] DATA: {'id': '2024-09-09 07:35:36.668921', 'method': 'logout', 'params': {}, 'jsonrpc': '2.0'} 2024-09-09 07:35:36.708 DEBUG (SyncWorker_21) [webuntis] Valid JSON found 2024-09-09 07:35:36.708 DEBUG (SyncWorker_21) [webuntis] Got data{"jsonrpc":"2.0","id":"2024-09-09 07:35:36.668921","result":null}

Additional information

No response

drschlaumeier commented 1 month ago

same with me...nothing could be read image

drschlaumeier commented 1 month ago

... and one more info: seems that integration searches the wrong schoolyear 2007/2008:

2024-09-09 08:56:33.932 DEBUG (SyncWorker_45) [webuntis] Making new request: 2024-09-09 08:56:33.932 DEBUG (SyncWorker_45) [webuntis] URL: https://xxxxxxxxxxxx.webuntis.com/WebUntis/jsonrpc.do?school=xxxxxxxxxxxxx 2024-09-09 08:56:33.932 DEBUG (SyncWorker_45) [webuntis] DATA: {'id': '2024-09-09 08:56:33.932356', 'method': 'getSchoolyears', 'params': {}, 'jsonrpc': '2.0'} 2024-09-09 08:56:34.167 DEBUG (SyncWorker_45) [webuntis] Valid JSON found 2024-09-09 08:56:34.168 DEBUG (SyncWorker_45) [webuntis] Got data{"jsonrpc":"2.0","id":"2024-09-09 08:56:33.932356","result":[{"id":1,"name":"2007/2008","startDate": 2024-09-09 08:56:34.176 INFO (MainThread) [custom_components.webuntis] No active schoolyear 'xxxxxxxxxxxx@xxxxxxxxxxxxxxx' 2024-09-09 08:56:34.177 DEBUG (SyncWorker_3) [webuntis] Making new request: 2024-09-09 08:56:34.178 DEBUG (SyncWorker_3) [webuntis] URL: https://xxxxxxxxx.webuntis.com/WebUntis/jsonrpc.do?school=xxxxxxxxxxxx 2024-09-09 08:56:34.179 DEBUG (SyncWorker_3) [webuntis] DATA: {'id': '2024-09-09 08:56:34.177679', 'method': 'logout', 'params': {}, 'jsonrpc': '2.0'} 2024-09-09 08:56:34.207 DEBUG (SyncWorker_3) [webuntis] Valid JSON found 2024-09-09 08:56:34.208 DEBUG (SyncWorker_3) [webuntis] Got data{"jsonrpc":"2.0","id":"2024-09-09 08:56:34.177679","result":null}

JonasJoKuJonas commented 1 month ago

... and one more info: seems that integration searches the wrong schoolyear 2007/2008:

The integration retrieves all school years and looks for those that have the current date between the start and end date

macmeck commented 1 month ago

can we actually see all the school years that are being retrieved in the logs? I am facing similar issues and this is all I can find

2024-09-09 23:01:17.504 DEBUG (SyncWorker_3) [webuntis] DATA: {'id': '2024-09-09 23:01:17.503907', 'method': 'getSchoolyears', 'params': {}, 'jsonrpc': '2.0'}
2024-09-09 23:01:17.550 DEBUG (SyncWorker_3) [webuntis] Valid JSON found
2024-09-09 23:01:17.550 DEBUG (SyncWorker_3) [webuntis]   Got data{"jsonrpc":"2.0","id":"2024-09-09 23:01:17.503907","result":[{"id":2,"name":"2019/2020","startDate":
JonasJoKuJonas commented 1 month ago

These logs are createt by the python module and crop the data. So i will add a debug log in my integration so we can retrieve all school years to find the error

chrfriese123 commented 1 month ago

Quick update: I restarted my home assistant and suddenly the integration works and loads the timetable. Everything is fine. Maybe some variable isn't uploaded by a simple integration reload but requires a full system restart.

Thanks but it works for me now.

jschanz commented 1 month ago

I had to enable the JSON flag to retrieve the events. Otherwise everything was empty and not data was loaded. Instead I got the following message, when I clicked on an entity:

"JSON data is disabled - activate it in the options"

drschlaumeier commented 1 month ago

@chrfriese123 ... yes, you are right. A restart of HA helped. Hmm, very odd bcs I restarted after installation via HACS.

kuechr4 commented 1 month ago

Maby it was because the setup was compleat bevor the first day of the school year. I will look in to it.

kuechr4 commented 1 month ago

I had to enable the JSON flag to retrieve the events. Otherwise everything was empty and not data was loaded. Instead I got the following message, when I clicked on an entity:

"JSON data is disabled - activate it in the options"

Normals the message is displayed so you know the functionality of json is available. But the integration should work fine without it to.

macmeck commented 1 month ago

I think this is rather related to the start of the new school year and that data is now available. For me it also worked shortly after I posted my logs yesterday...