aula icon indicating copy to clipboard operation
aula copied to clipboard

Problemer med ugeplan

Open JesperSchaadtGIT opened this issue 5 months ago • 11 comments

Hey :)

Mega fedt arbejde med denne integration.

Ugeplan virker ikke for mig (har virket fint tidligere) Jeg er på nyeste version. Kalender virker fint. Jeg har skiftet password, fjernet integrationen og tilføjet igen - Men stadig samme fejl.

Kan se at skolen benytter EasyIQ ugeplan, hvilket er noget nyt. Kan det være årsagen?

Version 0.1.51

_This error originated from a custom integration.

Logger: custom_components.aula.client Source: custom_components/aula/client.py:473 integration: Aula (documentation, issues) First occurred: August 12, 2025 at 12:51:19 (250 occurrences) Last logged: 09:20:26

You have enabled ugeplaner, but we cannot find any supported widgets (0029,0004,0001) in Aula._

Image

JesperSchaadtGIT avatar Aug 13 '25 07:08 JesperSchaadtGIT

Jeg oplever samme problem, skolen her er også overgået til EasyIQ.

torbenbeck avatar Aug 24 '25 23:08 torbenbeck

Jeg kan se vores skole bruger easyiq widget 0128 og ikke 0001. Jeg sidder og roder med at lave en parserfunktion til den, men det er lidt svært at gætte data når man ikke har data på nogen af de eksisterende løsninger.

mchrdk avatar Aug 27 '25 20:08 mchrdk

Jeg kan se vores skole bruger easyiq widget 0128 og ikke 0001. Jeg sidder og roder med at lave en parserfunktion til den, men det er lidt svært at gætte data når man ikke har data på nogen af de eksisterende løsninger.

Du burde kunne se data hvis du tilgår Aula i din browser, hopper i developer tools (Inspect) -> Network. Der dukker alle kald og svar op fra/til easyiq. Det er desværre endnu sværere for mig at lave det her, da jeg ikke selv har den widget.

scaarup avatar Aug 28 '25 05:08 scaarup

Det ser ud til der bliver lavet en anden tokenudveksling mellem aula og easyiq, så der er lidt ekstra arbejdet i det, men jeg arbejder på det og laver en pullerequest på et tidspunkt

mchrdk avatar Aug 28 '25 09:08 mchrdk

I tried writing new code for the new EasyIQ Ugeplan widget (the 0128 version), but I'm having my Python (and insomnia and curl...) requests blocked by Cloudflare when calling any of the new API methods (starting with the new call to AuthenticateAulaUser). @mchrdk - did you get any further?

bogolob avatar Sep 01 '25 18:09 bogolob

@bogolob I'm stuck at the same issue, as far as i can see its doing a deeper browser detection, and is much stricter regarding the session cookies.

Right now the plan is to let the Aula component detect that the widget is present, and then use the unilogin to log in to https://skoleportal.easyiqcloud.dk/Login then the data for the days is present on https://skoleportal.easyiqcloud.dk/Calendar/CalendarGetWeekplanEvents and the "weekly update text" is available on https://skoleportal.easyiqcloud.dk/Calendar/WeekPlan

This plan would require me to create a separate login entirely, I'm contemplating creating a completely new component for this since it would be a lot easier to muck around with the login part and maybe use one of the cfscrape modules that should bypass some of the protection features.

mchrdk avatar Sep 01 '25 21:09 mchrdk

I guess if the browser is able to get the token and access https://skoleportal.easyiqcloud.dk/Calendar/WeekPlan, you should be able to do this via the integration as well ?

Is Cloudflare in front of skoleportal.easyiqcloud.dk ?

scaarup avatar Sep 02 '25 05:09 scaarup

Yes, Cloudflare is in front of skoleportal.easyiqcloud.dk. It's not as trivial - CloudFlare has several options of differentiating between browsers and other libraries (used by bots and scrapers) to protect web pages from being accessed by non-humans. I need to try doing this with the cloudscraper library instead of ordinary requests to see if it's enough to bypass the CF protection.

bogolob avatar Sep 02 '25 07:09 bogolob

I have a working sample now, we both missed a call to an endpoint that returns a new bearer token for us to use. together with cfscrape the code now returns the week plan. now i need to find out how it works with multiple children, and how to return the data in the same way as the other code, but its looking good

mchrdk avatar Sep 02 '25 11:09 mchrdk

Then you have more success than I had. I tried switching requests for cfscrape and am still hitting the CF bot protection.

bogolob avatar Sep 02 '25 17:09 bogolob

i managed to get a proof of concept working now https://github.com/mchrdk/aula/blob/main/custom_components/aula/client.py it should be a drop in file, but im not certain i havent broken the other ugeplan implementations - i will work on a more solid release before creating a pull request.

if anyone has a good idea on how to display the data returned, then chime in, right now i have just reused the original sensor and pasted it all in as markdown, it would be create if it could be broken up into courses or days, but im not sure how people are using the data.

mchrdk avatar Sep 02 '25 21:09 mchrdk