Skip to content

A module for the MagicMirror to display informations about local tranportation. - Original code by CFenner and SamLewis0602

License

Notifications You must be signed in to change notification settings

GHLasse/MagicMirror-LocalTransport-Module

 
 

Repository files navigation

code climate License

MagicMirror-LocalTransport-Module

This module 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

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'
  }
},

For the header, the following keys can be specified and will be replaced with the according values at runtime: use %{orig} in the header definition for the module and it will be replaces with the origin as defined in the config use %{dest} in the header definition for the module and it will be replaces with the destination as defined in the config/ calendar event use %{destX} in the header definition for the module and it will be replaces with the destination as returned by Google These options are particularly useful if the destination is changed according to the calendar. The %{orig} option may become useful in the future.

Option Description
apiKey The API key, which can be obtained here.

This value is REQUIRED
origin The start location.

Example: Mannheim HBF
This value is REQUIRED
destination The target location.

Example: Frankfurt HBF
This value is REQUIRED
maximumEntries Maximum 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
updateInterval How 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
animationSpeed Speed of the update animation. (Seconds)

Default value: 1
getCalendarLocation Boolean to specify whether to read calendar notifications send by the default calendar module to display the route to the next event. The event must be less than one day away and contain a location to be considered for this functionality.

Default value: false
displayStationLength Number 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
displayArrival Boolean if the arrival time should be shown in the header for each option.

Default value: true
displayAltWalk Boolean if a note should be shown with the time it would take to walk instead of using public transport.

Default value: false
displayAltCycle Boolean if a note should be shown with the time it would take to take a bicycle instead of using public transport.

Default value: false
displayAltDrive Boolean if a note should be shown with the time it would take to drive instead of using public transport.

Default value: false
displayWalkType String 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'
maxWalkTime Maximum time you are willing to walk between stations in minutes

Default value: 10
maxModuleWidth Maximum 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
fade Boolean if a fade should be applied - same as for calendar module

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

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

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

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

Default value is same as defined in the main config file
timeFormat 24 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.

About

A module for the MagicMirror to display informations about local tranportation. - Original code by CFenner and SamLewis0602

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 95.5%
  • CSS 4.5%