Giter Club home page Giter Club logo

mmm-cta's Introduction

MMM-CTA

This is a module for the MagicMirror².

This module displays Chicago Transit Authority (CTA) bus and train arrival times.

Screenshot

Installation

In ~/MagicMirror/modules

git clone https://github.com/JHWelch/MMM-CTA.git

Install NPM dependencies

cd MMM-CTA
npm install --production

Obtaining CTA API keys

You need to obtain API keys to access CTA data. The API keys are two separate keys for two services.

The bus tracker API key can be obtained immediately, the train tracker key can take a few days to register.

Using the module

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

var config = {
  modules: [
    {
      module: 'MMM-CTA',
      config: {
        // See below for configurable options
      }
    }
  ]
}

Configuration options

Option Required? Description
busApiKey Required See Obtaining CTA API keys
trainApiKey Required See Obtaining CTA API keys
stops Required Array of stops to display. See stops option
updateInterval Optional Refresh time in milliseconds
Default 60000 milliseconds (1 minute)
maxResultsBus Optional Maximum number of bus results to display
Default 5
maxResultsTrain Optional Maximum number of train results to display
Default 5
routeIcons Optional True/False - Display icons next to routes.
Default true
showHeaders Optional True/False - Display headers for each stop.
Default true
suffixStyle Optional Style of suffix for the arrival time. long, short, or none
Default long

stops option

The stops option is an array of objects. Each object represents a stop to display.

{
  stops: [
    {
      type: 'bus',
      id: 561,
      name: 'Chicago and Milwaukee'
    },
    {
      type: 'train',
      id: 41410,
      name: 'Blue Line'
    }
  ]
}
Property Description
type Type of stop. Either bus or train
id Stop ID. See Finding Stop IDs
name Name of stop. This is displayed in the header of the stop's results.

Finding Stop IDs

  1. Go to CTA Trackers and select Train or Bus Tracker.
  2. Search for your stop inside of the given app
  3. Once you find your stop, obtain the Id. It will be the number at the end of the page's URL
    1. For train tracker, it may look like ?sid={id}. The id is the stop ID.
    2. For bus tracker, it may look like Southbound/{id}. The id is the stop ID.

Development

Installation

npm install

Testing

There is a test suite using Jest.

npm test

Linting

# Run linting
npm run lint

# Fix linting errors
npm run fix

Thanks

This module is inspired by MMM-CTA from NateDee.

mmm-cta's People

Contributors

jhwelch avatar jmwyds avatar

Watchers

 avatar

Forkers

jmwyds

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.