Skip to content

Magic Mirror Module for SG Buses. Uses LTA Datamall V2 to get the bus information.

Notifications You must be signed in to change notification settings

mosesyong/MMM-SG-Transport-V2

Repository files navigation

MMM-SG-Transport-V2

MagicMirror² Module - Local Transport in Singapore

This module displays data about bus arrivals. More than one bus stop can be specified.

This module aims to provide the most compact display possible with multiple bus stops.

Data is sourced from LTA DataMall v2, you need to get your own API key here.

This module works with MagicMirror2 project by MichMich

MagicMirror2 Forum

Screenshots

Screenshot

Legend

The number of stickman refers to the crowd level on the bus.

1 stickman - Seating available

2 stickman - Standing available

3 stickman - Limited standing

Prerequisite

A working installation of MagicMirror2

Dependencies

Installation

  1. Navigate into your MagicMirror's modules folder.
  2. Execute git clone https://github.com/mosesyong/MMM-SG-Transport-V2.
  3. Execute cd MMM-SG-Transport-V2.
  4. Execute npm install.
  5. Edit the config.js.

Configuration

Sample configuration entry for your ~/MagicMirror/config/config.js:

{
    module: 'MMM-SG-Transport-V2',
    position: 'top_left',
    config: {
        lta_api_key: "...",
        refresh_interval: 30 * 1000,
        bus_stops: [
            {
                BusStopCode: 43191,
                name: "Opp St Mary's",
                BusNumbers: [
                    "157",
                    "61",
                    "852"
                ]
            },
            {
                BusStopCode: 43619,
                name: "Opp Caltex"
            }
        ]
    }
},
Option Description
lta_api_key REQUIRED API Key from LTA DataMall.

Type: string
refresh_interval OPTIONAL Optional integer value representing how often the data should be refreshed in ms.

Type: integer
BusStopCode REQUIRED Bus stop number.

Type: integer
name REQUIRED Custom bus stop name for the display.

Type: string
BusNumbers OPTIONAL Optional array of string containing bus numbers you wish to display. Invalid bus numbers will be ignored. In string format as bus numbers can contain alphabets.

Type: Array[string]

Changelog

1.0.0 - First version of MMM-SG-Transport-V2 with bus prediction functionality

1.0.1 - Added change to display "No more buses" when no buses are expected to arrive

1.0.2 - Added display icon to show crowd levels based on number of stickman

Acknowledgements

License

MIT License

Copyright (c) 2020 Moses Yong (https://github.com/mosesyong/)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Magic Mirror Module for SG Buses. Uses LTA Datamall V2 to get the bus information.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published