Git Product home page Git Product logo

stib_mivb's Introduction

Stib-Mivb sensor

This code is a custom component to integrate the Stib-Mivb (the Brussels public transport) info in Home Assistant. This component adds sensors with the next passages in minutes in real-time for a line at a given stop.

Install

Copy these files to custom_components/stib_mivb/

Then configure the sensors by setting up the stib platform in configuration.yaml.

Options

Name Type Requirement Description
platform string Required stib
api_key string Required The access token generated at opendata.stib-mivb.be.
lang string Required The language of the stop names 'fr' or 'nl'
message_lang string Optional The language of the information messages. 'nl', 'fr' or 'en'. If not given the same as lang.
stops object Required List of stops and lines to display next passages of.

Example:

sensor:
  - platform: stib_mivb   
    api_key: '< STIB access token from opendata.stib-mivb.be >'
    lang: 'nl'   
    message_lang: 'en'   
    stops:
      - stop_id: 8301
        line_number: 6
      - stop_id: 8301
        line_number: 2

Info

How to get the stop ids?

Go to http://www.stib-mivb.be/horaires-dienstregeling2.html, select the line, the destination and then the stop name. The stop id can be found at the end of the url after _stop=.

For example, for line 1 with direction 'Gare de l'Ouest' at 'Gare Centrale', the url is: http://www.stib-mivb.be/horaires-dienstregeling2.html?l=fr&_line=1&_directioncode=V&_stop=8021. The stop id is then 8021.

Get the id for each stop you need and add them to your configuration.

How are the sensors represented?

For each line that passes at a given station you get a new sensor following this format: [stop]_line_[line].

For example with stop id 8301 and line id 6 you get this sensor:

  • ` sensor.remise_schaarbeek_line_6

The state returns the waiting time in minutes for the next vehicle :

sensor.remise_schaarbeek_line_6      5

Other attributes are :

{
  "stop_name": "REMISE SCHAARBEEK",
  "line_name": "KONING BOUDEWIJN - ELISABETH",
  "line_type": "subway",
  "line_color": "0078AD",
  "line_text_color": "FFFFFF",
  "next_passing_time_1": "2020-02-26T22:09:00+01:00",
  "next_passing_destination_1": "KONING BOUDEWIJN",
  "next_passing_time_3": "2020-02-26T22:18:00+01:00",
  "next_passing_destination_3": "KONING BOUDEWIJN",
  "line": "6",
  "unit": "min",
  "attribution": "Data provided by opendata-api.stib-mivb.be",
  "friendly_name": "stib 8021  1",
  "icon": "mdi:subway"
}

stib_mivb's People

Contributors

emilv2 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.