Skip to content

Latest commit

 

History

History
90 lines (66 loc) · 6.13 KB

README.md

File metadata and controls

90 lines (66 loc) · 6.13 KB

MMM-HK-Transport-ETA Module

Estimated Time of Arrival (ETA) for the Hong Kong Transport. It uses the API provided by DATA.GOV.HK and support several Hong Kong transport.

This module aims to be the replacement the MMM-HK-KMB and MMM-HK-Transport modules.

Screenshot

MMM-HK-Transport-ETA module running in MagicMirror<sup>2</sup>

Prerequisite

A working installation of MagicMirror2

Dependencies

Installation

To add this module, go to MagicMirror folder and run the following command

cd modules
git clone --recurse-submodules https://github.com/winstonma/MMM-HK-Transport-ETA.git
cd MMM-HK-Transport-ETA
npm install

Usage

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

modules: [
	{
		module: "MMM-HK-Transport-ETA",
		position: "top_right",
		config: {
			// See 'Configuration options' for more information.
			transportETAProvider: 'mtr',
			sta: 'Hong Kong'
		}
	}
]

Configuration options

The following properties can be configured:

General options

Option Description
transportETAProvider Which ETA provider should be used.

Possible values: mtr, kmb ,mtrbus, lrt or gmb
Default value: mtr
reloadInterval How often does the content needs to be fetched? (Milliseconds)

Possible values: 1000 - 86400000
Default value: 60000 (1 minute)
updateInterval How often do you want to display a relative time? (seconds). If set to 0, the relative time would not be displayed.

Possible values: 0 - 60000
Default value: 5000 (5 seconds)
animationSpeed Speed of the update animation. (Milliseconds)

Possible values: 0 - 5000
Default value: 2500 (2.5 seconds)
showHeader Display the header.

Possible values: true or false
Default value: false

MTR

Option Description
sta Which MTR station

Possible values: Please use either chinese station name or english station name inside the MTR routemap. Currently Kwun Tong Line is not supported.
Default value: Hong Kong

KMB

Option Description
sta Which KMB station

Possible values:
1. Open your web browser and navigate to the kmb_eta page, developed by miklcct.
2. In the Enter the route number: box, enter the KMB Bus route number that passes the stop. Then press the submit button. The destination and the home would be displayed.
3. After the submit of the bus route, the route origin and destination would be displayed. Choose the right direction by clicking the Switch direction button.
4. In the Choose a route variant: infobox, select the variant.
5. In the Choose a stop in the list: infobox, there is a list of stops with the stopID displayed in the bracket. Fill the sta in the config.js.

MTR Bus

Option Description
line Which Bus line

Possible values: Please refer to route_number field of the supported list of bus routes, for example K12
sta Which Bus station

Possible values: Please refer to line.stops.name_ch or line.stops.name_en field of the supported list of bus routes, for example Tai Po Market Station or 大埔墟站

Light Rail Transit (LRT)

Option Description
sta Which LRT station

Possible values: Please use to eng_name or chi_name of the supported list of lrt station, for example Lung Mun or 龍門

Green Minibuses (GMB)

Option Description
area Which area does the GMB belongs

Possible values:
- HKI for Hong Kong Island Line
- KLN for Kowloon Line
- NT for New Territories Line
line Which Bus line

Possible values:
- Supported list of bus routes for Hong Kong Island GMB
- Supported list of bus routes for Kowloon GMB
- Supported list of bus routes for New Territories GMB
sta Which GMB station

Possible values: Please follow the steps below to obtain the stop name
1. Form the URL https://codebeautify.org/jsonviewer?url=https://data.etagmb.gov.hk/route/{area}/{line} using the area and line in the above config.
      For example if you want to obtain a specific stop of Hong Kong Island GMB Line 12, then your URL is https://codebeautify.org/jsonviewer?url=https://data.etagmb.gov.hk/route/HKI/12.
      In this page you will obtain route_id
2. Then form the URL https://codebeautify.org/jsonviewer?url=https://data.etagmb.gov.hk/route-stop/{route_id}/1 using the route_id obtained from the previous step, then you would obtain a list of stops.
      In this page you would obtain stop_id of your desired stop. Place it in sta would do.