EasyIQ Ugeplan: port to skoleportal.easyiqcloud.dk + widget 0128#354
Closed
spraot wants to merge 1 commit into
Closed
EasyIQ Ugeplan: port to skoleportal.easyiqcloud.dk + widget 0128#354spraot wants to merge 1 commit into
spraot wants to merge 1 commit into
Conversation
The old EasyIQ flow POSTed to api.easyiqcloud.dk/api/aula/weekplaninfo, which now returns "Institutionen har ikke licens til EasyIQ Ugeplan widget" for schools whose Aula widget list contains 0128 (EasyIQ Ugeplan) rather than 0001. Captured the live web app traffic via HAR and confirmed it uses a different host and endpoint set: POST https://skoleportal.easyiqcloud.dk/Aula/AuthenticateAulaUser (empty body, Content-Length: 0) -> {"loginId": ...} GET https://skoleportal.easyiqcloud.dk/Calendar/CalendarGetWeekplanEvents ?loginId=...&date=<Monday-of-week>&activityFilter=-1 &courseFilter=-1&textFilter=&ownWeekPlan=false Auth is via bearer + X-Login / X-InstitutionFilter / X-UserProfile / X-ChildFilter / X-Child headers; no csrfp-token. Returns a flat events array with StartTime/EndTime already in the %Y/%m/%d %H:%M format the renderer expects, plus CoursesDisplay (subject) and Description. Also widens widget detection so both 0001 and 0128 trigger the EasyIQ path, replaces the bare except KeyError that silently dropped all events on schema/auth changes with a warning that names the missing key, and surfaces non-200 / unexpected-shape responses at WARNING level so future regressions don't disappear into a debug("None") haystack. Verified locally against three children at two institutions: the ugeplan sensor attribute now renders the full HTML body instead of just the <h2> Uge NN</h2> header.
Author
|
Closing in favour of #352, which lands the same SkolePortal port with a cleaner shape: purely additive (separate The one delta worth preserving — louder error handling around the silent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
api.easyiqcloud.dk/api/aula/weekplaninfoPOST flow with theskoleportal.easyiqcloud.dkAuthenticateAulaUser+Calendar/CalendarGetWeekplanEventsflow that Aula's web UI itself uses.0128("EasyIQ Ugeplan") to the EasyIQ detection alongside the legacy0001; whichever the user has provisioned routes through the same code path.except KeyError: _LOGGER.debug("None")into a WARNING that names the missing key and the response keys it did see, and surfaces non-200 / non-JSON responses at WARNING level too — future schema regressions stay visible at default log level instead of disappearing into adebug("None")haystack.Why
For a school whose Aula widget list contains
0128but not0001, the integration was rendering only<h2> Uge NN</h2>for every child. Debug logging showed every call toapi.easyiqcloud.dk/api/aula/weekplaninforeturning:{"ErrorCode": "1", "ErrorDescription": "Institutionen har ikke licens til EasyIQ Ugeplan widget."}— for all institutionFilter values, even though the Ugeplan widget itself renders populated content in the Aula UI for the same user. Capturing the live web app traffic in a HAR confirmed the UI never hits
api.easyiqcloud.dkat all. It uses a different host with a different auth model:Auth on every skoleportal call (no
csrfp-token, no cookies once these are right):A realistic
User-Agentis required — Cloudflare drops requests without one.Returned events use
StartTime/EndTimealready in%Y/%m/%d %H:%M, plusCoursesDisplay(subject name) andDescription(HTML body), so the rendered HTML carries over with just field-name swaps. ISO-week → Monday conversion usesdatetime.date.fromisocalendar(year, week, 1).Test plan
0128only:ugeplanandugeplan_nextsensor attributes now render the full HTML body (Mandag 08:00- 08:45 / Musik / <description>…) instead of the empty<h2>header.EasyIQ result for <child> week <YYYY-WNN> (<N> events)debug lines on each coordinator refresh.0001; auth shape is the same and the token API call passes the widget id through, so it should work, but a second pair of eyes from someone still on0001would be ideal.Notes for review
except KeyErrorremoved in this PR was the root cause of how long this took to diagnose for me — it would silently swallow the EasyIQ license error and render an empty header. Even if the host change is contentious, the louder error handling stands on its own.EASYIQ_APIconstant inconst.pyis now unused insideclient.pybut I left it in place to avoid breaking anyone importing it; happy to drop in a follow-up if you'd prefer.