Skip to content

MagicMirror² module - station monitor for the nextbike bike-sharing network

Notifications You must be signed in to change notification settings

0lek/MMM-socialbicycles

 
 

Repository files navigation

MMM-socialbicycles

Station monitor for the socialbicycles (e.g. Wavelo in Kraków, Poland) bike-sharing network.

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 :).

This module is based on MMM-nextbike by yo-less. Thanks for the great work!

Current version

v1.0.0

Languages

As of version 1.0.0, MMM-socialbicycles features language support for Polish (pl), German (de) and English (en) mirrors.

Prerequisite

A working installation of MagicMirror2

Dependencies

Installation

  1. Navigate into your MagicMirror's modules folder.
  2. Execute git clone https://github.com/0lek/MMM-socialbicycles.git.
  3. Execute cd MMM-socialbicycles.
  4. Execute npm install.

Module behavior

Please note that this module auto-creates a module header which displays the name of the chosen socialbicycles station.
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 run out of bikes. It reappears shortly after the first bike has been returned to your chosen station.

This module has been programmed to allow for multiple instances. Simply add more MMM-socialbicycles 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-socialbicycles',
    position: 'top_left',
    config: {
        stationID: '', 		// Your station ID
        sobiAccessToken: ''	// You Oauth access token
    }
} 							// If this isn't your last module, add a comma after the bracket

...

Getting an access token

Socialbicycles has introduced a mandatory OAuth2 authentication (or maybe I just can't get basic HTTP auth to work :)). Anyways, you need an access token. For that you need to register your app here:

https://app.socialbicycles.com/oauth/applications

It's all self-explanatory. You don't need the clientID or clientSecret (for now), only the access token at the bottom.

Figuring out the correct cityID and stationID

That's a little bit complicated, but not too much. What I did - example based on Wavelo, but should be same for other systems that use Socialbicycles infrastructure.

  1. Go to en.wavelo.pl
  2. Click on map
  3. Right click on the map and select "Inspect Element" (for Safari)
  4. Select the right-last tab, "Network"
  5. Now click on the station in the map that you're interested in and observe the element inspector. You'll be looking for a new row with a digit-only name and the domain app.socialbicycles.com.

Example

  1. Bingo! The number in the name column is the ID you want. You can right-click on the item and select "Open in New Tab". You'll get a JSON with all the data that's available. You can double-check there.
  2. Enter the ID into the config.js file. That's it!

Licence

MIT License

Copyright (c) 2017-2018 0lek

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

MagicMirror² module - station monitor for the nextbike bike-sharing network

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 95.4%
  • CSS 4.6%