jaumebosch / MMM-TMB

A module for the Magic Mirror to display Barcelona TMB bus times
MIT License
4 stars 0 forks source link

MMM-TMB

lifecycle License: MIT PRs Welcome Twitter Follow

This is a module for the MagicMirror² to display Barcelona's TMB bus times

Introduction

TMB (Transports Metropolitans de Barcelona) is the main public transport operator in Catalonia and a benchmark public mobility company in Europe and the world.

Installation

Go to your MagicMirror's modules folder and execute

git clone https://github.com/jaumebosch/MMM-TMB.git
cd MMM-TMB
npm install

Using the module

alt text

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

var config = {
    modules: [
        {
            module: 'MMM-TMB',
            position: "bottom_right",   // This can be any of the regions.
            config: {
                // See below for configurable options
            }
        }
    ]
}

Configuration options

Option Description
appId Required Your TMB API appID. If you don't have one, you can request one here.

Type: string
Default value: none
appKey Required Your TMB API appKey. If you don't have one, you can request one here.

Type: string
Default value: none
busStops Required Array with JSON objects defining busStop and optionally busLine. See below for example

Type: array
Default value: none
maxEntries Optional The maximum number of buses to display.

Possible values: 1 to 10
Default value: 5
refreshInterval Optional How often to check for the next bus.

Type: int
Default value: 30000 milliseconds (30 seconds)
warningTime Optional Time for colored alarm.

Type: int
Default value: 600 seconds (10 minutes)
blinkingTime Optional Time for blinking alarm, must be less or equal than warningTime.

Type: int
Default value: 300 seconds (5 minutes)



The busStops array structure must be like this:

[
     {
         busStopCode: '001124',
         busLine: '67',
     },
     ...
 ]

busStops options

Option Description
busStopCode Required The 6 digit bus stop code to monitor. You can get it from your bus stop or find it here.

Type: string
Default value: none
busLine Optional The bus line number to retrieve only this line's info. If not set it will show all the bus lines of the defined bus stop

Type: string
Default value: none