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!
v1.0.0
As of version 1.0.0, MMM-socialbicycles features language support for Polish (pl)
, German (de)
and English (en)
mirrors.
A working installation of MagicMirror2
- Navigate into your MagicMirror's
modules
folder. - Execute
git clone https://github.com/0lek/MMM-socialbicycles.git
. - Execute
cd MMM-socialbicycles
. - Execute
npm install
.
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.
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
...
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.
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.
- Go to en.wavelo.pl
- Click on map
- Right click on the map and select "Inspect Element" (for Safari)
- Select the right-last tab, "Network"
- 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.
- 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.
- Enter the ID into the config.js file. That's it!
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.