Git Product home page Git Product logo

mmm-dcmetrotraintimes's Introduction

Module: DC Metro Train Times

The MMM-DCMetroTrainTimes module is a module designed to display the train arrival times as stations along the Washington Metropolitan Area Transit Authority metro system, aka the Washington DC metro system. It is configurable based on the stations to get arrival times for, destinations to exclude, coloring line codes visually, and other options.

It also will show any incidents reported by WMATA on the rail lines by listing which color lines are currently affected, i.e. Orange, Blue, Silver, etc.

Example:

Full Full

Dependencies / Requirements

This module requires access to a WMATA Developers API key. For more information on acquiring thisplease visit https://developer.wmata.com/.

You will also need to configure the metro stations of interest to you by using the station code which are listed in the seperate ./stationcodes/stationcodes.md.

NOTE: The ./stationcodes/stationcodes.json file is actually used by the module so calls are not made to get it each time the module runs since the station codes and other information are rarely changed. If a problem occurs involving the codes you can run the ./stationcodes/getStationCodes.js to update them.

Using the module

To use this module, add it to the modules array in the config/config.js file:

modules: [
	{
		module: 'MMM-DCMetroTrainTimes',
		position: 'bottom_right',
		config: {
		// visit the url below for the wmata api key
		// https://developer.wmata.com/
			wmata_api_key: 'FILL IN',
		// use the station codes file ./stationcodes/stationcodes.md for
		// more on these values
			stationsToShowList: [ 'C04', 'A04', 'D03' ],
		}
	}	
]

Configuration options

The following properties can be configured:

Option Description
wmata_api_key Used by the module to make calls to the WMATA JSON REST API. For more visit https://developer.wmata.com/.

This value is REQUIRED
stationsToShowList Contains a JSON array of strings indicating WMATA Metro Station Code values. These are the stations you want to see train arrival times for. A table of these values can be found at ./stationcodes/stationcodes.md.

Example: [ 'C04', 'A04', 'D03' ]
This value is OPTIONAL, BUT EFFECTIVELY REQUIRED
Default value: [ 'A01', 'C01' ]
showIncidents Toggle to turn on or off the incidents listing which will be shown before the train arrival times. Default is on.

Example: false
Default value: true
This value is OPTIONAL
showStationTrainTimes Toggle to turn on or off the station train arrival times listing which is shown after the incidents listing. Default is on.

Example: false
Default value: true
This value is OPTIONAL
destinationsToExcludeList Contains a JSON array of strings indicating WMATA Metro Station Code values. The station codes listed here will be hidden from any list of train arrivals for any of the stationsToShowList. This is useful if you live near the end of a line and aren't interested in taking trains towards your end. If left empty no destination stations will be excluded.

Example: [ 'N06', 'D13' ]
Default value: [ ]
This value is OPTIONAL
showDestinationFullName Toggle to turn on or off full destination station names. Otherwise it will be an abbreviated destination station name. Default is on (full station name).

Example: false
Default value: true
This value is OPTIONAL
refreshRateIncidents Specified in MILLISECONDS, sets the rate at which updates will be made to the metro incidents list. This value defaults to every two minutes. Note setting this value to low, i.e. fast, can use up a lot of alloted daily API calls so don't abuse this value. Also, incidents aren't updated nearly as often as train arrival times.

Example: 6 * 60 * 1000
Default value: 2 * 60 * 1000
This value is OPTIONAL
refreshRateStationTrainTimes Specified in MILLISECONDS, sets the rate at which updates will be made to the station train arrival times list. This value defaults to every thirty seconds. Note setting this value to low, i.e. fast, can use up a lot of alloted daily API calls so don't abuse this value.

Example: 1 * 60 * 1000
Default value: 30 * 1000
This value is OPTIONAL
maxTrainTimesPerStation The maximum number of train times to show per station, i.e. if you set this to 2 you would only ever get the 2 next train times for a given station. This defaults to zero which means show all the train times.

Example: 3
Default value: 0
This value is OPTIONAL
showHeader Toggles the header title on or off.

Example: false
Default value: true
This value is OPTIONAL
headerText The text to display in the header title.

Example: "WMATA Train Arrival Times"
Default value: "DC Metro Train Times"
This value is OPTIONAL
limitWidth The width of cell containing the incident list, usually the widest cell. It effectively limits the total width of this module. Usually specified in pixels but can specified in any HTML width style. Specified as a string.

Example: "350px"
Default value: "200px"
This value is OPTIONAL
colorizeLines Toggle this to enable colorzing any train line code or name by it's color, i.e. the Orange Line 'OR' will be colored orange, the Blue Line 'BL' will be colored blue, etc. Defaults to off to fit with the usual Magic Mirror look.

Example: true
Default value: false
This value is OPTIONAL
incidentCodesOnly Toggle to change from the full text of the lines with incidents to just showing line codes, i.e. "Incident Reported On The Orange Line" as opposed to just showing "OR". Turned off by default to do a full-text listing of lines with incidents on them.

Example: true
Default value: false
This value is OPTIONAL
hideTrainTimesLessThan Will exclude listing trains that are arriving in time less the specified amount in MINUTES. This is useful if for instance it took your four minutes to walk to your station so showing trains arriving less than four minutes would be useful. Note that is processed before maxTrainTimesPerStation. This defaults to zero which disables it.

Example: 4
Default value: 0
This value is OPTIONAL

mmm-dcmetrotraintimes's People

Contributors

adammoses-github avatar sbaydush avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mmm-dcmetrotraintimes's Issues

Nothing comes up at all

I'm using the DCMetroTimes module and the module is not showing up on the MM. Am I missing something or is the Module not working. I've double checked my wmata api key.
Screenshot 2022-03-02 102923

'Error: Too Many REST Failures' after module operation for extended period

I continue to move into a state (perhaps after anywhere from 1 to 7 days) where the module only displays 'Error: Too Many REST Failures' and then never recovers without a MM restart. However, after the restart the module always and immediately begins to work.

I attempted to get around this by commenting out this line. However, the error persists.

This tells me that I am continuing to receive errors from the WMATA API calls, and therefore the module will continue to display the error message.

BUT, going into my WMATA account, I can see that in the past 90 days I have made 324,169 successful calls and only 2 failed calls. Now I am not sure if an error is only considered a fail or if errors can be contained in a successful call. My graph or error calls appears to flat and at 0.

Any ideas on why this may be happening?

"Waiting for Update"

The display simply says "Waiting for Update." I've changed API key and have tried to update the module itself with no success.

No longer pulling data

As of May 12, 2024 at 6pm, this module is no longer pulling data from WMATA. I verified my API Keys are still active and that I haven't reached any limits.

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.