This is a module for the MagicMirror² to display the number of available bikes on the selected stations of the Boston Bluebikes public bike system.
This code borrows extensively from MMM-Bubi, so thank you to its creator György Balássy. I only changed the API interface.
By default this module displays the number of available bikes and the official names of the specified stations:
To use this module follow these steps:
- Clone this repository to the
modules
folder of your MagicMirror:
git clone https://github.com/jschless/MMM-Bluebikes.git
- Add the following configuration block to the modules array in the
config/config.js
file:
var config = {
modules: [
{
module: 'MMM-Bluebikes',
position: 'top_right',
config: {
updateInterval: 600000, // 10 minutes in milliseconds
align: 'left',
places: [
{id: "76", name: "City Hall"},
{id: "116", name: "359 Broadway"},
{id: "107", name: "TPP"}
]
}
}
]
}
Option | Description |
---|---|
places |
REQUIRED The list of Bluebikes stations to display. The unique id of the station is used to lookup the data from the webservice. The name is what will be displayed next to the station |
align |
Optional Determines how the text is aligned within the module. Set this to left if the module is displayed on left side of the mirror, or to right if you positioned this module to the right column of the mirror.Type: string Possible values: 'left' or 'right' Default value: 'left' |
updateInterval |
Optional The frequency of how often the module should query the number of available bikes from the webservice. Type: int (milliseconds) Default value: 600000 milliseconds (10 minutes) |
In the id
property of the objects in the places
array of the configuration settings you have to specify the unique identifier of the station for which the module should display the bike availability.
To obtain the unique identifier of the station, look up the station you are interested in in the station_list.json file. You can find the station name by clicking on the station in the Bluebikes app / website. Then, search the json file for this name and note the "station_id".
Your feedback is more than welcome, please send your suggestions. I know almost nothing about js, but I can try to implement new features. Some features I'm considering adding:
- Toggle docks display
- User only enters name of station, and app loads station id from the included json
Many thanks to Michael Teeuw for creating and maintaining the MagicMirror² project fully open source. Also, as I mentioned before, almost all of this code was taken from György Balássy.