FreekBos / HomeAssistant9292OvApiSensor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HomeAssistant9292OvApiSensor

First setup for a Home Assistant sensor using the 9292Ov Api for dutch public transport companies.

##How to install? Create <config_directory>/custom_components/dutch_public_transport_api/ and copy these files into the directory.

Example config:

sensor:
  - platform: dutch_public_transport_api
    name: Amsterdam naar Vlissingen                     (required)
    station: station-amsterdam-centraal                 (required)
    destination: Vlissingen                             (required)
    show_future_departures: 2                           (optional)

Name

Name of the sensor

Station

The station from where the bus, tram, metro or train should depart. This can be found by following querying the 9292Ov API (reference: Thomas Brus). The 'id' field of a location will be used as station.

Example

Example query:

GET /0.1/locations?lang=nl-NL&q=amsterdam HTTP/1.1 
Host: api.9292.nl

Example response

Destination

The destination is equal to the destination of the bus, tram, metro or train. This can be found by following querying the 9292Ov API (reference: Thomas Brus). The 'destinaton' field of a departure will be used as destination. Destination is used for a string compare to find the right departures, make sure it is an exact copy.

Example query:

GET /0.1/locations/station-amsterdam-centraal/departure-times?lang=nl-NL HTTP/1.1 
Host: api.9292.nl

Example response

Show_future_departures

Number of future departures that should be shown, every future departure is a new sensor.

Credits:

  • Paul-Dh This sensor is based on the sensor of Paul.
  • Thomas Brus Thanks for figuring the 9292OV Api out, was very useful for this sensor.

About

License:MIT License


Languages

Language:Python 100.0%