Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.
/ MMM-HK-KMB Public archive

MagicMirror module that show Hong Kong KMB bus arrival time

License

Notifications You must be signed in to change notification settings

winstonma/MMM-HK-KMB

Repository files navigation

MMM-HK-KMB

NOTE: I deprecated this module. Please feel free to take a look at MMM-HK-Transport-ETA.

Station monitor for the Hong Kong KMB.

This module is an extension of the amazing MagicMirror2 project by MichMich which has inspired me to share my coding skills with others as well. Check it out, you know you want to :).

It's always nice to see mirrors using my work, so feel free to send me some screenshots of your implementations.

Lastly, why not join in on our discussions at the official MagicMirror2 Forum?

Reverse Engineering Process

I wrote an article on Medium about the reverse engineering process. Hope you could enjoy it.

Screenshots

Here are the screenshots with different language settings:

en zh-tw or zh-hk zh-cn
MMM-HK-KMB module running in MagicMirror<sup>2</sup> MMM-HK-KMB module running in MagicMirror<sup>2</sup> MMM-HK-KMB module running in MagicMirror<sup>2</sup>

Current version

v1.6.0

Languages

As of version 1.4.2, MMM-HK-KMB features language support for Traditional Chinese (zh-tw and zh-hk), Simplified Chinese (zh-cn) and English (en).

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 https://github.com/winstonma/MMM-HK-KMB.git
cd MMM-HK-KMB
npm install

Module behavior

Please note that this module auto-creates a module header that displays the name of the chosen Hong Kong local transport stop. It is therefore recommended not to add a 'header' entry to your config.js for this module.

This module automatically disappears from your mirror as soon as a station has stopped offering connections at night. It reappears as soon as your chosen station is scheduled to be served again.

This module has been programmed to allow for multiple instances. Simply add more MMM-HK-KMB config entries to your config.js file to display multiple stations and configure them according to your needs.

Configuration

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

...

{
  module: 'MMM-HK-KMB',
  position: 'top_left',
  config: {
    stopID: 'HO06-S-1250-0',		// Which stop would you like to have displayed?	
  }
} 						// If this isn't your last module, add a comma after the bracket

...

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

...

{
  module: 'MMM-HK-KMB',
  position: 'top_left',
  config: {
    stopID: 'HO06-S-1250-0',
    hideInactiveRoute: false,
    showLabelRow: false,
    reloadInterval: 60000
  }
} 						// If this isn't your last module, add a comma after the bracket

...

Find the stopID

  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 stopID in the config.js.

Config Options

Option Default Description
stopID HO06-S-1250-0
Which stop would you like to have displayed?
Default: HO06-S-1250-0

showLabelRow
optional
true
Show or hide column headers
Possible values: true, false

hideInactiveRoute
optional
true
Show or hide inactive routes
Possible values: true, false

reloadInterval
optional
60000
How often should the information be updated? (In milliseconds)
Default: Every minute

Acknowledgement

This project is possible only when given the code js-kmb-api, which is developed by miklcct. Last but not least, I would like to dedicate my thanks to AlvinHKH, who implement working Android implementation BusETA.

About

MagicMirror module that show Hong Kong KMB bus arrival time

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published