This MagicMirror2 module displays the current info for scheduled sailings of a specified BC Ferries route, including the departure time, vehicle deck space fill, vessel name and status.
Navigate into your MagicMirror's modules folder:
cd ~/MagicMirror/modules
Clone this repository:
git clone https://github.com/stonecrown/MMM-BCFerries
Change to newly created folder and install dependencies:
cd MMM-BCFerries
npm install
To use this module, add the configuration block shown below into your MagicMirror config.js file and adjust the module options (noted in Configuration section) to suit your requirements.
{
module: 'MMM-BCFerries',
position: 'top_right',
header: 'BC Ferries Sailings',
config: {
debug: false,
maxWidth: "360px",
customHeader: "BC Ferries Sailings", // default custom header is "" (none)
termCodeDep: "LNG", // *required* ferry departure terminal code
termCodeDst: "HSB", // *required* ferry destination terminal code
maxResults: 8, // optional - limit the number of results to display.
showFillSplit: true, // display current filled space (percentage) for standard vehicle vs. oversize vehicle decks
showVesselName: true
}
},
The following options for this module can be included in config.js
Option | Description |
---|---|
termCodeDep |
Required Ferry departure terminal: specified as 3-letter code for use with BC Ferries API. Type: string Possible values: see ferry terminal codes below. |
termCodeDst |
Required Ferry destination terminal: specified as 3-letter code for use with BC Ferries API. Type: string Possible values: see ferry terminal codes below. |
maxResults |
Maximum number of sailings to display. Type: integer Default value: 10 |
updateInterval |
Period of time (in minutes) between refresh of ferry sailings data. Type: integer Default value: 5 |
animationSpeed |
Speed of the update animation (in milliseconds). Type: integer Possible values: 0 - 5000 Default value: 2000 (2 seconds) |
customHeader |
Additional text to prefix route info in display of module header. NOTE: The route (Departure -> Destination) info is always shown in header. Type: string Default value: `` |
maxWidth |
Maximum width of the displayed module in pixels. Unlimited when set to 0 .This option can be used to make the module narrower, if required. Type: integer Default value 400 |
fade |
Enable fade-to-black in display of listed results. Type: boolean Possible values: true or false Default value: true |
fadePoint |
Fractional start position at which to start fade of listed results. Type: float Possible values: between 0 (top of list) and 1 (bottom of list) Default value: 0.25 |
colour |
Enable colour text in display of filled space percentages when nearing deck vehicle capacity. Type: boolean Possible values: true or false Default value: true |
showFillSplit |
Enable display of percentage of filled space for standard vehicle [car/van/suv] vs. oversize vehicle [truck/bus/rv] parking decks. Type: boolean Possible values: true or false Default value: false |
debug |
Enable debug messages to be sent to console log. Type: boolean Possible values: true or false Default value: false |
This module requires that 3-letter codes be specified for both the departure and destination terminals as these are used with the BC Ferries API to fetch the sailings info for a given route.
Valid 3-letter codes for BC Ferries departure and destination terminals are as follows:
"TSA" -> Tsawwassen
"SWB" -> Swartz Bay
"SGI" -> Southern Gulf Islands *
"DUK" -> Duke Point (Nanaimo)
"FUL" -> Fulford Harbour (Salt Spring Island) *
"HSB" -> Horseshoe Bay
"NAN" -> Departure Bay (Nanaimo)
"LNG" -> Langdale
"BOW" -> Bowen Island *
* asterisked items indicate codes that can be used only to specify the destination terminal (not departure).
Note also that the destination terminal must correspond with its actual departure terminal,
otherwise the API will return an error result.
- request (installed via
npm install
) - BC Ferries API public access API - a key is not currently required.
- Ricardo Gonzalez for the MMM-TFL-Arrivals module, as a base for development of MMM-BCFerries.
- Sam Pratt for the bc-ferries-api code and BC Ferries API service that this module depends on.
- Michael Teeuw for the excellent MagicMirror2 framework.