Ich arbeite an den HA-Karten von Pronote

Dieser Block verfolgt meine Arbeit an den Karten von @vingerha und denen von @dathosim.

Mein Ziel ist es, das Skript zu ersetzen. Python durch Integration.

[Aktualisierung dieser Seite]

  • Nach der Korrektur von V0.6.0, Homeworks ersetzt durch Homework 
  • Menükarte der Kantine hinzugefügt (>V6.0.6)

Voraussetzungen

Ich denke darüber nach, die Schnittstelle zu installieren. Card-Mod in HACS

Die Arbeitszeitkarte

Beide sind super sauber, für den abgesagten Kurs zögere ich zwischen dem roten Knopf oder dem durchgestrichenen Zeitplan, beide sind relevant.

Ich habe eine Mischung aus beiden gemacht und einen Bereich vor „Klassenrat“ hinzugefügt, und ich habe auch das Datum im Titel überarbeitet, da es gefunden werden musste.

Der Code lautet:

- Typ: Markdown Content: &gt;- {% set items = state_attr('sensor.pronote_xx_coralie_timetable_next_day','lessons') %} <div>Zeitaufwand für: {{as_timestamp(items[0].start_at) | int | timestamp_custom('%d/%m/%Y', true)}} </div>

    <table>   {% for i in range(0, items | count, 1) %}  <tr> 
      {%- if items[i].canceled!= True -%} 
      <td><mark>{{ items[i].start_time}}</td> 
      <td><mark>{{ items[i].end_time }}</td></mark>
      <td>{{ items[i].lesson }} {% else %} <td><del>{{ items[i].start_time }}</td> <td><del>{{ items[i].end_time}}</td> <td><del>{{ items[i].lesson }}</del> {%- endif -%} {% if items[i].status != None %} <span> {{ items[i].status }}</td> {% endif %} <td> {{items[i].classroom }}</td> </tr> {% endfor %} </table> 
  card_mod: Stil: .: | ha-card ha-markdown { padding:0px } ha-card ha-markdown.no-header { padding:0px } ha-markdown$: | div { background-color:rgb(100, 100, 100); Padding: 12px 12px; color:white; font-weight:normal; font-size:1.2em; border-top-left-radius: 5px; border-top-right-radius: 5px; } table{ Border-Collapse: Kollaps; font-size: 0.9em; font-family: Roboto; width: 100%, Outline: 0px solid #393c3d; margin-top:5px; } caption { text-align: Zentrum; font-weight: bold; font-size: 1.2em; } td { padding: 5px 10px 5px 10px; text-align: left; Border-Bottom: 0px solid #1c2020; } tr { border-bottom: 0px solid #1c2020; } tr:nth-of-type(even) { background-color: rgb(54, 54, 54, 0.3); } tr:last-of-type { border-bottom: transparent; }* mark { background: #009767; color: #222627; Border-Radius: 5px; Padding: 5px; } span { background: #EC4B34; color: #222627; Border-Radius: 5px; Padding: 5px; } span { padding: 5px; } tr:nth-child(n+2) &gt; td:nth-child(2) { text-align: left; }Typ: ''

Die Hausaufgabenkarte

Ich habe mein Unternehmen gewechselt, und das Ergebnis ist:

Sein Code:

- Typ: Markdown Content: |-
    <div>Pflichten</div>
    <table>
        <tbody>
            {% set items = state_attr('sensor.pronote_xx_coralie_homework','homework') %} {%-for i in range(0, items | count, 1) -%}
            <tr>
                <td>
                {%- if items[i].done == true -%}
                    <mark>
                    {{items[i].date.strftime("%d/%m)}}
                    </mark>
                {%- else -%}
                    <span>
                    {{items[i].date.strftime("%d/%m)}}
                    </span>
                {% endif %}</td>              
                <td>{{items[i].subject}}</td>
                <td>{{items[i].description}}</td>
            </tr>
            {% endfor %}
      </tbody>
    </table>
  card_mod: Stil: .: | ha-card ha-markdown { padding:0px } ha-card ha-markdown.no-header { padding:0px } ha-markdown$: | h1 { font-weight: normal; font-size: 24px; } div { background-color:rgb(100, 100, 100); Padding: 12px 12px; color:white; font-weight:normal; font-size:1.2em; border-top-left-radius: 5px; border-top-right-radius: 5px; } table{ Border-Collapse: Kollaps; font-size: 0.9em; font-family: Roboto; width: Auto; Outline: 0px solid #393c3d; Margin-Top: 10px; } caption { text-align: Zentrum; font-weight: bold; font-size: 1.2em; } td { padding: 5px 5px 5px 5px; text-align: left; Border-Bottom: 0px solid #1c2020; } tr { border-bottom: 0px solid #1c2020; } tr:nth-of-type(even) { background-color: rgb(54, 54, 54, 0.3); } tr:last-of-type { border-bottom: transparent; } mark { background: #009767; color: #222627; Border-Radius: 5px; Padding: 5px; } span { background: #EC4B34; color: #222627; Border-Radius: 5px; Padding: 5px; } span { padding: 5px; } tr:nth-child(n+2) &gt; td:nth-child(2) { text-align: left; }

Anmerkung: Es ist zu prüfen, ob sensor.pronote_xx_coralie_homework_period oder sensor.pronote_xx_coralie_homework verwendet werden soll, wenn mehrere Tage vergangen sind.

Die Karte der Bewertungen

Ich hatte bereits das Grüne mehr in das Grüne Herz verwandelt, das finde ich schöner. Hier ist die Karte mit der Integration:

- Typ: Markdown Content: &gt;-
    <div>Bewertungen</div> {% set items = state_attr('sensor.pronote_xx_coralie_evaluations','evaluations')%}
    <table width='100%'>
      <tbody>
      {% for i in range(0, items | count, 1) %}
      <tr><td width='10%'>{{ items[i].date.strftime("%d-%m") }}</td><td width='60%'>{{ items[i].subject }}</td><td width='30%'>
      {% set Akquisitionen = items[i].Akquisitionen %} {% for j in range(0,Akquisitionen|count,1) %}{% if quisitions[j].level == 'Sehr gute Beherrschung' %}💚{% elif Acquisitions[j].level == 'Zufriedenstellende Beherrschung' %}🟢{% elif Acquisitions[j].level == "Beherrschungsbeginn" %}🟡{% elif quisitions[j].level == 'Fragile Beherrschung' %}🟡{% elif quisitions[j].level == 'Unzureichende Beherrschung' %}🟠{% else %}?{% endif %}{% endfor %}</td></tr>
      {% endfor %}
    </tbody> </table>
  card_mod: Stil: .: | ha-card ha-markdown { padding:0px } ha-card ha-markdown.no-header { padding:0px } ha-markdown$: | h1 { font-weight: normal; font-size: 24px; } div { background-color:rgb(100, 100, 100); Padding: 12px 12px; color:white; font-weight:normal; font-size:1.2em; border-top-left-radius: 5px; border-top-right-radius: 5px; } table{ Border-Collapse: Kollaps; font-weight:normal; font-size:1.2em; font-family: Roboto; width: Auto; Outline: 0px solid #393c3d; Margin-Top: 10px; } caption { text-align: Zentrum; font-weight: bold; font-size: 1.2em; } td { padding: 0px 5px 0px 5px; text-align: left; Border-Bottom: 0px solid #1c2020; } tr { border-bottom: 0px solid #1c2020; Line-Height: 4px; } tr:nth-of-type(even) { background-color: rgb(54, 54, 54, 0.3); } tr:last-of-type { border-bottom: transparent; } mark { background: #009767; color: #222627; Border-Radius: 10px; Padding: 5px; } span { background: #EC4B34; color: #222627; Border-Radius: 10px; Padding: 5px; } span { padding: 5px; } tr:nth-child(n+2) &gt; td:nth-child(2) { text-align: left; }

Karte der Abwesenheiten

Sie ist perfekt, um mit dem Design der anderen Karten Schritt zu halten, das Ergebnis ergibt:

- Typ: Markdown Content: &gt;-
    <div>Abwesenheiten</div><table> 

    {% set items = state_attr('sensor.pronote_xxxx_coralie_Abwesenheit',Abwesenheit') %} {% for i in range(0, items | count, 1) %}

    <tr>

    {%- if items[i].justified == True -%}

    <td> <mark> {{ items[i].from.strftime("%d-%m") }}</mark></td>

    {% else %}

    <td> <span>{{ items[i].from.strftime("%d-%m") }}</span></td> 

    {%- endif -%} 

    <td>{{ items[i].hours }}</td>

    <td>{{ items[i].reason }}</td>

    {% endfor %} card_mod: Stil: .: | ha-card ha-markdown { padding:0px } ha-card ha-markdown.no-header { padding:0px } ha-markdown$: | div { background-color:rgb(100, 100, 100); Padding: 12px 12px; color:white; font-weight:normal; font-size:1.2em; border-top-left-radius: 5px; border-top-right-radius: 5px; } table{ Border-Collapse: Kollaps; font-family: Roboto; width: 100%, Outline: 0px solid #393c3d; margin-top:5px; } caption { text-align: Zentrum; font-weight: bold; font-size: 1.2em; } td { padding: 5px 10px 5px 10px; text-align: left; Border-Bottom: 0px solid #1c2020; } tr { border-bottom: 0px solid #1c2020; } tr:nth-of-type(even) { background-color: rgb(54, 54, 54, 0.3); } tr:last-of-type { border-bottom: transparent; }* mark { background: #009767; color: #222627; Border-Radius: 5px; Padding: 5px; } span { background: #EC4B34; color: #222627; Border-Radius: 5px; Padding: 5px; } span { padding: 5px; } tr:nth-child(n+2) &gt; td:nth-child(2) { text-align: left; }

Speisekarte der Kantine

V6.0.6 Minimum erforderlich

Typ: Markdown Content: |-
  <div>Kantinen-Menüs</div>
  <table>
      <tbody>
  {% set items = state_attr('sensor.pronote_xxx_menus','menus') %}
    <tr>
    <td><h4>Datum</td>
    <td><h4>Eingang</td>
    <td><h4>Hauptgericht</td>
    <td><h4>Begleitung</td>
    <td><h4>Käse</td>
    <td><h4>Dessert</td>
    </tr>
  {% for i in range(0, items | count, 1) %} {% if items[i].is_lunch == True %}
    <tr>
    <td>      
    <mark>  
    {{ items[i].date | as_datetime | as_timestamp | timestamp_custom('%d/%m') }}
    </mark>
    </td>
    <td> 
      {% for entry in items[i].first_meal %} {{ entry.name }} {% endfor %}
    </td>
    <td> 
      {% for main in items[i].main_meal %} {{ main.name }} {% endfor %}
    </td>
    <td>
      {% if items[i].side_meal %} {% for side in items[i].side_meal %} {{ side.name }} {% endfor %} {% else %} PAS_DISPO {% endif %}
    </td>
    <td>
      {% for cheese in items[i].cheese %} {{ cheese.name }} {% endfor %}
    </td>
    <td>
      {% for dessert in items[i].dessert %} {{ dessert.name }} {% endfor %}
    </td>
      {% endif %} {% endfor %}
    </tbody>
  </table>
card_mod: Stil: .: | ha-card ha-markdown { padding:0px } ha-card ha-markdown.no-header { padding:10px } ha-markdown$: | div { background-color:rgb(100, 100, 100); Padding: 12px 12px; color:white; font-weight:normal; font-size:1.2em; border-top-left-radius: 5px; border-top-right-radius: 5px; } table{ Border-Collapse: Kollaps; font-family: Roboto; width: 100%, Outline: 0px solid #393c3d; margin-top:5px; } caption { text-align: Zentrum; font-weight: bold; font-size: 1.2em; } td { padding: 5px 10px 5px 10px; text-align: left; Border-Bottom: 0px solid #1c2020; } tr { border-bottom: 0px solid #1c2020; } tr:nth-of-type(even) { background-color: rgb(54, 54, 54, 0.3); } tr:last-of-type { border-bottom: transparent; }* mark { background: #009767; color: #222627; Border-Radius: 5px; Padding: 5px; } span { background: #EC4B34; color: #222627; Border-Radius: 5px; Padding: 5px; } span { padding: 5px; } tr:nth-child(n+2) &gt; td:nth-child(2) { text-align: left; }

 

Hinzufügung zusätzlicher Informationen

Dank der ausgezeichneten Idee des Skript von @dathosim, Ich werde Templates hinzufügen, die mir diese Informationen geben, Code, der in Template platziert werden soll

- sensor: - name: Letzte Aktualisierung von _id Single Pronote: sensor.letzte _mise_a_jour_de_pronote icon: "mdi:update" state: "{{ state_attr('sensor.pronote_xx_coralie','updated_at').strftime('%d-%m-%Y bis %H:%M') }}" - sensor: - name: Beginn der Coralie-Kurse - Morgen einzigartig_id: sensor.debut_des_cours_de_coralie_morgen icon: "mdi:clock-time-five-outline" state: >- {% if state_attr('sensor.pronote_xx_coralie_timetable_tomorrow', 'lessons')[0] is defined %} {{state_attr('sensor.pronote_xx_coralie_timetable_tomorrow', 'lessons')[0]['start_at'].strftime('%H:%M')} {% else %} Kein Kurs {% endif %} - sensor: - name: Beginn der Coralie-Kurse - Heute einzigartig_id: sensor.debut_des_cours_de_coralie_heute_hui icon: "mdi:clock-time-five-outline" state: >- {% if state_attr('sensor.pronote_xx_coralie_timetable_today', 'lessons')[0] is defined %} {{state_attr('sensor.pronote_xx_coralie_timetable_today', 'lessons')[0]['start_at'].strftime('%H:%M')} {% else %} Kein Kurs {% endif %}

 

 

Endergebnis 

Endgültiger Code der vollständigen Fliese:

Typ: horizontal-stack columns: 1 Platz: False Cards: - Typ: vertikale Stack-Karten: - Typ: Markdown Content: &gt;- {% set items = state_attr('sensor.pronote_xx_coralie_timetable_today','lessons') %} <div>Zeitaufwand für: {{as_timestamp(items[0].start_at) | int | timestamp_custom('%d/%m/%Y', true)}} </div>

          <table>   {% for i in range(0, items | count, 1) %}  <tr> 
            {%- if items[i].canceled!= True -%} 
            <td><mark>{{ items[i].start_time}}</td> 
            <td><mark>{{ items[i].end_time }}</td></mark>
            <td>{{ items[i].lesson }} {% else %} <td><del>{{ items[i].start_time }}</td> <td><del>{{ items[i].end_time}}</td> <td><del>{{ items[i].lesson }}</del> {%- endif -%} {% if items[i].status != None %} <span> {{ items[i].status }}</td> {% endif %} <td> {{items[i].classroom }}</td> </tr> {% endfor %} </table> 
        card_mod: Stil: .: | ha-card ha-markdown { padding:0px } ha-card ha-markdown.no-header { padding:10px } ha-markdown$: | div { background-color:rgb(100, 100, 100); Padding: 12px 12px; color:white; font-weight:normal; font-size:1.2em; border-top-left-radius: 5px; border-top-right-radius: 5px; } table{ Border-Collapse: Kollaps; font-family: Roboto; width: 100%, Outline: 0px solid #393c3d; margin-top:5px; } caption { text-align: Zentrum; font-weight: bold; font-size: 1.2em; } td { padding: 5px 10px 5px 10px; text-align: left; Border-Bottom: 0px solid #1c2020; } tr { border-bottom: 0px solid #1c2020; } tr:nth-of-type(even) { background-color: rgb(54, 54, 54, 0.3); } tr:last-of-type { border-bottom: transparent; }* mark { background: #009767; color: #222627; Border-Radius: 5px; Padding: 5px; } span { background: #EC4B34; color: #222627; Border-Radius: 5px; Padding: 5px; } span { padding: 5px; } tr:nth-child(n+2) &gt; td:nth-child(2) { text-align: left; } - Typ: Markdown Content: &gt;- {% set items = state_attr('sensor.pronote_xx_coralie_timetable_next_day','lessons') %} <div>Zeitaufwand für: {{as_timestamp(items[0].start_at) | int | timestamp_custom('%d/%m/%Y', true)}} </div>

          <table>   {% for i in range(0, items | count, 1) %}  <tr> 
            {%- if items[i].canceled!= True -%} 
            <td><mark>{{ items[i].start_time}}</td> 
            <td><mark>{{ items[i].end_time }}</td></mark>
            <td>{{ items[i].lesson }} {% else %} <td><del>{{ items[i].start_time }}</td> <td><del>{{ items[i].end_time}}</td> <td><del>{{ items[i].lesson }}</del> {%- endif -%} {% if items[i].status != None %} <span> {{ items[i].status }}</td> {% endif %} <td> {{items[i].classroom }}</td> </tr> {% endfor %} </table> 
        card_mod: Stil: .: | ha-card ha-markdown { padding:0px } ha-card ha-markdown.no-header { padding:10px } ha-markdown$: | div { background-color:rgb(100, 100, 100); Padding: 12px 12px; color:white; font-weight:normal; font-size:1.2em; border-top-left-radius: 5px; border-top-right-radius: 5px; } table{ Border-Collapse: Kollaps; font-family: Roboto; width: 100%, Outline: 0px solid #393c3d; margin-top:5px; } caption { text-align: Zentrum; font-weight: bold; font-size: 1.2em; } td { padding: 5px 10px 5px 10px; text-align: left; Border-Bottom: 0px solid #1c2020; } tr { border-bottom: 0px solid #1c2020; } tr:nth-of-type(even) { background-color: rgb(54, 54, 54, 0.3); } tr:last-of-type { border-bottom: transparent; }* mark { background: #009767; color: #222627; Border-Radius: 5px; Padding: 5px; } span { background: #EC4B34; color: #222627; Border-Radius: 5px; Padding: 5px; } span { padding: 5px; } tr:nth-child(n+2) &gt; td:nth-child(2) { text-align: left; } - Typ: Markdown Content: |-
          <div>Pflichten</div>
          <table>
              <tbody>
                  {% set items = state_attr('sensor.pronote_xx_coralie_homework','homework') %} {%-for i in range(0, items | count, 1) -%}
                  <tr>
                      <td>
                      {%- if items[i].done == true -%}
                          <mark>
                          {{items[i].date.strftime("%d/%m)}}
                          </mark>
                      {%- else -%}
                          <span>
                          {{items[i].date.strftime("%d/%m)}}
                          </span>
                      {% endif %}</td>              
                      <td>{{items[i].subject}}</td>
                      <td>{{items[i].description}}</td>
                  </tr>
                  {% endfor %}
            </tbody>
          </table>
        card_mod: Stil: .: | ha-card ha-markdown { padding:0px } ha-card ha-markdown.no-header { padding:10px } ha-markdown$: | h1 { font-weight: normal; font-size: 24px; } div { background-color:rgb(100, 100, 100); Padding: 12px 12px; color:white; font-weight:normal; font-size:1.2em; border-top-left-radius: 5px; border-top-right-radius: 5px; } table{ Border-Collapse: Kollaps; font-weight:normal; font-size:1.2em; font-family: Roboto; width: Auto; Outline: 0px solid #393c3d; Margin-Top: 10px; } caption { text-align: Zentrum; font-weight: bold; font-size: 1.2em; } td { padding: 5px 5px 5px 5px; text-align: left; Border-Bottom: 0px solid #1c2020; } tr { border-bottom: 0px solid #1c2020; } tr:nth-of-type(even) { background-color: rgb(54, 54, 54, 0.3); } tr:last-of-type { border-bottom: transparent; } mark { background: #009767; color: #222627; Border-Radius: 5px; Padding: 5px; } span { background: #EC4B34; color: #222627; Border-Radius: 5px; Padding: 5px; } span { padding: 5px; } tr:nth-child(n+2) &gt; td:nth-child(2) { text-align: left; } - Typ: Markdown Content: &gt;-
          <div>Abwesenheiten</div><table> 

          {% set items = state_attr('sensor.pronote_xx_coralie_Abwesenheit','Abwesenheit') %} {% for i in range(0, items | count, 1) %}

          <tr>

          {%- if items[i].justified == True -%}

          <td> <mark> {{ items[i].from.strftime("%d-%m") }}</mark></td>

          {% else %}

          <td> <span>{{ items[i].from.strftime("%d-%m") }}</span></td> 

          {%- endif -%} 

          <td>{{ items[i].hours }}</td>

          <td>{{ items[i].reason }}</td>

          {% endfor %} card_mod: Stil: .: | ha-card ha-markdown { padding:0px } ha-card ha-markdown.no-header { padding:10px } ha-markdown$: | div { background-color:rgb(100, 100, 100); Padding: 12px 12px; color:white; font-weight:normal; font-size:1.2em; border-top-left-radius: 5px; border-top-right-radius: 5px; } table{ Border-Collapse: Kollaps; font-family: Roboto; width: 100%, Outline: 0px solid #393c3d; margin-top:5px; } caption { text-align: Zentrum; font-weight: bold; font-size: 1.2em; } td { padding: 5px 10px 5px 10px; text-align: left; Border-Bottom: 0px solid #1c2020; } tr { border-bottom: 0px solid #1c2020; } tr:nth-of-type(even) { background-color: rgb(54, 54, 54, 0.3); } tr:last-of-type { border-bottom: transparent; }* mark { background: #009767; color: #222627; Border-Radius: 5px; Padding: 5px; } span { background: #EC4B34; color: #222627; Border-Radius: 5px; Padding: 5px; } span { padding: 5px; } tr:nth-child(n+2) &gt; td:nth-child(2) { text-align: left; } - Typ: custom:auto-entities card: Typ: entities filter: include: - entity_id: binary_sensor.ouvrable_hui - entity_id: binary_sensor.ouvrable_morgen - entity_id: binary_sensor.urlaub_schuleheute - entity_id: binary_sensor.urlaub_Schulen_morgen - entity_id: sensor.debut_des_cours_de_coralie_hui - entity_id: sensor.debut_des_cours_de_coralie_morgen - entity_id: sensor.coralie_next_alarm - Typ: custom:auto-entities card: Typ: entities filter: include: - entity_id: sensor.letzte _mise_a_jour_de_pronote - Typ: vertikale Stack-Karten: - Typ: Markdown Content: &gt;-
          <div>Bewertungen</div> {% set items = state_attr('sensor.pronote_xx_coralie_evaluations','evaluations')%}
          <table width='100%'>
            <tbody>
            {% for i in range(0, items | count, 1) %}
            <tr><td width='10%'>{{ items[i].date.strftime("%d-%m") }}</td><td width='60%'>{{ items[i].subject }}</td><td width='30%'>
            {% set Akquisitionen = items[i].Akquisitionen %} {% for j in range(0,Akquisitionen|count,1) %}{% if quisitions[j].level == 'Sehr gute Beherrschung' %}💚{% elif Acquisitions[j].level == 'Zufriedenstellende Beherrschung' %}🟢{% elif Acquisitions[j].level == "Beherrschungsbeginn" %}🟡{% elif quisitions[j].level == 'Fragile Beherrschung' %}🟡{% elif quisitions[j].level == 'Unzureichende Beherrschung' %}🟠{% else %}?{% endif %}{% endfor %}</td></tr>
            {% endfor %}
          </tbody> </table>
        card_mod: Stil: .: | ha-card ha-markdown { padding:0px } ha-card ha-markdown.no-header { padding:10px } ha-markdown$: | h1 { font-weight: normal; font-size: 24px; } div { background-color:rgb(100, 100, 100); Padding: 12px 12px; color:white; font-weight:normal; font-size:1.2em; border-top-left-radius: 5px; border-top-right-radius: 5px; } table{ Border-Collapse: Kollaps; font-weight:normal; font-size:1.2em; font-family: Roboto; width: Auto; Outline: 0px solid #393c3d; Margin-Top: 10px; } caption { text-align: Zentrum; font-weight: bold; font-size: 1.2em; } td { padding: 0px 5px 0px 5px; text-align: left; Border-Bottom: 0px solid #1c2020; } tr { border-bottom: 0px solid #1c2020; Line-Height: 4px; } tr:nth-of-type(even) { background-color: rgb(54, 54, 54, 0.3); } tr:last-of-type { border-bottom: transparent; } mark { background: #009767; color: #222627; Border-Radius: 10px; Padding: 5px; } span { background: #EC4B34; color: #222627; Border-Radius: 10px; Padding: 5px; } span { padding: 5px; } tr:nth-child(n+2) &gt; td:nth-child(2) { text-align: left; }