MagicMirror² module to display public transport from Munich in Germany.
- instance of MagicMirror²
-
Clone this repository in your MagicMirror installation into the modules directory:
cd ~/MagicMirror/modules git clone https://github.com/wiesty/MMM-MVVWiesty
-
Head over to mvv-muenchen.de and download "Haltestellenliste (CSV)".
-
Search your station and modify the config template below.
-
Add configuration to your
config.js
.
{
module: "MMM-MVVWiesty",
position: "bottom_left",
config: {
maxEntries: 5, // Maximum number of departures to display
stopId: "de:09162:6", // Stop ID for your station
filter: {}, // Filter by line and/or direction (optional)
displayNotifications: true, // Show notifications for each departure if available
scrollSpeed: 40, // Speed for scrolling notifications
minTimeUntilDeparture: 0 // Minimum time in minutes until departure to display
}
},
- maxEntries: The maximum number of departures to display on the screen.
- stopId: The unique ID for the stop. Find this ID from the MVV Haltestellenliste CSV.
- filter: Object for filtering departures by line number and/or direction (details below).
- displayNotifications: Enables or disables notifications for each departure, such as delays or route changes.
- scrollSpeed: The speed at which notification text scrolls across the screen.
- minTimeUntilDeparture: Specifies the minimum time (in minutes) for departures to be displayed. For example, if set to
3
, only departures leaving in 3 minutes or more will appear.
You can filter departures by both line number and direction. To do so, add the line numbers as keys and the desired directions as values in the filter
object in your module configuration. (Be sure to type the exact name of the line number and for the for the direction. TRAM and BUS only have Numbers. (Tram 16 would be "16", and BUS 123 would be "123")
Example:
filter: {
"S8": "Herrsching",
"U2": "Messestadt Ost"
},
With the above configuration, the module will only display departures for the S8 line going towards Herrsching and the U2 line towards Messestadt Ost.
If you want to display departures for certain lines regardless of their direction, simply provide the line number with an empty string as the value. For example:
filter: {
"16": "",
"S8": ""
},
This configuration results in the module showing all departures for the 16 and S8 lines, irrespective of their direction.
You can specify multiple destinations for a single line by using an array. For example:
filter: {
"S2": ["Petershausen", "Isartor", "Ostbahnhof"]
},
This configuration will display all S2 departures heading towards Petershausen, Isator, or Ostbahnhof. If any of these directions match the current destination of the line, the departure will be shown.
To show all departures without any filtering, you can either leave the filter
object empty, delete it from the config or include the key all
with an empty string as its value. Both of these configurations will display every departure:
filter: {},
Or:
filter: {
"all": ""
},
This flexible filtering system ensures that you can always access the departures that are most relevant to you without any unnecessary clutter.
.MMM-MVVWiesty .module-content
: Limits the module’s maximum width to25vw
, allowing it to adjust responsively up to that width. The module is centered horizontally and has overflow hidden to prevent text spilling out..mvv-table
: Sets the table width to100%
, collapses borders for a cleaner look, and uses a fixed table layout to maintain column widths. This class also sets the font size and line height.
-
.icon-cell
&.line-cell
: These two cells are the narrowest, each set to a width of1vw
to minimize spacing. Both cells have right padding (5px
) and text aligned to the start (left) for a compact display of line numbers and icons. -
.direction-cell
: Displays the direction text of each departure with specific settings:- Width:
8vw
, allowing for adequate space without pushing other elements off. - Overflow:
hidden
,white-space: nowrap
, andtext-overflow: ellipsis
ensure that long text will not wrap and instead shows an ellipsis (...
) when text is truncated. - Customizations: If direction text is cut off or requires more space, consider increasing
width
or adjustingtext-overflow
.
- Width:
-
.time-cell
: Displays the departure time, with a width of6vw
, making it slightly narrower than the direction cell but wide enough for typical HHformatting. It also has
white-space: nowrap
andoverflow: hidden
to ensure text remains on one line. -
.until-cell
: Shows the “time until departure” information with a narrower width of3vw
. This cell is also set to nowrap and hidden overflow to keep the text compact. If more padding is needed, adjust thepadding
orwidth
as desired. -
.notification-cell
: Used for displaying notifications. It spans all columns (colSpan=5
) and has overflow hidden to keep long notification text within bounds.
- Expanded Filtering: The
filter
option now supports multiple directions per line using an array format, allowing more precise control over which departures are displayed. For example,"S2": ["Petershausen", "Isator", "Ostbahnhof"]
will show all S2 departures toward these specified destinations. - New Icon: Added an icon for ExpressBus to enhance line identification.
- New Config Option:
minTimeUntilDeparture
- Filters out departures that are too soon, allowing you to show only those that are X minutes or more in the future. - New Config Option:
displayNotifications
- Enables or disables the display of notifications for each departure. - Removed:
updateInterval
option - The module now fetches data every 5 minutes by default, updating the displayed times every minute. This change reduces server load by avoiding excessive API requests. - Improved Filtering: Departures are now sorted and filtered based on the remaining time to departure, allowing the module to only display the most relevant and up-to-date information.