Skip to content
Magic Mirror app for monitoring Caltrain status
JavaScript CSS
Branch: master
Clone or download
efritz09 additional style tweaks and custom train colors (#4)
* Reduce the transparency of the boarder above the train tables
* change the trains option to a map, letting the user define the highlighted color
* make the train table column widths defined
* cleanup the code.
Latest commit c263be0 Oct 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
screenshots
LICENSE
MMM-Caltrain.css
MMM-Caltrain.js
README.md
caltrain-stations.txt
node_helper.js

README.md

MMM-Caltrain

This is a module for MagicMirror
https://magicmirror.builders/
https://github.com/MichMich/MagicMirror

A transportation module that displays the status of upcoming trains for a user defined station, as well as alerting the user when there have been delays reported across the fleet.

This module uses the public API provided by 511.org.

Module Status

This module is considered finished, though I welcome any feedback on design or feature requests. I will be maintaining it for the foreseeable future. This was my first project using javascript so there are undoubtedly inefficiencies.

Installation

  1. Navigate to your magic mirror modules directory and clone this repo: git clone https://github.com/efritz09/MMM-Caltrain.git
  2. Navigate into the MMM-Caltrain directory, run npm install request zlib

Configuration

At a minimum, you need to supply the following required configuration parameters:

  • key
  • stationName

You can request an API key here: https://511.org/open-data/token.

The stationName value must be one of those listed in caltrain-stations.txt

All Options

Option Type Default Description
key (required) string null API key for 511.org
stationName (required) string null Name of the station to watch. Must be one of those listed in caltrain-stations.txt
delayThreshold integer 600000 Time in milliseconds that a train must be behind schedule by for it to be reported as "delayed". Default value is 10 minutes.
direction string "" Selects which trains to display for the given stationName. Acceptable values are north or south. Any other value will resolve to both north and south. Default value is both.
requestDelays bool true If true, requests delayed trains info.
showDelayedTrains bool true If true, shows which trains have been reported as delayed.
showDelayedWarning bool true If true, shows the warning message when delayed trains are detected.
timeFormat integer 24 The form of time notation that will be used. Possible values are 12 or 24.
trains map {} Map of trains to highlight. Useful for displaying trains frequently taken by the user. The key is a string that represents the train number. The value is an rgb value. Example: {"123": "#aabbcc"}. Leave the value as "" to use the default color of #66ccff
updateInterval integer 180000 Time in milliseconds between status updates. Default is 3 minutes. This number was chosen because the API limits 60 requests per hour, and each interval the module makes 3 requests. Be careful lowering this value unless you modify the other options to reduce the number of requests sent each interval.

Example configuration file:

{
	module: "MMM-Caltrain",
	position: "top_left",
	config: {
		stationName: "Hillsdale",
		key: "your-personal-key-here",
		direction: "north",
	}
}

Screenshots

Normal operating conditions

Normal station status

Normal operation with trains defined

train highlights

Delayed trains detected (with all delay options set to true)

Delays detected

Bad stationName string

Bad station name

You can’t perform that action at this time.