Comments (12)
bug fixed in v0.4.2
from homeassistant-webuntis.
Ich brauche den Traceback um nachzuvollziehen welcher Teil des Programmes den Fehler bei dir auslöst!
from homeassistant-webuntis.
Sorry, da wird kein Traceback ausgegeben (auch nicht, wenn ich webuntis im Logger auf DEBUG stelle). Man sieht aber im Log, welche Stellen den Fehler verursachen:
from homeassistant-webuntis.
Nachtrag: ich habe doch noch ein paar mehr Infos im Log erzeugen können, allerdings kein Traceback:
2023-01-09 15:29:06.570 DEBUG (SyncWorker_9) [webuntis] Making new request:
2023-01-09 15:29:06.570 DEBUG (SyncWorker_9) [webuntis] URL: https://borys.webuntis.com/WebUntis/jsonrpc.do?school=XXXXX
2023-01-09 15:29:06.570 DEBUG (SyncWorker_9) [webuntis] DATA: {'id': '2023-01-09 15:29:06.569968', 'method': 'getTeachers', 'params': {}, 'jsonrpc': '2.0'}
2023-01-09 15:29:06.612 DEBUG (SyncWorker_9) [webuntis] Valid JSON found
2023-01-09 15:29:06.612 ERROR (SyncWorker_9) [webuntis] {'jsonrpc': '2.0', 'id': '2023-01-09 15:29:06.569968', 'error': {'message': 'no right for getTeachers()', 'code': -8509}}
from homeassistant-webuntis.
Vermutlich haben wir keine Rechte um die getTeachers Funktion aufzurufen, wenn ich im init.py die Zeilen 579 - 592 auskommentier erscheint der Trace nicht mehr. Vielleicht kann man das ja konfigurierbar machen, oder den Zustand speichern, damit die logmessage nicht die Logfiles zuspammt?
"""
try:
dic["teachers"] = [
{"name": str(teacher.name), "long_name": str(teacher.long_name)}
for teacher in lesson.teachers
]
except:
pass
try:
dic["original_teachers"] = [
{"name": str(teacher.name), "long_name": str(teacher.long_name)}
for teacher in lesson.original_teachers
]
except:
pass
"""
from homeassistant-webuntis.
Ja, der Fehler wird durch ein Rechteproblem hervorgerufen. Ich hatte die letzten Wochen keine Zeit deshalb antworte ich erst jetzt.
Kannst du mal bei dir die Auskommentierten Zeilen durch folgendes ersetze und dann die entstehenden Logs schicken:
try:
lesson.teachers[0].name
lesson.teachers[0].long_name
lesson.original_teachers[0].name
lesson.original_teachers[0].long_name
except IndexError:
pass # Wenn kein Lehrer für die Stunde eingetragen ist, wird der Fehler abgefangen
Dann kann ich den Bug patchen
from homeassistant-webuntis.
Hi Jonas,
anbei die Traces, hab mal alles auf debug reingepackt, ich hoffe es hilft dir
`2023-02-05 12:45:23.121 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration webuntis which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-02-05 12:46:12.147 DEBUG (MainThread) [custom_components.webuntis] Creating server instance for 'login' (SCHOOL)
2023-02-05 12:46:12.148 DEBUG (MainThread) [webuntis] The URL given doesn't seem to be a valid URL, just gonna prepend "https://"
2023-02-05 12:46:12.149 DEBUG (MainThread) [custom_components.webuntis] logging in
2023-02-05 12:46:12.151 DEBUG (SyncWorker_1) [webuntis] Making new request:
2023-02-05 12:46:12.151 DEBUG (SyncWorker_1) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:12.393 DEBUG (SyncWorker_1) [webuntis] Valid JSON found
2023-02-05 12:46:12.394 DEBUG (SyncWorker_1) [webuntis] Did get a jsessionid from the server: XXXXXXXXXXXXXXXXXXXX
2023-02-05 12:46:12.443 DEBUG (MainThread) [custom_components.webuntis] Login successful
2023-02-05 12:46:12.443 DEBUG (MainThread) [custom_components.webuntis] updating data
2023-02-05 12:46:12.445 DEBUG (SyncWorker_0) [webuntis] Making new request:
2023-02-05 12:46:12.445 DEBUG (SyncWorker_0) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:12.445 DEBUG (SyncWorker_0) [webuntis] DATA: {'id': '2023-02-05 12:46:12.445235', 'method': 'getSubjects', 'params': {}, 'jsonrpc': '2.0'}
2023-02-05 12:46:12.537 DEBUG (SyncWorker_0) [webuntis] Valid JSON found
2023-02-05 12:46:13.440 DEBUG (SyncWorker_2) [webuntis] Making new request:
2023-02-05 12:46:13.441 DEBUG (SyncWorker_2) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:13.441 DEBUG (SyncWorker_2) [webuntis] DATA: {'id': '2023-02-05 12:46:13.440751', 'method': 'getPersonId', 'params': {'sn': 'Nachname', 'fn': 'Vorname', 'dob': 0, 'type': 5}, 'jsonrpc': '2.0'}
2023-02-05 12:46:13.485 DEBUG (SyncWorker_2) [webuntis] Valid JSON found
2023-02-05 12:46:13.485 DEBUG (SyncWorker_2) [webuntis] Making new request:
2023-02-05 12:46:13.485 DEBUG (SyncWorker_2) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:13.486 DEBUG (SyncWorker_2) [webuntis] DATA: {'id': '2023-02-05 12:46:13.485810', 'method': 'getTimetable', 'params': {'startDate': 20230205, 'endDate': 20230205, 'id': 3704, 'type': 5}, 'jsonrpc': '2.0'}
2023-02-05 12:46:13.547 DEBUG (SyncWorker_2) [webuntis] Valid JSON found
2023-02-05 12:46:14.311 DEBUG (SyncWorker_7) [webuntis] Making new request:
2023-02-05 12:46:14.312 DEBUG (SyncWorker_7) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:14.312 DEBUG (SyncWorker_7) [webuntis] DATA: {'id': '2023-02-05 12:46:14.311897', 'method': 'getPersonId', 'params': {'sn': 'Nachname', 'fn': 'Vorname', 'dob': 0, 'type': 5}, 'jsonrpc': '2.0'}
2023-02-05 12:46:14.364 DEBUG (SyncWorker_7) [webuntis] Valid JSON found
2023-02-05 12:46:14.365 DEBUG (SyncWorker_7) [webuntis] Making new request:
2023-02-05 12:46:14.365 DEBUG (SyncWorker_7) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:14.365 DEBUG (SyncWorker_7) [webuntis] DATA: {'id': '2023-02-05 12:46:14.365395', 'method': 'getTimetable', 'params': {'startDate': 20230205, 'endDate': 20230307, 'id': 3704, 'type': 5}, 'jsonrpc': '2.0'}
2023-02-05 12:46:14.547 DEBUG (SyncWorker_7) [webuntis] Valid JSON found
2023-02-05 12:46:14.634 DEBUG (SyncWorker_7) [webuntis] Making new request:
2023-02-05 12:46:14.634 DEBUG (SyncWorker_7) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:14.634 DEBUG (SyncWorker_7) [webuntis] DATA: {'id': '2023-02-05 12:46:14.634530', 'method': 'getRooms', 'params': {}, 'jsonrpc': '2.0'}
2023-02-05 12:46:14.722 DEBUG (SyncWorker_7) [webuntis] Valid JSON found
2023-02-05 12:46:14.724 DEBUG (SyncWorker_7) [webuntis] Making new request:
2023-02-05 12:46:14.724 DEBUG (SyncWorker_7) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:14.724 DEBUG (SyncWorker_7) [webuntis] DATA: {'id': '2023-02-05 12:46:14.724117', 'method': 'getKlassen', 'params': {}, 'jsonrpc': '2.0'}
2023-02-05 12:46:14.772 DEBUG (SyncWorker_7) [webuntis] Valid JSON found
2023-02-05 12:46:14.773 DEBUG (SyncWorker_7) [webuntis] Making new request:
2023-02-05 12:46:14.773 DEBUG (SyncWorker_7) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:14.773 DEBUG (SyncWorker_7) [webuntis] DATA: {'id': '2023-02-05 12:46:14.773131', 'method': 'getTeachers', 'params': {}, 'jsonrpc': '2.0'}
2023-02-05 12:46:14.845 DEBUG (SyncWorker_7) [webuntis] Valid JSON found
2023-02-05 12:46:14.845 ERROR (SyncWorker_7) [webuntis] {'jsonrpc': '2.0', 'id': '2023-02-05 12:46:14.773131', 'error': {'message': 'no right for getTeachers()', 'code': -8509}}
2023-02-05 12:46:15.008 WARNING (MainThread) [custom_components.webuntis] Updating the propertie next_class of 'SCHOOL@login' failed - OSError: no right for getTeachers()
2023-02-05 12:46:15.011 DEBUG (SyncWorker_2) [webuntis] Making new request:
2023-02-05 12:46:15.011 DEBUG (SyncWorker_2) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:15.011 DEBUG (SyncWorker_2) [webuntis] DATA: {'id': '2023-02-05 12:46:15.011331', 'method': 'getPersonId', 'params': {'sn': 'Nachname', 'fn': 'Vorname', 'dob': 0, 'type': 5}, 'jsonrpc': '2.0'}
2023-02-05 12:46:15.056 DEBUG (SyncWorker_2) [webuntis] Valid JSON found
2023-02-05 12:46:15.056 DEBUG (SyncWorker_2) [webuntis] Making new request:
2023-02-05 12:46:15.056 DEBUG (SyncWorker_2) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:15.056 DEBUG (SyncWorker_2) [webuntis] DATA: {'id': '2023-02-05 12:46:15.056559', 'method': 'getTimetable', 'params': {'startDate': 20230205, 'endDate': 20230307, 'id': 3704, 'type': 5}, 'jsonrpc': '2.0'}
2023-02-05 12:46:15.275 DEBUG (SyncWorker_2) [webuntis] Valid JSON found
2023-02-05 12:46:15.629 DEBUG (SyncWorker_7) [webuntis] Making new request:
2023-02-05 12:46:15.630 DEBUG (SyncWorker_7) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:15.630 DEBUG (SyncWorker_7) [webuntis] DATA: {'id': '2023-02-05 12:46:15.629842', 'method': 'getPersonId', 'params': {'sn': 'Nachname', 'fn': 'Vorname', 'dob': 0, 'type': 5}, 'jsonrpc': '2.0'}
2023-02-05 12:46:15.674 DEBUG (SyncWorker_7) [webuntis] Valid JSON found
2023-02-05 12:46:15.675 DEBUG (SyncWorker_7) [webuntis] Making new request:
2023-02-05 12:46:15.675 DEBUG (SyncWorker_7) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:15.675 DEBUG (SyncWorker_7) [webuntis] DATA: {'id': '2023-02-05 12:46:15.675513', 'method': 'getTimetable', 'params': {'startDate': 20230206, 'endDate': 20230206, 'id': 3704, 'type': 5}, 'jsonrpc': '2.0'}
2023-02-05 12:46:15.788 DEBUG (SyncWorker_7) [webuntis] Valid JSON found
2023-02-05 12:46:15.789 DEBUG (SyncWorker_7) [webuntis] Making new request:
2023-02-05 12:46:15.790 DEBUG (SyncWorker_7) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:15.790 DEBUG (SyncWorker_7) [webuntis] DATA: {'id': '2023-02-05 12:46:15.789885', 'method': 'getTeachers', 'params': {}, 'jsonrpc': '2.0'}
2023-02-05 12:46:15.834 DEBUG (SyncWorker_7) [webuntis] Valid JSON found
2023-02-05 12:46:15.834 ERROR (SyncWorker_7) [webuntis] {'jsonrpc': '2.0', 'id': '2023-02-05 12:46:15.789885', 'error': {'message': 'no right for getTeachers()', 'code': -8509}}
2023-02-05 12:46:15.929 WARNING (MainThread) [custom_components.webuntis] Updating the propertie next_day_json of 'SCHOOL@login' failed - OSError: no right for getTeachers()
2023-02-05 12:46:15.932 DEBUG (SyncWorker_5) [webuntis] Making new request:
2023-02-05 12:46:15.932 DEBUG (SyncWorker_5) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:15.932 DEBUG (SyncWorker_5) [webuntis] DATA: {'id': '2023-02-05 12:46:15.932289', 'method': 'getPersonId', 'params': {'sn': 'Nachname', 'fn': 'Vorname', 'dob': 0, 'type': 5}, 'jsonrpc': '2.0'}
2023-02-05 12:46:15.979 DEBUG (SyncWorker_5) [webuntis] Valid JSON found
2023-02-05 12:46:15.980 DEBUG (SyncWorker_5) [webuntis] Making new request:
2023-02-05 12:46:15.980 DEBUG (SyncWorker_5) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:15.980 DEBUG (SyncWorker_5) [webuntis] DATA: {'id': '2023-02-05 12:46:15.980374', 'method': 'getTimetable', 'params': {'startDate': 20230205, 'endDate': 20230307, 'id': 3704, 'type': 5}, 'jsonrpc': '2.0'}
2023-02-05 12:46:16.181 DEBUG (SyncWorker_5) [webuntis] Valid JSON found
2023-02-05 12:46:16.183 DEBUG (SyncWorker_5) [webuntis] Making new request:
2023-02-05 12:46:16.183 DEBUG (SyncWorker_5) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:16.183 DEBUG (SyncWorker_5) [webuntis] DATA: {'id': '2023-02-05 12:46:16.183588', 'method': 'getTeachers', 'params': {}, 'jsonrpc': '2.0'}
2023-02-05 12:46:16.235 DEBUG (SyncWorker_5) [webuntis] Valid JSON found
2023-02-05 12:46:16.236 ERROR (SyncWorker_5) [webuntis] {'jsonrpc': '2.0', 'id': '2023-02-05 12:46:16.183588', 'error': {'message': 'no right for getTeachers()', 'code': -8509}}
2023-02-05 12:46:16.240 WARNING (SyncWorker_5) [custom_components.webuntis] Updating of a calendar_event of 'SCHOOL@login' failed - OSError: no right for getTeachers()
2023-02-05 12:46:16.244 DEBUG (SyncWorker_5) [webuntis] Making new request:
2023-02-05 12:46:16.245 DEBUG (SyncWorker_5) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:16.245 DEBUG (SyncWorker_5) [webuntis] DATA: {'id': '2023-02-05 12:46:16.244726', 'method': 'getTeachers', 'params': {}, 'jsonrpc': '2.0'}
2023-02-05 12:46:16.295 DEBUG (SyncWorker_5) [webuntis] Valid JSON found
2023-02-05 12:46:16.295 ERROR (SyncWorker_5) [webuntis] {'jsonrpc': '2.0', 'id': '2023-02-05 12:46:16.244726', 'error': {'message': 'no right for getTeachers()', 'code': -8509}}
2023-02-05 12:46:16.299 WARNING (SyncWorker_5) [custom_components.webuntis] Updating of a calendar_event of 'SCHOOL@login' failed - OSError: no right for getTeachers()
2023-02-05 12:46:16.303 DEBUG (SyncWorker_5) [webuntis] Making new request:
2023-02-05 12:46:16.303 DEBUG (SyncWorker_5) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:16.303 DEBUG (SyncWorker_5) [webuntis] DATA: {'id': '2023-02-05 12:46:16.303241', 'method': 'getTeachers', 'params': {}, 'jsonrpc': '2.0'}
2023-02-05 12:46:16.350 DEBUG (SyncWorker_5) [webuntis] Valid JSON found
2023-02-05 12:46:16.350 ERROR (SyncWorker_5) [webuntis] {'jsonrpc': '2.0', 'id': '2023-02-05 12:46:16.303241', 'error': {'message': 'no right for getTeachers()', 'code': -8509}}
2023-02-05 12:46:16.356 WARNING (SyncWorker_5) [custom_components.webuntis] Updating of a calendar_event of 'SCHOOL@login' failed - OSError: no right for getTeachers()
2023-02-05 12:46:16.360 DEBUG (SyncWorker_5) [webuntis] Making new request:
2023-02-05 12:46:16.360 DEBUG (SyncWorker_5) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:16.360 DEBUG (SyncWorker_5) [webuntis] DATA: {'id': '2023-02-05 12:46:16.360381', 'method': 'getTeachers', 'params': {}, 'jsonrpc': '2.0'}
2023-02-05 12:46:16.412 DEBUG (SyncWorker_5) [webuntis] Valid JSON found
2023-02-05 12:46:16.412 ERROR (SyncWorker_5) [webuntis] {'jsonrpc': '2.0', 'id': '2023-02-05 12:46:16.360381', 'error': {'message': 'no right for getTeachers()', 'code': -8509}}
...
...
...
2023-02-05 12:46:22.921 WARNING (SyncWorker_5) [custom_components.webuntis] Updating of a calendar_event of 'SCHOOL@login' failed - OSError: no right for getTeachers()
2023-02-05 12:46:22.926 DEBUG (SyncWorker_4) [webuntis] Making new request:
2023-02-05 12:46:22.926 DEBUG (SyncWorker_4) [webuntis] URL: https://mese.webuntis.com/WebUntis/jsonrpc.do?school=SCHOOL
2023-02-05 12:46:22.926 DEBUG (SyncWorker_4) [webuntis] DATA: {'id': '2023-02-05 12:46:22.926196', 'method': 'logout', 'params': {}, 'jsonrpc': '2.0'}
2023-02-05 12:46:22.973 DEBUG (SyncWorker_4) [webuntis] Valid JSON found
2023-02-05 12:46:22.976 DEBUG (MainThread) [custom_components.webuntis] Logout successful
2023-02-05 12:46:22.983 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.webuntis
`
from homeassistant-webuntis.
Bekommst du den Fehler auch wenn du den code wie folgend abänderst?
try:
lesson.teachers[0].name
lesson.original_teachers[0].name
except IndexError:
pass # Wenn kein Lehrer für die Stunde eingetragen ist, wird der Fehler abgefangen
from homeassistant-webuntis.
Ja, der trace kommt sobald man den Lehrer abfragt, und man keine Rechte hat. Auch ohne long_name.
from homeassistant-webuntis.
Ich hatte an sowas gedacht:
if self.request_teachers:
try:
dic["teachers"] = [
{"name": str(teacher.name), "long_name": str(teacher.long_name)}
for teacher in lesson.teachers
]
except:
_LOGGER.warning("Coud not receive teachers - stop requests.")
self.request_teachers = False
pass
try:
dic["original_teachers"] = [
{"name": str(teacher.name), "long_name": str(teacher.long_name)}
for teacher in lesson.original_teachers
]
except:
pass
weiß allerdings nicht ob es nicht auch andere Fälle gibt wo das schief geht, und trotzdem weiterhin request gesendet werden müssen.
from homeassistant-webuntis.
Das problem ist dass die Variable self.request_teachers in den Konfigurationen gespeichert werden muss. Sonst wird sie bei jedem Neustart zurückgesetzt. Das speichern ist aber nicht ganz zu einfach. Da muss ich nochmal etwas herumprobieren.
from homeassistant-webuntis.
OK, ich denke mit einem Logeintrag pro Neustart könnte man leben. Danke für deine Arbeit!
from homeassistant-webuntis.
Related Issues (20)
- Get calender events of next exams
- Falsche Zeiten HOT 1
- Webuntis fails to accept server HOT 4
- student not found HOT 2
- invalid school name/id for school with spaces in the name HOT 2
- Custom Sensor Change Output HOT 7
- Notification for scheduler changes HOT 1
- Webuntis templates gehen nicht mehr HOT 11
- Event Entities for changes HOT 1
- After installation error: JSON data is disabled - activate it in the options HOT 2
- "student not found" error on adding integration HOT 1
- Bad Credentials due to username? HOT 5
- multiple users HOT 1
- "no right for timetable" error message HOT 2
- Notifications IndexError HOT 1
- Unable to configure the integration HOT 3
- Calendar is filled but it should be deactivated
- Error if no subjects in lesson HOT 1
- Problems with WebUntis integration HOT 1
- How do I get a time table like the one displayed in untis itself? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homeassistant-webuntis.