scaarup / aula

Fetches information from Aula about your children
GNU General Public License v3.0
54 stars 14 forks source link

Could not get ugeplan for next week for child. #110

Closed JesperThorup closed 1 year ago

JesperThorup commented 1 year ago

Når jeg opsætter integrationen, så opretter den godt nok fem entities. to for hvert barn, og en der viser om der er ulæste beskeder.

Ved Elliot, som går i børnehave, viser den om han er der eller ej. Fint. Ved Emilie som går i skole viser den ingen ting. Her er det kalenderen jeg tænker, da de ikke bruger ind/ud tjekning.

Logger jeg ind på Aula er kalenderen fint fyldt ud.

Please answer the following

Please provide debug log from the integration

home-assistant_aula_2023-08-24T18-05-19.130Z.log

scaarup commented 1 year ago

Jeg bliver nødt til at se noget debug log.

JesperThorup commented 1 year ago

Den er vedhæftet.. Kan se den har tilføjet linket bare: https://github.com/scaarup/aula/files/12432242/home-assistant_aula_2023-08-24T18-05-19.130Z.log

scaarup commented 1 year ago

Ligger du inde med filen /config/skoleskema.json - og hvad indeholder den evt.?

Prøv at debug det output vi prøver at hente som skoleskema ved at indsætte dette over linje 233 i client.py: _LOGGER.debug(res) Genstart og kig i loggen.

JesperThorup commented 1 year ago

@scaarup Indholdet af skoleskema.json: https://pastebin.com/hvJS2441

Forsøger lige med debug delen i aften...

JesperThorup commented 1 year ago

Syntes ikke der kommer mere i loggen ved at tilføje linjen i client.py...

Der kommer dog denne, men den var der også før:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/calendar/__init__.py", line 313, in async_setup_entry
    return await component.async_setup_entry(entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
scaarup commented 1 year ago

Bare lige for at se - kan du prøve at sætte integrationen op uden hverken skoleskema og ugeplaner? Bare for at se om alle fejl er væk.

JesperThorup commented 1 year ago

@scaarup Kommer også uden nogen flueben:

Error setting up entry Aula for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 169, in async_setup_entry
    return await component.async_setup_entry(entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
scaarup commented 1 year ago

Okay det er interessant.

Prøv at fjern/kommenter linje 73-75 i sensor.py

    hass.async_create_task(
        hass.config_entries.async_forward_entry_setup(config_entry, "binary_sensor")
    )

Og genstart.

JesperThorup commented 1 year ago

Så er fejlen der ikke, men sensorne "svare ikke" rigtigt. image

Har forsøgt at slette integrationen og tilføje den igen..

scaarup commented 1 year ago

Så nu har du sat den op med både ugeplaner og skoleskema igen?

Vi skal nok se en ny debug.log

JesperThorup commented 1 year ago

Okay.. Linie 73-75 er udkommenteret. Hele HA er genstartet. Har tilføjet Aula uden at markere nogen af fluebenene. Der er nu 2 sensorer, som viser om de er der (N/A for hende som går i skole.

Ny Log her:

2023-08-28 14:47:14.525 INFO (MainThread) [custom_components.aula] _ /\ | | / \ _ _| | __ _ / /\ \| | | | |/ _ | / _ \ || | | (| | // _\,||_,|
Aula integration, version: 0.1.33 This is a custom integration If you have any issues with this you need to open an issue here: https://github.com/scaarup/aula/issues

2023-08-28 14:47:14.534 DEBUG (SyncWorker_6) [custom_components.aula.client] is_logged_in? False 2023-08-28 14:47:14.534 DEBUG (SyncWorker_6) [custom_components.aula.client] Logging in 2023-08-28 14:47:16.413 DEBUG (SyncWorker_6) [custom_components.aula.client] Trying API at https://www.aula.dk/api/v15 2023-08-28 14:47:16.460 WARNING (SyncWorker_6) [custom_components.aula.client] API was expected at https://www.aula.dk/api/v15 but responded with HTTP 410. The integration will automatically try a newer version and everything may work fine. 2023-08-28 14:47:16.460 DEBUG (SyncWorker_6) [custom_components.aula.client] Trying API at https://www.aula.dk/api/v16 2023-08-28 14:47:16.666 DEBUG (SyncWorker_6) [custom_components.aula.client] Found API on https://www.aula.dk/api/v16 2023-08-28 14:47:16.910 DEBUG (SyncWorker_6) [custom_components.aula.client] LOGIN: True 2023-08-28 14:47:16.910 DEBUG (SyncWorker_6) [custom_components.aula.client] Config - schoolschedule: False, config - ugeplaner: False 2023-08-28 14:47:16.910 DEBUG (SyncWorker_6) [custom_components.aula.client] Child ids and names: {1258167: 'Emilie Esther Thorup', 4151073: 'Elliot Ejgil Thorup'} 2023-08-28 14:47:16.910 DEBUG (SyncWorker_6) [custom_components.aula.client] Child ids and institution names: {1258167: 'Gandrup Skole', 4151073: 'Specialbørnehaven Stampe'} 2023-08-28 14:47:16.910 DEBUG (SyncWorker_6) [custom_components.aula.client] Institution codes: ['817001', 'G23494'] 2023-08-28 14:47:16.980 WARNING (SyncWorker_6) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities. 2023-08-28 14:47:17.060 DEBUG (SyncWorker_6) [custom_components.aula.client] Child ids and presence data status: {'1258167': 0, '4151073': 1} 2023-08-28 14:47:18.019 DEBUG (MainThread) [custom_components.aula.sensor] Finished fetching sensor data in 3.486 seconds (success: True) 2023-08-28 14:47:18.120 DEBUG (SyncWorker_2) [custom_components.aula.client] is_logged_in? True 2023-08-28 14:47:18.120 DEBUG (SyncWorker_2) [custom_components.aula.client] Child ids and names: {1258167: 'Emilie Esther Thorup', 4151073: 'Elliot Ejgil Thorup'} 2023-08-28 14:47:18.120 DEBUG (SyncWorker_2) [custom_components.aula.client] Child ids and institution names: {1258167: 'Gandrup Skole', 4151073: 'Specialbørnehaven Stampe'} 2023-08-28 14:47:18.120 DEBUG (SyncWorker_2) [custom_components.aula.client] Institution codes: ['817001', 'G23494'] 2023-08-28 14:47:18.198 WARNING (SyncWorker_2) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities. 2023-08-28 14:47:18.298 DEBUG (SyncWorker_2) [custom_components.aula.client] Child ids and presence data status: {'1258167': 0, '4151073': 1} 2023-08-28 14:47:19.258 DEBUG (MainThread) [custom_components.aula.sensor] Found presence data for childid 4151073 adding sensor entity. 2023-08-28 14:47:19.259 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 1258167 aula1258167 2023-08-28 14:47:19.259 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 1258167 aula1258167 2023-08-28 14:47:19.259 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 1258167 aula1258167 2023-08-28 14:47:19.260 DEBUG (MainThread) [custom_components.aula.sensor] Setting state to n/a for child 1258167 2023-08-28 14:47:19.260 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 4151073 aula4151073 2023-08-28 14:47:19.260 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 4151073 aula4151073 2023-08-28 14:47:19.260 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 4151073 aula4151073 2023-08-28 14:47:28.158 DEBUG (SyncWorker_4) [custom_components.aula.client] is_logged_in? True 2023-08-28 14:47:28.158 DEBUG (SyncWorker_4) [custom_components.aula.client] Child ids and names: {1258167: 'Emilie Esther Thorup', 4151073: 'Elliot Ejgil Thorup'} 2023-08-28 14:47:28.158 DEBUG (SyncWorker_4) [custom_components.aula.client] Child ids and institution names: {1258167: 'Gandrup Skole', 4151073: 'Specialbørnehaven Stampe'} 2023-08-28 14:47:28.158 DEBUG (SyncWorker_4) [custom_components.aula.client] Institution codes: ['817001', 'G23494'] 2023-08-28 14:47:28.388 WARNING (SyncWorker_4) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities. 2023-08-28 14:47:28.502 DEBUG (SyncWorker_4) [custom_components.aula.client] Child ids and presence data status: {'1258167': 0, '4151073': 1} 2023-08-28 14:47:29.215 DEBUG (MainThread) [custom_components.aula.sensor] Finished fetching sensor data in 1.194 seconds (success: True) 2023-08-28 14:47:29.215 DEBUG (MainThread) [custom_components.aula.sensor] Setting state to n/a for child 1258167

`

scaarup commented 1 year ago

Okay, så prøv at enable ugeplan og se.

JesperThorup commented 1 year ago

Så er ugeplan enabled og følgende i log:

_ /\ | | / \ _ _| | __ _ / /\ \| | | | |/ _ | / _ \ || | | (| | // _\,||_,|
Aula integration, version: 0.1.33 This is a custom integration If you have any issues with this you need to open an issue here: https://github.com/scaarup/aula/issues

2023-08-28 14:47:14.534 DEBUG (SyncWorker_6) [custom_components.aula.client] is_logged_in? False 2023-08-28 14:47:14.534 DEBUG (SyncWorker_6) [custom_components.aula.client] Logging in 2023-08-28 14:47:16.413 DEBUG (SyncWorker_6) [custom_components.aula.client] Trying API at https://www.aula.dk/api/v15 2023-08-28 14:47:16.460 WARNING (SyncWorker_6) [custom_components.aula.client] API was expected at https://www.aula.dk/api/v15 but responded with HTTP 410. The integration will automatically try a newer version and everything may work fine. 2023-08-28 14:47:16.460 DEBUG (SyncWorker_6) [custom_components.aula.client] Trying API at https://www.aula.dk/api/v16 2023-08-28 14:47:16.666 DEBUG (SyncWorker_6) [custom_components.aula.client] Found API on https://www.aula.dk/api/v16 2023-08-28 14:47:16.910 DEBUG (SyncWorker_6) [custom_components.aula.client] LOGIN: True 2023-08-28 14:47:16.910 DEBUG (SyncWorker_6) [custom_components.aula.client] Config - schoolschedule: False, config - ugeplaner: False 2023-08-28 14:47:16.910 DEBUG (SyncWorker_6) [custom_components.aula.client] Child ids and names: {1258167: 'Emilie Esther Thorup', 4151073: 'Elliot Ejgil Thorup'} 2023-08-28 14:47:16.910 DEBUG (SyncWorker_6) [custom_components.aula.client] Child ids and institution names: {1258167: 'Gandrup Skole', 4151073: 'Specialbørnehaven Stampe'} 2023-08-28 14:47:16.910 DEBUG (SyncWorker_6) [custom_components.aula.client] Institution codes: ['817001', 'G23494'] 2023-08-28 14:47:16.980 WARNING (SyncWorker_6) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities. 2023-08-28 14:47:17.060 DEBUG (SyncWorker_6) [custom_components.aula.client] Child ids and presence data status: {'1258167': 0, '4151073': 1} 2023-08-28 14:47:18.019 DEBUG (MainThread) [custom_components.aula.sensor] Finished fetching sensor data in 3.486 seconds (success: True) 2023-08-28 14:47:18.120 DEBUG (SyncWorker_2) [custom_components.aula.client] is_logged_in? True 2023-08-28 14:47:18.120 DEBUG (SyncWorker_2) [custom_components.aula.client] Child ids and names: {1258167: 'Emilie Esther Thorup', 4151073: 'Elliot Ejgil Thorup'} 2023-08-28 14:47:18.120 DEBUG (SyncWorker_2) [custom_components.aula.client] Child ids and institution names: {1258167: 'Gandrup Skole', 4151073: 'Specialbørnehaven Stampe'} 2023-08-28 14:47:18.120 DEBUG (SyncWorker_2) [custom_components.aula.client] Institution codes: ['817001', 'G23494'] 2023-08-28 14:47:18.198 WARNING (SyncWorker_2) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities. 2023-08-28 14:47:18.298 DEBUG (SyncWorker_2) [custom_components.aula.client] Child ids and presence data status: {'1258167': 0, '4151073': 1} 2023-08-28 14:47:19.258 DEBUG (MainThread) [custom_components.aula.sensor] Found presence data for childid 4151073 adding sensor entity. 2023-08-28 14:47:19.259 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 1258167 aula1258167 2023-08-28 14:47:19.259 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 1258167 aula1258167 2023-08-28 14:47:19.259 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 1258167 aula1258167 2023-08-28 14:47:19.260 DEBUG (MainThread) [custom_components.aula.sensor] Setting state to n/a for child 1258167 2023-08-28 14:47:19.260 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 4151073 aula4151073 2023-08-28 14:47:19.260 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 4151073 aula4151073 2023-08-28 14:47:19.260 DEBUG (MainThread) [custom_components.aula.sensor] Unique ID for child 4151073 aula4151073 2023-08-28 14:47:28.158 DEBUG (SyncWorker_4) [custom_components.aula.client] is_logged_in? True 2023-08-28 14:47:28.158 DEBUG (SyncWorker_4) [custom_components.aula.client] Child ids and names: {1258167: 'Emilie Esther Thorup', 4151073: 'Elliot Ejgil Thorup'} 2023-08-28 14:47:28.158 DEBUG (SyncWorker_4) [custom_components.aula.client] Child ids and institution names: {1258167: 'Gandrup Skole', 4151073: 'Specialbørnehaven Stampe'} 2023-08-28 14:47:28.158 DEBUG (SyncWorker_4) [custom_components.aula.client] Institution codes: ['817001', 'G23494'] 2023-08-28 14:47:28.388 WARNING (SyncWorker_4) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities. 2023-08-28 14:47:28.502 DEBUG (SyncWorker_4) [custom_components.aula.client] Child ids and presence data status: {'1258167': 0, '4151073': 1} 2023-08-28 14:47:29.215 DEBUG (MainThread) [custom_components.aula.sensor] Finished fetching sensor data in 1.194 seconds (success: True) 2023-08-28 14:47:29.215 DEBUG (MainThread) [custom_components.aula.sensor] Setting state to n/a for child 1258167 2023-08-28 14:52:29.720 WARNING (SyncWorker_5) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities. 2023-08-28 14:57:30.804 WARNING (SyncWorker_3) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities. 2023-08-28 15:02:50.650 WARNING (SyncWorker_3) [custom_components.aula.client] API was expected at https://www.aula.dk/api/v15 but responded with HTTP 410. The integration will automatically try a newer version and everything may work fine. 2023-08-28 15:02:51.309 WARNING (SyncWorker_3) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities. 2023-08-28 15:02:52.895 WARNING (SyncWorker_12) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities. 2023-08-28 15:03:02.932 WARNING (SyncWorker_4) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities. 2023-08-28 15:08:03.467 WARNING (SyncWorker_1) [custom_components.aula.client] Unable to retrieve presence data from Aula from child with id 1258167. Some data will be missing from sensor entities.`

scaarup commented 1 year ago

Okay, forventer du at ugeplan skal være tilgængelig på dine entities nu - og er de?

scaarup commented 1 year ago

Hov loggen siger jo noget andet:

Config - schoolschedule: False, config - ugeplaner: False

JesperThorup commented 1 year ago

De burde vel være der, når fluebenet er sat?.. Men der er ikke noget... Hvor i Aula skal jeg kigge efter om der er noget? Hvilken liste er det den kigger i?

JesperThorup commented 1 year ago

Ser ud til fluebenet var smuttet for mig.. Kommer lige med en ny log om 10 min..

JesperThorup commented 1 year ago

Ny Log:

https://pastebin.com/dWBhCBM9

scaarup commented 1 year ago

I den seneste log har du enabled både ugeplaner og skoleskema. Vi bliver nødt til at koncentrere os om en af tingene. Er ugeplaner tomme på dine entities? Det lader til, at du har ugeplaner fra Min Uddannelse. Kan du prøve at indkommentere linjerne 257+258 i client.py ? Så skulle svaret fra Min Uddannelse nemlig blive logget ud.

JesperThorup commented 1 year ago

Jeg har kun sat flueben i ugeplaner..

scaarup commented 1 year ago

okay, loggen siger noget andet.

JesperThorup commented 1 year ago

Ny log.. Ved ikke om det kan gå for hurtigt med at oprette den lige efter hinanden...

https://pastebin.com/td7M89gy

scaarup commented 1 year ago

Fik du indkommenteret linjerne?

JesperThorup commented 1 year ago

73-75 er stadig udkommenteret i sensor.py

scaarup commented 1 year ago

73-75 er stadig udkommenteret i sensor.py

Se lige min comment lidt længere oppe.

JesperThorup commented 1 year ago

Ah.. Done...

Tænker det her er det der giver mening: 2023-08-29 12:21:56.299 DEBUG (SyncWorker_6) [custom_components.aula.client] Requesting token for widget 0029 2023-08-29 12:21:56.443 DEBUG (SyncWorker_6) [custom_components.aula.client] ugeplaner status_code 200 2023-08-29 12:21:56.443 DEBUG (SyncWorker_6) [custom_components.aula.client] ugeplaner response {"personer":[]} 2023-08-29 12:21:56.444 DEBUG (SyncWorker_6) [custom_components.aula.client] Requesting token for widget 0029 2023-08-29 12:21:56.582 DEBUG (SyncWorker_6) [custom_components.aula.client] ugeplaner status_code 200 2023-08-29 12:21:56.582 DEBUG (SyncWorker_6) [custom_components.aula.client] ugeplaner response {"personer":[]} 2023-08-29 12:21:56.584 DEBUG (MainThread) [custom_components.aula.sensor] Finished fetching sensor data in 2.007 seconds (success: True)

scaarup commented 1 year ago

Ah :) Så der er faktisk svar, men det er tomt. Hvis du logger ind i Aula, er der da ugeplaner tilgængelige? De skal stå under "Min Uddannelse - Ugenoter".

JesperThorup commented 1 year ago

Nej der står ikke noget når jeg går ind of kigger..

Men det var nu også mest kalenderen jeg var interesseret i....

scaarup commented 1 year ago

okay - titlen på issue'et er måske lidt misvisende. Men prøv at få aktiveret skoleskema og lad lige din HA køre i min. 10 minutter, da det er tiden imellem vi henter kalender.

JesperThorup commented 1 year ago

Så ser den sådan her ud loggen: https://pastebin.com/hZd45amc

Og skoleskema.json ser sådan her ud: https://pastebin.com/iRiaPV9B

scaarup commented 1 year ago

Okay, hvordan ser entities ud i HA?

JesperThorup commented 1 year ago

image

Indeholder ingenting...

scaarup commented 1 year ago

Det du ser der, er helt normalt. Prøv at lav et calendar card i dit UI og se om der dukker noget op.

JesperThorup commented 1 year ago

Så er der bid... Så data ligger et eller andet sted man ikke kan se? Tænker muligvis jeg har fået rodet rundt i ugeplaner og kalender... For havde tilføjet det yaml kode fra din side, men det var til ugeplaner..

Anyways, det ser ud til at virke.. :)

scaarup commented 1 year ago

Det er fordi calendar entities er lidt specielle. Selve kalender-data er ikke hverken "state" eller "attributes" - derfor du ikke kan se det på states listen :)