Coder Social home page Coder Social logo

kongo09 / hass-hhs-vertretungsplan Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 1.11 MB

A Home Assistant integration for the Vertretungsplan of Heinrich-Hertz-Schule, Hamburg

License: MIT License

Python 100.00%
home-assistant homeassistant hacs integration hhs vertretungsplan

hass-hhs-vertretungsplan's Introduction

hacs_badge

Support Heinrich-Hertz-Schule, Hamburg, Vertretungsplan in Home Assistant

Note:

  • This integration only makes sense to you, if your kid is attending the Heinrich-Hertz-Schule in Hamburg, Germany.
  • You will need a user name and a password to access the data. Please ask your Elternvertreter.

Setup

Installation:

  • Go to HACS -> Integrations
  • Click the three dots on the top right and select Custom Repositories
  • Enter https://github.com/kongo09/hass-hhs-vertretungsplan as repository, select the category Integration and click Add
  • A new custom integration shows up for installation (HHS Vertretungsplan) - install it
  • Restart Home Assistant

Configuration:

  • Go to Configuration -> Integrations
  • Click Add Integration
  • Search for HHS Vertretungsplan and select it
  • Specify the tutor group (Klasse) your kid is attending
  • Add your user name and password
  • If you have more than one kid, you can repeat the process and get one sensor per kid

Usage:

The integration provides a binary_sensor for the tutor group your kid is attending. The sensor has a list of all current classes that will be substituted or not take place according to the current planning of the school.

Entities:

Provided you did the setup for tutor group ´7f´ you get the following sensor:

Entity ID Type Description
binary_sensor.hhs_7f Binary Sensor Is on, if there is Vertretung today, for 7f. See attributes for details

Attributes:

The sensor has two attributes:

Name Content
status Date and time of when the data was updated by the school (not the sensor)
vertretung List of classes that are cancelled or substituted

The list has the following attributes for each class that is cancelled or substituted:

List attribute Content
datum The date when the substitution takes place
klasse The tutor group affected. This will be the tutor group you configured the sensor for, or alle
stunde Timing of the class affected
vertreter The stand-in teacher taking care of the kids
fach The class affected
raum Which room is affected. This is where the kids where originally supposed to be
text Some informational text from the school, e.g. if kids stay in their own classroom
nach Some further information
day The school day of the week - that's easier to read for the kids, but somewhat redundant to datum

Display:

There is no dedicated Lovelace card for this, and showing lists is not very common in Home Assistant. I suggest the following configuration to display the sensor:

type: custom:stack-in-card
mode: vertical
cards:
  - type: entities
    entities:
      - type: custom:template-entity-row
        entity: binary_sensor.hhs_7f
        color: |-
          {% if is_state(config.entity, 'Vertretung') %}
            #FDD835
          {% endif %}
        secondary: >-
          Status von  {{ as_timestamp(state_attr(config.entity, 'last_update'))
          | timestamp_custom('%-H:%M Uhr am %A') }}
  - type: conditional
    conditions:
      - entity: binary_sensor.hhs_7f
        state: Vertretung
    card:
      type: custom:flex-table-card
      entities:
        include: binary_sensor.hhs_7f
      columns:
        - data: vertretung
          modify: >-
            var days = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag',
            'Freitag', 'Samstag', 'Sonntag'];

            var d = new Date(x.datum).getDay();

            days[d-1]
          name: Tag
        - data: vertretung
          modify: x.stunde
          name: Stunde
        - data: vertretung
          modify: x.fach
          name: Fach
        - data: vertretung
          modify: x.vertreter
          name: Vertr.
        - data: vertretung
          modify: x.raum
          name: Raum
        - data: vertretung
          modify: '[x.text, x.nach].filter(Boolean).join('', '')'
          name: Info

This results in the following card:

Lovelace Card

Note, that this requires two custom frontend cards: custom:stack-in-card, custom:template-entity-row and custom:flex-table-card which need to be installed via HACS as well. They are part of the HACS index and can be found with the built-in search.

hass-hhs-vertretungsplan's People

Contributors

kongo09 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

lebetz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.