Giter Site home page Giter Site logo

mm-hsl-timetable's Introduction

Module for MagicMirror: Timetable for HSL data (Finland)

The mm-hsl-timetable module fetches bus timetable data from HSL (Helsinki region, Finland) and shows the timetables for configured stops.

You will need to check the "solmutunnus" from https://www.avoindata.fi/data/fi/dataset/hsl-n-joukkoliikenteen-pysakit and add the number of the bus stop you want to show in the config stops-array. Or query the gtfsId from https://digitransit.fi/en/developers/apis/1-routing-api/stops/#query-stops-by-name-or-number.

Note! You will need to register at https://portal-api.digitransit.fi to get an APIkey to use this.

Screenshot

  • HSL Timetable screenshot

HSL Timetable screenshot

Using the module

  1. Clone this repository under MagicMirror/modules folder
  2. Add to the modules array in the MagicMirror/config/config.js file:
modules: [{
  module: "mm-hsl-timetable",
  position: "top_right",
  header: "Bus schedule",
  config: {
    stops: [1130113],
    busCount: 5,
    apikey: "get one from https://portal-api.digitransit.fi"
  }
}]

Configuration options

The following properties can be configured:

Option Description
busCount Amount of busses to show/stop
stops The stop numbers to show as an array
apikey The digitransit API currently requires an APIkey to be used. You can get one for free by registering at https://portal-api.digitransit.fi

Stops can also be an object with:

Key Description
id Stop number
name Optional name to override one from API
minutesFrom Minutes to skip from now (if the stop is not near)

mm-hsl-timetable's People

Contributors

zakarfin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mm-hsl-timetable's Issues

Wont work

Can't get this work. Any ideas? I am just started with this MagicMirror... So basically I just copied the files under modules/mm-hsl-timetable and added this to config.js:
{
module: "mm-hsl-timetable",
position: "top_right",
header: "Bus schedule",
config: {
stops: [1130113],
busCount: 5
}
},

Thoughts

Hi!

Really like this module, seeing that this existed made me finally make my own magicmirror. Some improvement ideas:

  • The order of stops is currently always listed numerically by the stopID number. It would be great to be able to switch around the order.

  • Would be great to see the end stop / direction of each bus. I have some stops nearby that have buses going all over Helsinki, and I can never remember which ones of them go to a specific direction. Right now I have a list of buses under the timetable as a text, to see which ones are the right ones.

  • The way it translates relative time to Finnish, is a bit long. I think "nyt" is way better than "muutaman sekunnin päästä". Also "3 min" is better than "kolmen minuutin päästä" in my opinion. Right now my workaround has been to edit the fi.js file in moment/locale.

I know you probably aren't that invested in this project anymore, but just some thoughts. Maybe someone else who is better in javascript etc than I am, will pick it up.

Error: Cannot find module 'request'

Hey!
First off, amazing that you have developed this module. Unfortunately I could not get it running, bellow is the error I am getting

Did anybody experience a similar issue?
I followed your steps by git cloning the module and added the module object to config file. When I comment out the module object, magic mirror works again.

********* ERROR MESSAGE BELOW***************
[06.04.2022 19:09.18.238] [ERROR] App threw an error during load
[06.04.2022 19:09.18.240] [ERROR] Error: Cannot find module 'request'
Require stack:

  • /home/pi/MagicMirror/modules/mm-hsl-timetable/node_helper.js
  • /home/pi/MagicMirror/js/app.js
  • /home/pi/MagicMirror/js/electron.js
  • /home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js
  • at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at Function.n._resolveFilename (node:electron/js2c/browser_init:249:1105)
    at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (/home/pi/MagicMirror/modules/mm-hsl-timetable/node_helper.js:2:17)
    at Module._compile (node:internal/modules/cjs/loader:1116:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1169:10)
    [06.04.2022 19:09.18.242] [ERROR] Whoops! There was an uncaught exception...
    [06.04.2022 19:09.18.246] [ERROR] Error: Cannot find module 'request'
    Require stack:
  • /home/pi/MagicMirror/modules/mm-hsl-timetable/node_helper.js
  • /home/pi/MagicMirror/js/app.js
  • /home/pi/MagicMirror/js/electron.js
  • /home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js
  • at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at Function.n._resolveFilename (node:electron/js2c/browser_init:249:1105)
    at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (/home/pi/MagicMirror/modules/mm-hsl-timetable/node_helper.js:2:17)
    at Module._compile (node:internal/modules/cjs/loader:1116:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1169:10) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/home/pi/MagicMirror/modules/mm-hsl-timetable/node_helper.js',
    '/home/pi/MagicMirror/js/app.js',
    '/home/pi/MagicMirror/js/electron.js',
    '/home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js',
    undefined
    ]

Create package.json

I am working on a new module list, which you can see here. If you search for your module in it, you will see that it looks a bit bland at the moment, as a screenshot and tags are missing.

You can change that by adding a package.json file. The information that is currently used from that file is the license information (the screenshot can only be displayed if the license is free) and the keywords (these are then displayed as tags).

Here is an example of a package.json.

I recommend using the keyword "Public Transport", because it's like a main category.

It would be nice if you would add the file to your repository 🙂

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.