Giter Site home page Giter Site logo

mmm-entur-tavle's Introduction

MMM-Entur-tavle

This is a departure board made for MagicMirror² using the Entur API. The board can show the next departures for all public transport in Norway including any mode of transportation.

Installation

Enter your MagicMirror² module folder, e.g.:

cd ~/MagicMirror/modules

Clone the repository

git clone https://github.com/Arve/MMM-Entur-tavle.git

Add the departure board to your configuration file, for instance:

{
    module: "MMM-Entur-tavle",
    position: "top_right",
    config: {
        stopId: '58366',
        stopType: 'StopPlace',
        numResults: 5,
        showName: true,
        highlightRealtime: true,
        delay: [5, 'minutes'],
        exclusions: [ 'a1', 'a2, 'a3' ],

    }
},

Configuration

Currently available configuration options are as follows:

Option Description Default value
stopId String. A valid ID for a stop or quay (platform) from Entur's directory of stopPlaces. You can either query for this through their GraphQL IDE, or extract the stopId from the query string generated when searching for a departure-board on https://en-tur.no. See documentation below "12345"
stopType Chooses whether the place you are querying in stopId is a StopPlace or a quay.,A quay can for instance be a specific platform on a stopPlace - such as buses departing in a specific direction. Valid values are "StopPlace" and "Quay" (case sensitive). See separate documentation on stopType below. "StopPlace"
numResults Integer. The maximum number of results of to be returned from the query. 5
showHeader Boolean. Whether to show the name of the stop or quay above the list of departures from the stop. true
highlightRealtime Boolean. If set to true, departures that are updated with realtime info will be slightly bolded. false
updateSpeed Integer. The transition speed when updating the display 1000
size String. One of "xsmall", "small", "medium", "large" or "xlarge" "medium"
refresh Integer. Seconds between board refresh 30
showTransportMode Boolean. Show the transporte mode as an icon. false
timeOffset Array(int, string). How much into the future to offset a query. For instance, setting `[10, "minutes"] will only give responses 10 minutes from "now". The array provided must be valid array syntax for moment.duration(). [0, 'seconds']
exclusions Array(string). Public codes to exclude from display. For instance, exclusions: [ 'a2', 'a4' ] will exclude departures whose public code is 'a2' and 'a4'. Note that this may mean that you get fewer results than those specified in the numResults config, so specifying this value may mean that you want to alter the numResults value until you get a satisfactory number of results. []

Finding stopPlace

The simplest way to locate your stopPlace is to extract it from a query on the Entur web interface:

  1. Click on "Avgangstavle"
  2. Search for your stop and select it from the dropdown
  3. Inspect the browser's address bar. Look for the id query parameter
  4. Look for the numeric ID following StopPlace%3A - and extract it.

Use of stopType

In the Entur/Journeyplanner API, a stopPlace can be an area where there are multiple platforms and modes of transporation within a limited geographical area (or it could simply be different platforms on the same stop). In the case where you want to query a specific quay/platform instead of an entire stopPlace, set the value of stopType to Quay.

To get the specific quay, you will probably want to extract it from the GraphQL IDE. You can use this query.

Replace the numeric part of the stopPlace ID ( NSR:StopPlace:56338 ) with your own stopPlace's numeric id and run the query. In the right-hand window, you will have a number of departures from that stopPlace, and each of the results will have sections similar to the following:

"quay": {
    "id": "NSR:Quay:7184"
},
"destinationDisplay": {
    "frontText": "Vestli via Majorstuen"
},

… look for the quay number that corresponds to the frontText of the quay/platform you wish to display travels from.

Multiple instances

This plugin fully supports multiple instances on the same MagicMirror² instance. If you wish to display different platforms separately, use the stopType configuration option with separate quays as suggested above.

Disclaimer

This module fetches data licensed under the Norwegian License for open Government Data (NLOD) delivered by Entur, but the application/module itself is not developed, maintained or endorsed by Entur.

Planned features

  • Localization
  • Inclusion of transport mode (Bus, plane, train, etc.) in display
  • If other travel authorities offer access to the same GraphQL-based API: Add support for these as well. If you know of any such, please file an issue.

mmm-entur-tavle's People

Contributors

arve avatar csolem avatar draperunner avatar

Watchers

James Cloos avatar

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.