Repository navigation
Automation ideas
Sixteen ideas for what to do with your child's school data at home, from the morning alarm to Sunday evening. Eight of them use a ready-made blueprint: import it, pick your entities and add an action. The other eight are short automations you can paste below. The 4-minute ideas film shows all sixteen (English voice-over, Polish subtitles; it's also in the README).
Before you paste anything
- The examples use a child called Ola, with short entity ids such as
sensor.ola_next_lesson. Your entity ids are longer, for examplesensor.e_dziennik_ola_kowalska_next_lesson, and in a Home Assistant set to Polish they're in Polish (sensor.e_dziennik_ola_kowalska_nastepna_lekcja). Pick the right ones in the automation editor, or find them under Settings → Devices & services → Librus Synergia. -
notify.mobile_app_...,light.*,climate.*,input_datetime.*,person.*and similar entities stand for your own devices and helpers. - Paste a recipe in Settings → Automations → Create automation → ⋮ → Edit in YAML.
- With more than one child, every event carries
student. Add it toevent_data(for examplestudent: Ola Kowalska) so an automation only reacts to one child. - The blueprints' ready-made messages (
{{ wake_summary }},{{ briefing_text }}and the others) are in Polish. Write your own message in the action if you'd rather have English.
Contents
The light in the child's room fades up before the first lesson. It follows the timetable, so a day that starts with lesson 2 wakes later, and days off stay dark.
Blueprint: School Wake-Up. Set Minutes before the first lesson to 45 and use this action:
- action: light.turn_on
target:
entity_id: light.ola_room
data:
brightness_pct: 80
transition: 900 # 15 minutesWhen a lesson is cancelled and that moves the first lesson of the day, the alarm moves with it and the child gets a message saying why. The School start sensor already skips cancelled lessons, so the new time comes from there.
alias: "Librus: first lesson cancelled - sleep in"
mode: queued
triggers:
- trigger: event
event_type: librus_synergia_timetable_changed
event_data:
kind: canceled
actions:
- delay: "00:00:10" # let the school-day sensors catch up
- condition: template # the cancelled lesson is on the next school day
value_template: >
{% set first = as_datetime(states('sensor.ola_school_start'), none) %}
{{ first is not none and trigger.event.data.date == (first | as_local).date() | string }}
- variables:
first: "{{ (as_datetime(states('sensor.ola_school_start')) | as_local).strftime('%H:%M') }}"
alarm: >-
{{ ((as_datetime(states('sensor.ola_school_start')) | as_local)
- timedelta(minutes=45)).strftime('%H:%M:%S') }}
- condition: template # only when the alarm actually moves
value_template: "{{ alarm != states('input_datetime.ola_alarm') }}"
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.ola_alarm
data:
time: "{{ alarm }}"
- action: notify.mobile_app_ola_phone
data:
title: Sleep in!
message: >
{{ trigger.event.data.subject }} at {{ trigger.event.data.hour_from }} is cancelled.
The first lesson is at {{ first }}, so the alarm moved to {{ alarm[:5] }}.input_datetime.ola_alarm is a time-only helper your alarm reads. Recipe 1's wake-up light needs nothing extra, because it already follows School start.
At breakfast, the kitchen speaker reads the first lesson and room, the day's lucky number and any test in the next three days.
Blueprint: Morning Briefing, with the optional Lucky number and Next exam sensors filled in. The text is in Polish, so pick a Polish voice:
- action: tts.speak
target:
entity_id: tts.google_translate_pl_pl # your TTS entity
data:
media_player_entity_id: media_player.kitchen_speaker
message: "{{ briefing_text }}"The hallway light turns amber when it's time to go, based on the first lesson and your travel time rather than a fixed clock.
Blueprint: Time to Leave. Set Travel time to the walk plus a few minutes, then:
- action: light.turn_on
target:
entity_id: light.hallway
data:
rgb_color: [255, 150, 30]
brightness_pct: 70
- action: notify.mobile_app_ola_phone
data:
message: "{{ leave_text }}"Ten minutes before a lesson that moved to another room, got a substitute teacher or was moved to another time, a note lands on the child's watch. The Next lesson sensor carries start, classroom, teacher, change (substitution / room_change / moved) and room_changed.
alias: "Librus: room change on the watch"
triggers:
- trigger: template
value_template: >
{% set s = state_attr('sensor.ola_next_lesson', 'start') %}
{{ s is not none and 0 < (as_datetime(s) - now()).total_seconds() <= 600 }}
conditions:
- condition: template
value_template: >
{{ state_attr('sensor.ola_next_lesson', 'room_changed')
or state_attr('sensor.ola_next_lesson', 'change') in ['substitution', 'room_change', 'moved'] }}
actions:
- action: notify.mobile_app_ola_watch
data:
title: >-
{{ states('sensor.ola_next_lesson') }} →
{{ state_attr('sensor.ola_next_lesson', 'classroom') or 'see the timetable' }}
message: >
{% if state_attr('sensor.ola_next_lesson', 'change') == 'substitution' %}
Substitute: {{ state_attr('sensor.ola_next_lesson', 'teacher') }}.
{% endif %}
Starts at {{ (as_datetime(state_attr('sensor.ola_next_lesson', 'start')) | as_local).strftime('%H:%M') }}.When the last lessons of the day are cancelled, the parent gets the new finishing time. The School end sensor moves to the earlier time, so recipe 7's pick-up reminder moves with it.
alias: "Librus: lessons end early today"
triggers:
- trigger: state
entity_id: sensor.ola_school_end
conditions:
- condition: template
value_template: >
{% set old = as_datetime(trigger.from_state.state, none) %}
{% set new = as_datetime(trigger.to_state.state, none) %}
{{ old is not none and new is not none
and (old | as_local).date() == (new | as_local).date() == now().date()
and new < old }}
actions:
- action: notify.mobile_app_parent_phone
data:
title: Ola finishes early today
message: >
Lessons end at {{ (as_datetime(trigger.to_state.state) | as_local).strftime('%H:%M') }},
not {{ (as_datetime(trigger.from_state.state) | as_local).strftime('%H:%M') }}.Shortly before the last lesson ends, Grandma gets a pick-up reminder and the heating warms the living room.
Blueprint: School Pick-Up Reminder, with this action:
- action: notify.mobile_app_grandma_phone
data:
message: "{{ pickup_summary }}"
- action: climate.set_temperature
target:
entity_id: climate.living_room
data:
temperature: 21A new message arrives as a notification with a Read button. Tapping it fetches the full text with the librus_synergia.get_message service and shows it in a second notification.
Warning
Opening a message this way marks it as read in Librus, the same as opening it on the Librus website.
Two automations. The first sends the notification:
alias: "Librus: new message with a Read button"
triggers:
- trigger: event
event_type: librus_synergia_new_message
actions:
- action: notify.mobile_app_parent_phone
data:
title: "{{ trigger.event.data.sender }}"
message: "{{ trigger.event.data.topic }}"
data:
actions:
- action: "LIBRUS_READ_{{ trigger.event.data.id }}"
title: Read
- action: LIBRUS_LATER
title: LaterThe second one runs when you tap Read:
alias: "Librus: read a message"
triggers:
- trigger: event
event_type: mobile_app_notification_action
conditions:
- "{{ trigger.event.data.action.startswith('LIBRUS_READ_') }}"
actions:
- action: librus_synergia.get_message
data:
device_id: "{{ device_id('sensor.ola_unread_messages') }}"
message_id: "{{ trigger.event.data.action[12:] }}"
response_variable: msg
- action: notify.mobile_app_parent_phone
data:
title: "{{ msg.topic }}"
message: "{{ msg.content[:1500] }}"When the child gets home and a test or quiz is three days away or less, their phone shows the topics to revise: the lessons taught in that subject since the previous test, with the missed ones marked. It runs at most once a day.
alias: "Librus: what to revise, when Ola gets home"
triggers:
- trigger: state
entity_id: person.ola
to: home
conditions:
- condition: template
value_template: >
{% set d = state_attr('sensor.ola_next_exam', 'days_until') %}
{{ d is not none and 0 < d <= 3 }}
- condition: template # once a day
value_template: >
{{ this.attributes.last_triggered is none
or (this.attributes.last_triggered | as_local).date() != now().date() }}
actions:
- action: notify.mobile_app_ola_phone
data:
title: >-
{{ state_attr('sensor.ola_next_exam', 'category') or 'Test' }}:
{{ state_attr('sensor.ola_next_exam', 'subject') }}
in {{ state_attr('sensor.ola_next_exam', 'days_until') }} day(s)
message: |-
{%- for t in state_attr('sensor.ola_next_exam', 'topics') or [] %}
• {{ t.topic }}{{ ' (missed)' if t.absent }}
{%- endfor %}To get the reminder at a fixed time instead, use the What to Revise Before a Test blueprint.
At 20:00 before a school day, if something due tomorrow is still open on the Homework to-do list, the child gets a reminder. Tick it off and no reminder comes.
alias: "Librus: homework due tomorrow still open"
triggers:
- trigger: time
at: "20:00:00"
conditions:
- condition: state
entity_id: binary_sensor.ola_school_day_tomorrow
state: "on"
actions:
- action: todo.get_items
target:
entity_id: todo.ola_homework
data:
status: needs_action
response_variable: hw
- variables:
tomorrow: "{{ (now() + timedelta(days=1)).date() | string }}"
still_open: >-
{{ hw['todo.ola_homework']['items']
| selectattr('due', 'defined') | selectattr('due', 'eq', tomorrow)
| map(attribute='summary') | list }}
- condition: template
value_template: "{{ still_open | count > 0 }}"
- action: notify.mobile_app_ola_phone
data:
title: Homework for tomorrow
message: "{{ still_open | join(', ') }}"Each new grade reaches the parent with its category, weight and the teacher's comment. When a grade lowers the report card forecast, a second message says how many sixes would win it back.
Blueprints: New Grade Notification with Include details on ({{ grade_summary }}), and Grade Forecast Changed with Only when it drops on ({{ forecast_summary }}). Send both to the parent's phone only. The Low Grade Alert is a quieter alternative to the first one.
On Friday evening, a reminder lists the absences that still need an excuse. A day you've already sent an excuse for is left out, and once the homeroom teacher accepts it, it drops off the list.
Blueprints: Absences To Justify Reminder with Days set to Friday and Time to 19:00 ({{ reminder_text }}), plus Absence Justification Decided ({{ justification_summary }}) to hear when an excuse is accepted.
On a weekday evening, when tomorrow has no lessons (a class day off, a principal's day, every lesson cancelled), the house switches to weekend mode. The optional workday condition skips public holidays your other automations already handle. Add a Workday sensor with Offset 1 for it.
alias: "Librus: no school tomorrow - weekend mode"
triggers:
- trigger: time
at: "21:00:00"
conditions:
- condition: time
weekday: [sun, mon, tue, wed, thu]
- condition: state
entity_id: binary_sensor.ola_school_day_tomorrow
state: "off"
- condition: state # optional
entity_id: binary_sensor.workday_tomorrow
state: "on"
actions:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.ola_alarm_tomorrow
- action: scene.turn_on
target:
entity_id: scene.heating_weekend
- action: notify.mobile_app_parent_phone
data:
message: No school for Ola tomorrow - alarm off, weekend heating.Turn input_boolean.ola_alarm_tomorrow back on in the same automation that runs your alarm, once it's done for the day. The School Wake-Up blueprint from recipe 1 skips days off by itself.
Tests, quizzes, trips, parent meetings and days off copy themselves into your family calendar (Google Calendar, for example), next to everyone's other plans.
Blueprint: Copy School Events to a Calendar. The default categories already cover tests (sprawdzian), quizzes (kartkówka), exams, trips and meetings. Add the Free days calendar to copy days off too.
On the day of a parent-teacher meeting, the parent gets a reminder when it's time to leave, based on the live driving time. The meeting's time comes from the Agenda entry's description, which starts with the time when Librus has one ("17:30 · ..."). That needs a version of the integration newer than 0.12.9. The driving time comes from a travel-time sensor such as Waze Travel Time from home to school.
alias: "Librus: leave for the parent-teacher meeting"
triggers:
- trigger: time_pattern
minutes: "/5"
conditions:
- condition: time
after: "12:00:00"
before: "21:00:00"
actions:
- action: calendar.get_events
target:
entity_id: calendar.ola_agenda
data:
start_date_time: "{{ today_at() }}"
end_date_time: "{{ today_at() + timedelta(days=1) }}"
response_variable: cal
- variables:
drive: "{{ states('sensor.home_to_school_travel_time') | int(15) }}"
start: >-
{%- set ns = namespace(t='') -%}
{%- for e in cal['calendar.ola_agenda'].events -%}
{%- set t = (e.description or '')[:5] -%}
{%- if 'zebranie' in (e.summary | lower) and t | length == 5 and t[2] == ':' -%}
{%- set ns.t = t -%}
{%- endif -%}
{%- endfor -%}
{{ ns.t }}
- condition: template
value_template: >
{% if start %}
{% set leave = today_at(start) - timedelta(minutes=drive + 10) %}
{{ leave <= now() < leave + timedelta(minutes=5) }}
{% else %}false{% endif %}
- action: notify.mobile_app_parent_phone
data:
title: "Parent-teacher meeting at {{ start }}"
message: "Leave now - {{ drive }} min drive."On Sunday evening, the speaker reads the week's summary, written by your own AI model in Home Assistant, and the to-dos go to your phone. You need the weekly AI summary set up first.
Blueprint: Weekly AI Summary Report, with Report format set to short:
- action: tts.speak
target:
entity_id: tts.google_translate_pl_pl # your TTS entity
data:
media_player_entity_id: media_player.living_room
message: "{{ message_short }}"
- action: notify.mobile_app_parent_phone
data:
title: "{{ title }}"
message: "{{ message }}"Have an idea that isn't here? Open an issue and describe it.
Getting started
Features
Reference
Elsewhere