Skip to content

Services

Michal Zaniewicz edited this page Dec 2, 2026 · 23 revisions

librus_synergia.refresh

Forces an immediate data refresh instead of waiting for the next poll - handy right before a morning-briefing automation. Optional device_id targets one student; omit it to refresh every configured student. Skips the smart-polling throttle and the outage backoff, but not quiet hours.

librus_synergia.get_message

Fetches ONE message's full, untruncated content (the Unread messages sensor's recent attribute only ever carries a short preview - Librus itself truncates that field). This marks the message as read on Librus's servers, exactly like opening it in the Librus app or website - confirmed live: a message's readDate flips from empty to a real timestamp the moment this is called. Only call it for a message someone has actually chosen to open (e.g. the Librus Synergia Cards Wiadomości card does this when you click a message) - never on a schedule or from an automation that isn't a direct response to someone opening it.

Field Description
device_id The Librus Synergia device (student) to fetch from.
message_id The message's id, from the Unread messages sensor's recent/substitutions_recent/alerts_recent/justifications_recent/outbox_recent/archive_recent attribute.
mailbox Which mailbox the message is in - defaults to inbox; pass the mailbox value from the same attribute entry (e.g. substitutions, alerts, justifications, outbox, archive/inbox).

Returns id, mailbox, sender, topic, content (full text), send_date, read_date, has_attachment, and attachments (a list of id/filename).

Downloading attachments

While logged in to Home Assistant, open:

  • /api/librus_synergia/attachment/<device id>/<message id>/<attachment id> for a message attachment,
  • /api/librus_synergia/homework_attachment/<device id>/<attachment id> for a file attached to a homework assignment (ids from the Homework assignments sensor's recent[].attachments).

The file goes straight from Librus to the browser, without being saved in Home Assistant and without opening the message in Librus. The companion Messages and Homework checklist cards do this when a file name is tapped.

For a sent message (mailbox: outbox) it also returns receivers: each recipient's name, group and read_date (empty until they read it). Opening a sent message changes nothing in Librus.

librus_synergia.get_grades

Returns every grade for a student in one response, optionally filtered to one subject via subject_id - the single-call equivalent of reading each subject average sensor's own grades attribute separately. Reads straight from already-fetched data, no extra Librus request, so it's safe to call from a routine automation (unlike get_message).

Field Description
device_id The Librus Synergia device (student) to fetch grades for.
subject_id Optional - limit to one subject, using a subject average sensor's subject_id attribute.

Returns grades (a list of subject, subject_id, value, category, date, semester, comments, teacher, improves, improved, newest first; an edited grade also changed_at and previous, as in the subject sensors' grades) and count, plus text_grades, descriptive_grades (with the skill each one is for), and point_grades (each with the teacher's comments since 0.12.54) with points_percentage when the student has any.

librus_synergia.mark_announcement_read

Marks school notices read in Librus, the same as opening them there. The notices show read straight away, and the next refresh brings Librus's own state. The Announcements card calls it when you open an unread notice and from its "mark all read" button.

Field Description
device_id The Librus Synergia device (student).
announcement_id Optional - one or more notice ids (id in the Unread announcements sensor's notices). Leave it out to mark every unread notice.

Returns marked, the ids marked read. If Librus refuses one, the action fails and the notices marked before it stay read.

librus_synergia.mark_message_read

Marks Wiadomości messages read (0.12.22+). Wiadomości has no separate "mark read" call, so each message is opened, exactly as reading it in Librus does (the content isn't returned). The unread count drops straight away; the next refresh brings Librus's own counts. The Messages card calls it from the envelope button on an unread message and from Mark all as read.

Field Description
device_id The Librus Synergia device (student).
message_id Optional - one or more message ids (id in the Unread messages sensor's recent, or a mailbox's own ..._recent). Leave it out to mark every unread message on that mailbox's list.
mailbox Optional - inbox (default), substitutions, alerts, justifications or archive/inbox.

Returns marked, the ids marked read. If Librus refuses one, the action fails and the messages marked before it stay read.

librus_synergia.sync_calendar

Copies tests, trips, meetings and days off into another calendar - a family Google Calendar, a Local Calendar - and keeps the copies up to date (0.12.28+). A test moved to another day is moved there too, a cancelled one is removed. Each copy ends its description with a short tag, [librus-sync:3f9a1c:a1234] (student, Librus entry): only tagged copies of this student are ever changed, so events people added by hand and another child's copies are safe, and two children can share one calendar. Days before today are never touched. Reads the data already fetched - no extra request to Librus.

The Copy School Events to a Calendar blueprint runs it daily, after a new Agenda entry and when an entry changes.

Field Description
device_id The Librus Synergia device (student).
target_calendar The calendar to copy into. It must allow adding events from Home Assistant; moving and removing also need it to allow editing and deleting events (Google Calendar and Local Calendar do). Otherwise new entries are still added and old ones stay (counted as not_removable).
days Optional - how many days ahead, from today (default 30, up to 180).
categories Optional - comma-separated words matched against the Agenda category, e.g. sprawdzian, kartkówka, wycieczka, zebranie (case and Polish letters don't matter; part of a word is enough). Parent-teacher meetings count as zebranie. Leave it out to copy every entry.
free_days Optional - also copy days off that fall on a weekday (default on). A day that frees only some lessons is copied with its own title, e.g. "Rekolekcje (lekcje 3–4)".
prefix Optional - put in front of every title, e.g. Ola: when several children share the calendar.
event_time Optional (0.12.50+) - e.g. 07:00: copied tests, quizzes and trips become timed events at that hour (half an hour long) instead of all-day ones, so your phone reminds you at a useful time. An entry with its own time in Librus (a meeting at 17:30) keeps it and lasts an hour; a trip over several days and days off stay all-day. Copies already in the calendar are rewritten when you turn it on or off.
dry_run Optional - only return what would change.

Returns created, updated, deleted, adopted (copies made earlier without a tag - same title, same day - taken over instead of added again), unchanged, not_removable and errors; with dry_run also planned (each change with its title).

action: librus_synergia.sync_calendar
data:
  device_id: 1234567890abcdef
  target_calendar: calendar.family
  categories: sprawdzian, kartkówka, wycieczka, zebranie
  prefix: "Ola:"
response_variable: result

librus_synergia.count_lessons

How many lessons of a subject fall between two dates - "how many maths lessons before the test?" (0.12.50+). Weeks within 3 weeks of this one count from the real timetable (fetched like a dashboard's, cancelled lessons left out) - that's where a substitution or a cancelled lesson can already be known; further weeks (since 0.12.52; before, up to 12 weeks were fetched), and weeks Librus hasn't published yet, count from the standard weekly plan. A further week the integration already fetched for a dashboard counts from that copy. Days off are skipped, and so are the lessons a part-day off frees.

Field Description
device_id The Librus Synergia device (student).
subject A subject name or part of it (matem), several separated by commas (polski, angielski), or a subject id. Case and Polish letters don't matter. A name that matches nothing is refused with the list of the student's subjects.
start_date Optional - the first day counted. Today if left out.
end_date The last day counted (included). At most a year after start_date.
include_cancelled Optional - also count lessons cancelled in the timetable (default off).

Returns subjects (the subjects matched), count, cancelled, from_timetable, from_plan, and lessons - each with date, lesson_no, subject, start, end (both empty for lessons from the weekly plan), source (timetable or plan) and cancelled.

action: librus_synergia.count_lessons
data:
  device_id: 1234567890abcdef
  subject: matematyka
  end_date: "2026-12-04"
response_variable: maths
# "{{ maths.count }} lessons of maths until the test"

librus_synergia.get_lesson_topics

The lessons held with their topics for any part of the school year, optionally of one subject (since 0.12.60). The Lesson topics sensor keeps the last 31 days; this reads the whole year. It uses the topics the integration already has, so it makes no Librus request. The What was taught card uses it to go back week by week.

Field Description
device_id The Librus Synergia device (student).
start_date Optional - the first day (included). The start of the school year if left out.
end_date Optional - the last day (included). Today if left out.
subject Optional - a subject name or part of it (matem), several separated by commas, or a subject id. A name that matches nothing is refused with the list of the student's subjects.

Returns lessons - newest day first, each with date, lesson_no, subject, subject_id, topic, is_trip and absent (the student missed that lesson) - and subjects, every subject with topics this year (id, name).

action: librus_synergia.get_lesson_topics
data:
  device_id: 1234567890abcdef
  subject: matematyka
  start_date: "2026-11-01"
response_variable: maths
# "{{ maths.lessons | selectattr('absent') | list | count }} maths lessons missed since November"

Writing messages (beta)

Three services write to Wiadomości from the parent's account. Sending is off by default: turn on Allow sending messages (beta) under the integration's Configure. A message goes to a real person, so:

  • it is sent once, never retried - when Librus doesn't answer (or answers with a server error), the error says it may have gone out and the sent messages are fetched at once; check them before trying again,
  • at most 10 messages an hour per student,
  • a recipient that matches more than one person is refused, never guessed,
  • dry_run: true shows who would get what without sending (it works with sending off),
  • Assist and the weekly AI summary can't send.

Note

Beta: a reply in a thread has been confirmed on a live account; new messages and withdrawing follow Librus's own web app but haven't been confirmed on many accounts yet. If the recipient list looks wrong (e.g. a kindergarten account), the integration's downloaded diagnostics list the recipient groups Librus offers the account (message_recipients, no names) - attach them to an issue.

librus_synergia.get_message_recipients

Read-only. Returns recipients: everyone a message can go to - the class tutor, the teachers (each with the subjects they teach the student), head teachers, the secretary's office and every other staff group Librus offers the account (e.g. "Logopeda") - with account_id, name, group, group_name, subjects, available and return_at. Parent councils, your own custom groups and Librus's support account are left out. A kindergarten account is offered no tutors group; the tutor of the child's group is found by name among the teachers and listed as tutors. Kindergarten accounts get no subjects (Librus refuses that list there).

librus_synergia.send_message

Field Description
device_id The student whose parent account sends it.
recipient Who gets it - one or more of: wychowawca (the class tutor), sekretariat, a subject (its teacher, e.g. Matematyka or matem), part of a name, or an account_id from get_message_recipients. Not used with reply_to.
topic The subject line. Required for a new message; with reply_to it defaults to "Re: ".
message The text. Plain text; new lines are kept.
reply_to Optional - a received message's id (from the Unread messages sensor's recent): the message goes to its sender, in its thread. Opening the message to find the sender marks it read.
dry_run Optional - only return who it would go to and what.

Returns sent, message_id, to (names), topic and reply_to. A reply's message_id is null: Librus doesn't return the id for a reply (the reply itself shows in the sent messages).

action: librus_synergia.send_message
data:
  device_id: <the student's device>
  recipient: wychowawca
  topic: Nieobecność jutro
  message: |
    Dzień dobry,
    jutro Ola będzie nieobecna z powodu wizyty u lekarza.
response_variable: sent

librus_synergia.withdraw_message

Withdraws a message you sent, while Librus still allows it (when exactly it stops allowing that isn't known yet). Fields: device_id, message_id (message_id from send_message, or id in the Unread messages sensor's outbox_recent).

Clone this wiki locally