The public transport victoria sensor platform uses the Public Transport Victoria (PTV) as a source for forecast meteorological data. This is an updated version of a fork from bremor/bom_forecast
To add Public Transport Victoria to your installation, create this folder structure in your /config directory:
- “custom_components/public_transport_victoria”.
Then, drop the following files into that folder:
- __init__.py
- manifest.json
- sensor.py
You will need to add this repository manually to HACS, repository URL is https://github.com/bremor/public_transport_victoria
Please follow the instructions on http://ptv.vic.gov.au/ptv-timetable-api/ for obtaining a Developer ID and API Key.
Using this website, https://www.ptv.vic.gov.au/departures, select your details:
- Mode of transport,
- Your line or route,
- Select a direction,
- Select your stop.
In the following example, route type is 0, stop_id is 1141, and direction ID is 16. You can use these values to build your configuration.
Add the following to your configuration.yaml file:
# Example configuration.yaml entry
sensor:
- platform: public_transport_victoria
id: 1234567
api_key: 357dts35-930b-467c-844d-21d74f15c38a
stop_id: 1141
max_results: 4
direction_id: 1
route_type: 0Configuration variables:
- id (Required): The ID is your developer ID that you receive directly from PTV.
- api_key (Required): The developer key that name you receive directly from PTV.
- stop_id (Required): The ID of the bus stop, train station, tram station, etc.
- max_results (Optional): The maximum number of departures you would like to return. Default is
1. - direction_id (Optional): Which direction are you travelling in. Default is
Nonewhich returns all directions. - route_type (Optional): Route type, e.g. train, tram, bus. Default is
0which is for trains..