Skip to content

Instantly share code, notes, and snippets.

@Muspi
Created November 5, 2025 21:28
Show Gist options
  • Select an option

  • Save Muspi/ddaebabc144a498fd8fa6e66a3f02c31 to your computer and use it in GitHub Desktop.

Select an option

Save Muspi/ddaebabc144a498fd8fa6e66a3f02c31 to your computer and use it in GitHub Desktop.
Home assistant Jinja widget for pronote
{% set now = now() %}
{% set enfants = [
{"name":"Raphaรซl","emoji":"๐Ÿ‘ฆ","today":state_attr("sensor.pronote_millon_raphael_today_s_timetable","lessons"),"tomorrow":state_attr("sensor.pronote_millon_raphael_tomorrow_s_timetable","lessons"),"color":"#1E88E5"},
{"name":"Baptiste","emoji":"๐Ÿง’","today":state_attr("sensor.pronote_millon_baptiste_today_s_timetable","lessons"),"tomorrow":state_attr("sensor.pronote_millon_baptiste_tomorrow_s_timetable","lessons"),"color":"#43A047"}
] %}
{% for e in enfants %}
{% set next_cours = namespace(text="") %}
{% if e.today %}
{% for cours in e.today %}
{% set start = as_local(cours.start_at) %}
{% if start > now and not next_cours.text %}
{% set next_cours.text = "<div style='color:"+e.color+"; font-weight:bold;'>"+e.emoji+" "+e.name+"</div>" ~
"<div style='margin-left:5px;'>๐Ÿง  "+cours.lesson+" ๐Ÿ“ "+(cours.classroom | default("N/A"))+" ๐Ÿ•’ "+start.strftime('%H:%M')+"</div>" %}
{% endif %}
{% endfor %}
{% endif %}
{% if not next_cours.text %}
{% if e.tomorrow and e.tomorrow|length>0 %}
{% set start = as_local(e.tomorrow[0].start_at) %}
{% set next_cours.text = "<div style='color:"+e.color+"; font-weight:bold;'>"+e.emoji+" "+e.name+"</div>" ~
"<div style='margin-left:5px;'>๐ŸŒ… ๐Ÿง  "+e.tomorrow[0].lesson+" ๐Ÿ“ "+(e.tomorrow[0].classroom | default("N/A"))+" ๐Ÿ•’ "+start.strftime('%H:%M')+"</div>" %}
{% else %}
{% set next_cours.text = "<div style='color:"+e.color+"; font-weight:bold;'>"+e.emoji+" "+e.name+"</div>" ~
"<div style='margin-left:5px;'>๐ŸŽ‰ Pas de cours prรฉvu</div>" %}
{% endif %}
{% endif %}
{{ next_cours.text }}
{% if not loop.last %}
<br>
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment