public_transport_victoria
public_transport_victoria copied to clipboard
Custom component for retrieving departure times for Public Transport Victoria.
The public transport victoria
sensor platform uses the Public Transport Victoria (PTV) as a source for public transport departure times for Victoria, Australia.
Installation (There are two methods, with HACS or manual)
Install via HACS (default store) or install manually by copying the files in a new 'custom_components/public_transport_victoria' directory.
Prerequisites
Developer ID and API Key
Please follow the instructions on http://ptv.vic.gov.au/ptv-timetable-api/ for obtaining a Developer ID and API Key.
Configuration
After you have installed the custom component (see above):
- Goto the
Configuration
->Integrations
page. - On the bottom right of the page, click on the
+ Add Integration
sign to add an integration. - Search for
Public Transport Victoria
. (If you don't see it, try refreshing your browser page to reload the cache.) - Click
Submit
to add the integration.
Notes
This integration will refresh data every 10 minutes. If you wish to update the departure information more frequently during interesting periods, you may use an automation like the one below. It will update the sensors every minute between 7:30AM-8:30AM and 4:45PM-5:45PM.
automation:
- alias: 'update_trains'
initial_state: true
trigger:
trigger:
- platform: time_pattern
minutes: "/1"
condition:
condition: or
conditions:
- condition: time
after: '07:30:00'
before: '08:30:00'
- condition: time
after: '16:45:00'
before: '17:45:00'
action:
- service: 'homeassistant.update_entity'
data:
entity_id:
- 'sensor.werribee_line_to_city_flinders_street_from_aircraft_station_0'
- 'sensor.werribee_line_to_city_flinders_street_from_aircraft_station_1'
- 'sensor.werribee_line_to_city_flinders_street_from_aircraft_station_2'
- 'sensor.werribee_line_to_city_flinders_street_from_aircraft_station_3'
- 'sensor.werribee_line_to_city_flinders_street_from_aircraft_station_4'