MMM-LocalTransport

February 26, 2024 · View on GitHub

code climate License

MMM-LocalTransport

This is a module for MagicMirror² to display the next local transport connection between an origin and destination.

preview

Usage

You need to install the module for your MagicMirror.

Installation

Navigate into your MagicMirror's modules folder:

cd ~/MagicMirror/modules

Clone this repository:

git clone https://github.com/CFenner/MMM-LocalTransport

Change to the module's directory:

cd MMM-LocalTransport

Install dependecies:

npm install

Configure the module in your config.js file.

Configuration

Add module configuration to config.js.

{
  module: 'MMM-LocalTransport',
  position: 'ANY_POSITION',
  config: {
    api_key: 'YOUR_API KEY',
    origin: 'YOUR_ORIGIN',
    destination: 'YOUR_DESTINATION'
  }
},
OptionDescription
apiKeyThe API key, which can be obtained here.

This value is REQUIRED
originThe start location.

Example: Mannheim HBF
This value is REQUIRED
destinationThe target location.

Example: Frankfurt HBF
This value is REQUIRED
maximumEntriesMaximum number of routes to display. Less routes will be shown if less are returned by Google. Routes will be sorted by arrival time. This option should take an integer value between 1 and 5.

Default value: 3
updateIntervalHow often does the content need to be fetched? (Minutes) Note that the module refreshes every 15 seconds to always display an accurate estimate when you need to leave.

Default value: 5
animationSpeedSpeed of the update animation. (Seconds)

Default value: 1
displayStationLengthNumber of characters of the departure station for each transport mode to display.
0 means display all,
-1 means don't show the departure station

Default value: 0
displayArrivalBoolean if the arrival time should be shown in the header for each option.

Default value: true
displayWalkTypeString how detailed the walking segments should be shown.
'none' means to not display anything,
'short' means to display the symbol, the time and the short version of the unit or
'long' means that a symbol, the time and the long string for the unit is displayed. This options is default if an invalid string is supplied.

Default value: 'short'
maxWalkTimeMaximum time you are willing to walk between stations in minutes

Default value: 10
maxModuleWidthMaximum width of the module in pixel. Unlimited when set to 0. This option can be used to make the module shorter in case of very long lines for directions.

Default value: 0
fadeBoolean if a fade should be applied - same as for calendar module

Default value: true
fadePointPercentage, where the fade should start. This should be a value between 0 and 1 - same as for calendar module

Default value: 0.1
showColorBoolean if transport symbols should be displayed in color (Note: symbols for default transport modes are always in grey)

Default value: true
languageLanguage to display information in - german de or english en

Default value is same as defined in the main config file
unitsUnits to use - metric or imperial

Default value is same as defined in the main config file
timeFormat24 or 12 hour clock for displaying the arrival time

Default value is same as defined in the main config file

Preview of various settings

{
  module: 'MMM-LocalTransport',
  header: 'to Victoriy Coach Station',
  position: 'top_left',
  config: {
    api_key: 'MYG00GLEAP1KEY',
    origin: 'Waterloo Station, London, United Kingdom',
    destination: 'Victoria Coach Station, London, United Kingdom',
    maximumEntries: 4,
    maxWalkTime: 15,
    displayWalkType: 'full',
    maxModuleWidth: 400
  }
},

London - left long block

{
  module: 'MMM-LocalTransport',
  header: 'nach Berlin',
  position: 'top_right',
  config: {
    api_key: 'MYG00GLEAP1KEY',
    origin: 'Bahnhof Hamburg Altona, Hamburg, Germany',
    destination: 'Berlin Hauptbahnhof, Berlin, Germany',
    maximumEntries: 6,
    maxWalkTime: 15,
    displayStationLength: -1,
    displayWalkType: 'none',
    displayArrival: false,
    language: 'de'
  }
},

Berlin - right short

{
  module: 'MMM-LocalTransport',
  header: 'to Museum of Art',
  position: 'top_left',
  config: {
    api_key: 'MYG00GLEAP1KEY',
    origin: 'MetLife Stadium, 1 MetLife Stadium Drive, East Rutherford, NJ 07073, US',
    destination: '1000 5th Ave, New York, NY 10028, US',
    maximumEntries: 3,
    maxWalkTime: 30,
    displayStationLength: 10
  }
},

New York - left

Special Thanks

Thanks to SamLewis0602 for his module MMM-Traffic by SamLewis0602 on which this one is based on.