MVV Departure Display - OpenEPaperLink/Home_Assistant_Integration GitHub Wiki

MVV Departure Board Display

This automation creates a real-time departure board display for Munich public transport (MVV) using an E-Paper display. It updates every 5 minutes when you're at home, showing the next 5 departures from your configured station.

IMG_1954

Prerequisites

Installation

  1. Install the munich_public_transport integration in your Home Assistant instance
  2. Configure your desired station in the integration
  3. Add the automation code to your Home Assistant configuration

Configuration

Required Customization

Before using this automation, you need to replace the following placeholders in the code:

  • <YOUR_PERSON_ENTITY> - Your Home Assistant person entity (e.g., person.john)
  • <YOUR_STATION_SENSOR> - Your MVV station sensor ID (e.g., sensor.hauptbahnhof_all_departures)
  • <YOUR_HOME_ZONE> - Your home zone entity ID (e.g., zone.home)

Automation Code

#
alias: MVV Departure Display
description: MVV departure board display
triggers:
  # Trigger every 5 minutes to update departure times
  - minutes: /5
    trigger: time_pattern
conditions:
  # Only run when person is at home
  - condition: zone
    entity_id: <YOUR_PERSON_ENTITY>
    zone: <YOUR_HOME_ZONE>
actions:
    data:
      # Set white background
      background: white
      rotate: 0
      payload:
        # Station name header centered at top
        - type: text
          value: "{{ station_name }}"
          x: 148
          "y": 15
          align: center
          anchor: mm
          size: 20
        # Horizontal line separator under header
        - type: line
          x_start: 0
          x_end: 296
          y_start: 25
          fill: black
          width: 1
        # Colored rectangles for line numbers (left column)
        - type: rectangle_pattern
          x_start: 5
          y_start: 28
          x_offset: 0
          y_offset: 2
          x_size: 35
          y_size: 18
          fill: accent
          outline: accent
          width: 1
          x_repeat: 1
          # Create one rectangle per departure
          y_repeat: "{{ departures|length }}"
        # Line numbers in white text on colored backgrounds
        - type: multiline
          delimiter: ;
          x: 23
          font: ppb.ttf
          size: 20
          start_y: 38
          offset_y: 20
          color: white
          anchor: mm
          value: |-
            {% for departure in departures %}
              {{- departure.line -}}
              {%- if not loop.last %};{% endif -%}
            {% endfor %}
        # Destination names (middle column), truncated to 16 chars
        - type: multiline
          delimiter: ;
          x: 45
          font: ppb.ttf
          size: 20
          start_y: 38
          offset_y: 20
          color: black
          value: |-
            {% for departure in departures %}
              {{- departure.destination[:16] -}}
              {%- if not loop.last %};{% endif -%}
            {% endfor %}
        # Departure times (right column)
        - type: multiline
          delimiter: ;
          x: 238
          font: ppb.ttf
          size: 20
          start_y: 38
          offset_y: 20
          color: black
          value: |-
            {% for departure in departures %}
              {{- departure.realtime_departure }}
              {%- if not loop.last %};{% endif -%}
            {% endfor %}
    # Send to OpenEPaperLink display
    action: open_epaper_link.drawcustom
variables:
  # Extract departure data from MVV sensor
  departures: "{{ state_attr('<YOUR_STATION_SENSOR>', 'departures') }}"
  # Clean up station name for display
  station_name: >-
    {{ state_attr('<YOUR_STATION_SENSOR>',
    'friendly_name').replace(' All Departures', '') }}
# Prevent multiple instances running simultaneously
mode: single