HomeAssistant9292OvApiSensor
A Home Assistant sensor using the 9292Ov Api for Dutch public transport companies.
Installation
HACS installation (preferred)
The easiest way to install the integration is through HACS.
First, add this repository to HACS:
- Open HACS from the side panel.
- Go to any of the sections (integrations, frontend, automation).
- Click on the 3 dots in the top right corner.
- Select "Custom repositories".
- Add the URL to this repository.
- Select "Integrations" as the category.
- Click the "ADD" button.
Next, add the integration to your Home Assistant:
- Open HACS from the side panel.
- Go to the sections Integrations.
- Click the button "Explore % Download Repositories".
- Search for or scroll to "Sensor 9292 OV API".
- Select the integration.
Now is the time to add the new platform to your Configuration.
Manual installation
Create <config_directory>/custom_components/dutch_public_transport_api/
and copy these files into the directory.
Configuration
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
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
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.