### Route Sensor Example (Start/End Stops) Source: https://context7.com/vingerha/gtfs2/llms.txt This is an example of the entity state and attributes for a route sensor after setup via the GUI. The sensor tracks departures between two specified stops for a selected route and direction. ```yaml # Example entity state and attributes after GUI-based route setup ``` -------------------------------- ### Example Entity Attributes for Real-Time Data Source: https://github.com/vingerha/gtfs2/wiki/3.-Configuring-options-(e.g.-Real-Time) This example shows the typical attributes associated with an entity when real-time data has been added to the options. These attributes provide details about updates, delays, and location. ```yaml gtfs_updated_at: "2023-12-17T06:28:17.493348+00:00" origin_stop_alert: no info destination_stop_alert: no info attribution: Palmbus device_class: timestamp icon: mdi:bus friendly_name: Palmbus B to Mouans gtfs_rt_updated_at: "2023-12-17T06:29:18.728897+00:00" next_departure_realtime: "2023-12-17T06:43:00+00:00" delay: unknown latitude: "" longitude: "" ``` -------------------------------- ### Example GTFS2 Route Entity Content Source: https://github.com/vingerha/gtfs2/wiki/2.-Setup-a-new-route This snippet shows the structure and example data for a GTFS2 route entity, including details about agencies, origin and destination stations, and route information. It is useful for understanding the data collected and stored by GTFS2 for a specific route. ```yaml arrival: "2023-12-17T06:45:00+00:00" day: today first: true last: false offset: 0 agency_agency_id: busazur agency_agency_name: Palmbus agency_agency_url: https://www.palmbus.fr agency_agency_timezone: Europe/Paris agency_agency_lang: fr agency_agency_phone: "0825825599" agency_agency_fare_url: https://www.palmbus.fr/fr/acheter-son-titre/35 agency_agency_email: commercial-palmbus@palmbus.fr origin_station_stop_id: GSNF0R origin_station_stop_code: None origin_station_stop_name: Gare SNCF de Cannes origin_station_stop_desc: None origin_station_stop_lat: "43.553645169596614" origin_station_stop_lon: "7.019986063282887" origin_station_zone_id: None origin_station_stop_url: None origin_station_location_type: "0" origin_station_parent_station: Station Gare SNCF de Cannes origin_station_stop_timezone: None origin_station_wheelchair_boarding: "1" origin_station_platform_code: None origin_station_location_type_name: Station origin_station_wheelchair_boarding_available: true destination_station_stop_id: MSCE0A destination_station_stop_code: None destination_station_stop_name: Mouans-Sartoux Centre destination_station_stop_desc: None destination_station_stop_lat: "43.618942880622285" destination_station_stop_lon: "6.971753137085002" destination_station_zone_id: None destination_station_stop_url: None destination_station_location_type: "0" destination_station_parent_station: None destination_station_stop_timezone: None destination_station_wheelchair_boarding: "1" destination_station_platform_code: None destination_station_location_type_name: Station destination_station_wheelchair_boarding_available: true route_route_id: B route_agency_id: busazur route_route_short_name: B route_route_long_name: Mouans Sartoux Centre - Lycée Carnot - Gare SNCF de Cannes route_route_desc: None route_route_type: "3" route_route_url: None route_route_color: 0277bd route_route_text_color: FFFFFF route_type_name: Bus trip_route_id: B trip_service_id: 115_SCO_DIM_V12 ``` -------------------------------- ### Extract Departures Source: https://context7.com/vingerha/gtfs2/llms.txt Retrieves all departures for today and tomorrow, optionally filtered by a start time. Useful for getting more than the default 10 departures. ```APIDOC ## gtfs2.extract_departures ### Description Retrieves all departures for today and tomorrow, optionally filtered by a start time. ### Service gtfs2.extract_departures ### Data - **config_entry** (string) - Required - The configuration entry ID of your route sensor. - **from_time** (string) - Optional - Only return departures after this time in UTC (HH:MM:SS format). ``` -------------------------------- ### GTFS Sensor Attributes Source: https://context7.com/vingerha/gtfs2/llms.txt Example attributes for a GTFS sensor, including departure times, route information, and next departures. ```yaml state: "2023-12-17T06:43:00+00:00" # Next departure (UTC timestamp) attributes: arrival: "2023-12-17T06:45:00+00:00" day: today # "today" or "tomorrow" first: false last: false offset: 0 # Minutes offset configured in options agency_agency_name: Palmbus agency_agency_timezone: Europe/Paris origin_station_stop_name: "Gare SNCF de Cannes" origin_station_stop_lat: "43.553645169596614" origin_station_stop_lon: "7.019986063282887" origin_station_wheelchair_boarding_available: true destination_station_stop_name: "Mouans-Sartoux Centre" destination_station_stop_lat: "43.618942880622285" destination_station_stop_lon: "6.971753137085002" route_route_short_name: "B" route_route_long_name: "Mouans Sartoux Centre - Lycée Carnot - Gare SNCF de Cannes" route_type_name: Bus route_route_color: "0277bd" trip_trip_headsign: "Mouans-Sartoux Centre" trip_bikes_allowed_state: false trip_wheelchair_access_available: unknown origin_stop_departure_time: "2023-12-17T06:15:00+00:00" origin_stop_pickup_type_state: Regular destination_stop_arrival_time: "2023-12-17T06:45:00+00:00" next_departures: - "2023-12-17T06:43:00+00:00" - "2023-12-17T07:11:00+00:00" - "2023-12-17T07:39:00+00:00" - "2023-12-17T08:07:00+00:00" - "2023-12-17T08:35:00+00:00" - "2023-12-17T09:03:00+00:00" - "2023-12-17T09:31:00+00:00" - "2023-12-17T09:59:00+00:00" - "2023-12-17T10:27:00+00:00" - "2023-12-17T10:55:00+00:00" next_departures_lines: - "2023-12-17T06:43:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF de Cannes)" - "2023-12-17T07:11:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF de Cannes)" next_departures_headsign: - "2023-12-17T06:43:00+00:00 (Mouans-Sartoux Centre)" info_realtime: "No realtime information" gtfs_updated_at: "2023-12-17T06:13:17.676488+00:00" attribution: Palmbus icon: mdi:bus friendly_name: "Palmbus B to Mouans" ``` -------------------------------- ### Extract All Departures for a Route Sensor Source: https://context7.com/vingerha/gtfs2/llms.txt Retrieves all departures for today and tomorrow from a route sensor, optionally filtered by a start time. Useful when the default 10 departures are insufficient. Times are in UTC. ```yaml service: gtfs2.extract_departures data: config_entry: "a1b2c3d4e5f6..." # Config entry ID of your route sensor from_time: "14:00:00" # Optional: only return departures after 14:00 UTC today/tomorrow # Result is returned as service response data (HA 2023.7+): # response: # departures: # - "2024-11-04T13:05:00+00:00" # - "2024-11-04T13:35:00+00:00" # - "2024-11-04T14:05:00+00:00" # ... # Automation example: notify if no bus after 18:00 automation: alias: "Check evening buses" trigger: - platform: time at: "17:45:00" action: - service: gtfs2.extract_departures data: config_entry: "a1b2c3d4e5f6" from_time: "18:00:00" response_variable: departures_response - condition: template value_template: "{{ departures_response.departures | count == 0 }}" - service: notify.mobile_app_my_phone data: message: "No more buses this evening on route B!" ``` -------------------------------- ### Extract Trip Stops Source: https://context7.com/vingerha/gtfs2/llms.txt Retrieves the list of all stops served by upcoming trips from a given start stop. This helps identify the destinations of vehicles at a multi-route stop. ```APIDOC ## gtfs2.extract_trip_stops ### Description Retrieves the list of all stops served by upcoming trips from a given start stop. ### Service gtfs2.extract_trip_stops ### Data - **entity_id** (string) - Required - The entity ID of the route sensor (e.g., `sensor.palmbus_b_to_mouans`). ``` -------------------------------- ### Extract Trip Stops for a Sensor Source: https://context7.com/vingerha/gtfs2/llms.txt Retrieves the list of all stops for upcoming trips departing from a specified sensor's start stop. This is useful for understanding the full route of vehicles from a single point. ```yaml service: gtfs2.extract_trip_stops data: entity_id: sensor.palmbus_b_to_mouans # Response includes stop details for each upcoming trip: # response: # trips: # - trip_id: "1115644423119" # stops: # - stop_name: "Gare SNCF de Cannes" # departure_time: "06:15:00" # - stop_name: "Croisette" # departure_time: "06:22:00" # - stop_name: "Mouans-Sartoux Centre" # departure_time: "06:45:00" ``` -------------------------------- ### Display Local Stops with Route Filtering (YAML) Source: https://github.com/vingerha/gtfs2/wiki/5.-Visualizing-the-data Use this YAML configuration in Home Assistant to display local transit stops. It includes an input text entity for filtering departures by route and a markdown card to render the filtered data in a table. The card styling is customized for better readability. ```yaml type: vertical-stack cards: - type: entities entities: - entity: input_text.local_stops_filter - type: markdown content: >- {% set next = state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')%} {% for i in range(0, next | count, 1) %} {%- if state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')[i].route == states("input_text.local_stops_filter") -%} {% endif %} {% endfor %} card_mod: style: .: | ha-card ha-markdown { padding:0px border-top: 1px groove var(--divider-color); overflow-y: scroll; height: 300px; } ha-card ha-markdown.no-header { padding:0px } $: | h1.card-header { background-color:rgb(100, 100, 100); padding: 0px 0px 0px 12px !important; color: white !important; font-weight: normal; font-size: 1.5em !important; border-top-left-radius: 5px; border-top-right-radius: 5px; height: 100%; } ha-markdown $: | h1 { font-weight: normal; font-size: 24px; } table{ border-collapse: collapse; font-size: 0.9em; font-family: Roboto; width: 100%; outline: 0px solid #393c3d; margin-top: 10px; } td { padding: 5px 5px 5px 5px; text-align: left; border-bottom: 0px solid #1c2020; } tr:nth-of-type(even) { background-color: rgb(54, 54, 54, 0.3); } ``` -------------------------------- ### Route Departures Pop-up (YAML) Source: https://github.com/vingerha/gtfs2/wiki/5.-Visualizing-the-data This Home Assistant entities card configuration uses browser-mod to create a pop-up when a route entity is tapped. The pop-up displays the next departures for that route using a custom button-card. ```yaml type: entities entities: - entity: YOURSENSOR format: datetime tap_action: action: fire-dom-event browser_mod: service: browser_mod.popup data: content: type: custom:button-card entity: YOURSENSOR show_icon: false show_state: true show_name: false tap_action: none styles: grid: - grid-template-areas: "next" "s" custom_fields: next: - font-size: 20px - font-weight: bold custom_fields: next: | [[[ return 'Next departures :' ]]] state_display: | [[[ return entity.attributes.next_departures.map((entry) => { return '
' + [ helpers.formatShortDateTimeWithYear(entry) ]; } ).join("").toString(); ]]] ``` -------------------------------- ### Configure Local Stop Sensor Source: https://context7.com/vingerha/gtfs2/llms.txt Sets up sensors to display upcoming departures from transit stops near a specified location. Requires the HA companion app for location data. Configure options like refresh interval, radius, and timerange via the GUI. ```yaml # Setup via GUI: choose datasource + person/zone entity + name # Entity created per nearby stop: sensor._local_stop # Local stop sensor attributes: attributes: next_departures_lines: - departure: "08:30" departure_datetime: "2024-11-04T07:30:00+00:00" departure_realtime: "08:27" departure_realtime_datetime: "2024-11-04T07:27:46+00:00" delay_realtime_derived: "-0:02:14" delay_realtime: "-" date: "2024-11-04" stop_name: "My City Centre" route: "B" route_long: "My City Center - via Town XYZ - End Station" headsign: "End Station" trip_id: "1907425342153" direction_id: 1 icon: "mdi:bus" # Configuration options (via GUI configure): local_stop_refresh_interval: 15 # Minutes (default: 15) — lower if tracking a moving person radius: 200 # Meters around person/zone (default: 200, max: 5000) timerange: 30 # Show departures up to N minutes in the future (default: 30) offset: 0 # Skip departures within the next N minutes max_local_stops: 15 # Cap on stop sensors (default: 15) — reduce in dense areas # Service to manually trigger a local-stop refresh (e.g., button or automation): service: gtfs2.update_gtfs_local_stops data: entity_id: person.john # or zone.home ``` -------------------------------- ### GTFS Route Sensor Configuration Options Source: https://context7.com/vingerha/gtfs2/llms.txt Configure refresh interval, departure offset, and real-time data URLs for GTFS route sensors. The offset skips departures that are too soon to reach. ```yaml # Options set via GUI configure flow (stored as config entry options) # These are the key configurable parameters: refresh_interval: 5 # Minutes between DB polls (default: 15) offset: 10 # Skip departures within the next N minutes (default: 0) include_tomorrow: true # Include tomorrow's schedule in next_departures # Real-time trip updates (protobuf URL or local file path) trip_update_url: "https://realtime.provider.com/tripupdates" # OR using a locally cached file (see update_gtfs_rt_local service): trip_update_url: "http://192.168.1.100:8123/local/gtfs2/palmbus.rt" # Real-time vehicle positions vehicle_position_url: "https://realtime.provider.com/vehiclepositions" # Real-time service alerts alerts_url: "https://realtime.provider.com/alerts" # API key authentication for real-time feeds: api_key: "your-long-api-key-string" api_key_name: "Authorization" # or: x_api_key, apiKey, ocp_apim_subscription_key api_key_location: "header" # or: query_string # After adding real-time, entity gains additional attributes: # gtfs_rt_updated_at: "2023-12-17T06:29:18.728897+00:00" # next_departure_realtime: "2023-12-17T06:43:00+00:00" # delay: unknown # latitude: "" # longitude: "" ``` -------------------------------- ### Multiple Entity Row Card for GTFS Real-time Departures Source: https://github.com/vingerha/gtfs2/wiki/5.-Visualizing-the-data Use this configuration to display real-time departure information for transit routes. It shows the next real-time departure and details for the current day, with a pop-up for more specific departure times. Requires custom cards like 'multiple-entity-row' and 'button-card'. ```yaml type: entities entities: - entity: sensor.653_mouans_sophia type: custom:multiple-entity-row state_header: RealTime attribute: next_departure_realtime name: Mouans > Sophia 653 format: time secondary_info: last-updated entities: - entity: sensor.653_mouans_sophia attribute: day name: Day format: time - entity: sensor.653_mouans_sophia name: 653 format: time tap_action: action: fire-dom-event browser_mod: service: browser_mod.popup data: content: type: custom:button-card entity: sensor.653_mouans_sophia show_icon: false show_state: true show_name: false tap_action: none styles: grid: - grid-template-areas: "\"next\" \"s\"" custom_fields: next: - font-size: 20px - font-weight: bold custom_fields: next: | [[[ return 'Next departures :' ]]] state_display: | [[[ return entity.attributes.next_departures.map((entry) => { return '
' + [ helpers.formatShortDateTimeWithYear(entry) ] ; } ).join("").toString(); ]]] - entity: sensor.653_mouans_antibes type: custom:multiple-entity-row state_header: RealTime attribute: next_departure_realtime name: Mouans > Antibes 653 format: time secondary_info: last-updated entities: - entity: sensor.653_mouans_antibes attribute: day name: Day format: time - entity: sensor.653_mouans_antibes name: 653 format: time tap_action: action: fire-dom-event browser_mod: service: browser_mod.popup data: content: type: custom:button-card entity: sensor.653_mouans_antibes show_icon: false show_state: true show_name: false tap_action: none styles: grid: - grid-template-areas: "\"next\" \"s\"" custom_fields: next: - font-size: 20px - font-weight: bold custom_fields: next: | [[[ return 'Next departures :' ]]] state_display: | [[[ return entity.attributes.next_departures.map((entry) => { return '
' + [ helpers.formatShortDateTimeWithYear(entry) ] ; } ).join("").toString(); ]]] card_mod: style: .: | ha-card { border-width: 0px !important; background: none; } ``` -------------------------------- ### Entities Card with Pop-up for Next Departures Source: https://context7.com/vingerha/gtfs2/llms.txt Shows the next departure time for a route sensor and displays all upcoming departures in a pop-up using browser_mod. Requires browser_mod from HACS. ```yaml type: entities entities: - entity: sensor.palmbus_b_to_mouans format: datetime tap_action: action: fire-dom-event browser_mod: service: browser_mod.popup data: content: type: custom:button-card entity: sensor.palmbus_b_to_mouans show_icon: false show_state: true show_name: false tap_action: none styles: grid: - grid-template-areas: "next s" custom_fields: next: - font-size: 20px - font-weight: bold custom_fields: next: | [[[ return 'Next departures:' ]]] state_display: | [[[ return entity.attributes.next_departures.map((entry) => { return '
' + helpers.formatShortDateTimeWithYear(entry); }).join('').toString(); ]]] ``` -------------------------------- ### Flex Table Card for Local Stops and Departures Source: https://github.com/vingerha/gtfs2/wiki/5.-Visualizing-the-data Display local stop departures using a custom flex-table-card. This configuration filters for entities named '*_local_stop' and displays route, time, stop, and headsign information. Ensure the 'next_departures_lines' data is correctly populated for each stop. ```yaml type: custom:auto-entities filter: include: - name: '*_local_stop' exclude: - state: unavailable card: type: custom:flex-table-card clickable: true max_rows: 30 title: Local Stop dep. strict: true sort_by: - next_departures_lines columns: - hidden: true data: next_departures_lines modify: x.departure - name: Route data: next_departures_lines modify: ''''' + x.route' - name: Time data: next_departures_lines modify: x.departure - name: Stop data: next_departures_lines modify: x.stop_name - name: Headsign data: next_departures_lines modify: x.headsign css: table+: 'padding: 0px' card_mod: style: | ha-card { overflow: auto; max-height: 500px; } ``` -------------------------------- ### Update GTFS Data Source Source: https://context7.com/vingerha/gtfs2/llms.txt Use this service call to download and extract a GTFS ZIP file into the local SQLite database. Specify the extraction method ('url' or 'zip'), a local database name, and the URL or path to the ZIP file. Optional API key details can also be provided. Extraction may take a significant amount of time. ```yaml service: gtfs2.update_gtfs data: extract_from: "url" # "url" or "zip" file: "palmbus" # Name for the local database (no .zip) url: "https://transport.data.gouv.fr/resources/12345/download/GTFS.zip" api_key: "" # Optional: leave empty if not required api_key_name: "Authorization" # Known values: Authorization, x_api_key, apiKey, ocp_apim_subscription_key api_key_location: "not_applicable" # "not_applicable", "header", or "query_string" clean_feed_info: false # Set true if provider has broken feed_info.txt check_source_dates: false # Experimental: cancels update if only past dates found ``` -------------------------------- ### Filter Local Stop Departures by Route using Jinja2 Source: https://context7.com/vingerha/gtfs2/llms.txt Use a Markdown card with Jinja2 templating to filter the 'next_departures_lines' attribute of a local stop sensor by route name. This requires an 'input_text' helper to specify the filter route. ```yaml type: vertical-stack cards: - type: entities entities: - entity: input_text.local_stops_filter # Set this to e.g. "B" to filter route B - type: markdown content: >-
{{ state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')[i].route }} {{ state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')[i].departure }} {{ state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')[i].stop_name }} {{ state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')[i].headsign }}
{% set next = state_attr('sensor.01254_0608400_local_stop_person_abcd', 'next_departures_lines') %} {% for i in range(0, next | count, 1) %} {%- if next[i].route == states('input_text.local_stops_filter') -%} {% endif %} {% endfor %}
{{ next[i].route }} {{ next[i].departure }} {{ next[i].stop_name }} {{ next[i].headsign }}
card_mod: style: ha-markdown $: | table { border-collapse: collapse; font-size: 0.9em; width: 100%; } td { padding: 5px; text-align: left; } tr:nth-of-type(even) { background-color: rgba(54, 54, 54, 0.3); } ``` -------------------------------- ### Flex-Table Card for Local Stops and Departures Source: https://context7.com/vingerha/gtfs2/llms.txt Displays nearby stops and their upcoming departures in a sortable table. Requires flex-table-card and auto-entities from HACS. Filters for entities named '*_local_stop'. ```yaml type: custom:auto-entities filter: include: - name: "*_local_stop" exclude: - state: unavailable card: type: custom:flex-table-card clickable: true max_rows: 30 title: Local Stop Departures strict: true sort_by: - next_departures_lines columns: - name: Route data: next_departures_lines modify: "'' + x.route" - name: Time data: next_departures_lines modify: x.departure - name: Stop data: next_departures_lines modify: x.stop_name - name: Headsign data: next_departures_lines modify: x.headsign css: table+: "padding: 0px" card_mod: style: | ha-card { overflow: auto; max-height: 500px; } ``` -------------------------------- ### Custom SVG Bus Icon Configuration Source: https://context7.com/vingerha/gtfs2/llms.txt Applies a custom SVG icon to geo_location entities matching a specific pattern. Ensure the SVG file exists at the specified path. ```yaml homeassistant: customize_glob: geo_location.b_0*: entity_picture: /local/icons/bus.svg ``` -------------------------------- ### Configure GeoJSON for Vehicle Tracking Source: https://context7.com/vingerha/gtfs2/llms.txt Configures the Home Assistant GeoJSON integration to display vehicle positions on a map. This requires a GTFS-RT vehicle positions feed to be configured on a route sensor, which generates a local GeoJSON file. ```yaml # 1. In configuration.yaml, add the GeoJSON integration pointing to the local file: geo_location: - platform: geo_json_events url: "http://192.168.1.100:8123/local/gtfs2/palmbus.json" # Note: filename is case-sensitive ``` -------------------------------- ### Local Stop Departure Data Fields Source: https://github.com/vingerha/gtfs2/wiki/2c.-Acquire-local-stops-&-departures Explains the various data fields available for each local stop departure sensor. These fields provide scheduled and real-time departure information, delays, route details, and stop identifiers. ```yaml - departure: '08:30' >> scheduled departure time in local stop timezone departure_datetime: '2024-11-04T07:30:00+00:00' >> scheduled departure time in local stop timezone, as utc departure_realtime: '08:27' >> >> estimated departure real-time, received from the data-source/provider, in local stop timezone departure_realtime_datetime: '2024-11-04T07:27:46+00:00' >> estimated departure real-time, received from the data-source/provider, in local stop timezone, as utc delay_realtime_derived: '-0:02:14' >> estimated delay, derived from departure time and real-time, shows '-' if 0 or non-existing real-time. Can be negative if departure is estimated before the scheduled time. delay_realtime: '-' >> delay, received from the data-source/provider, shows '-' if 0 or non-existing date: '2024-11-04' >> date related to the scheduled data stop_name: My City Centre >> name of the stop for which the data is shown route: B >> route for which the data is shown route_long: My City Center - via Town XYZ - End Station >> long name of the route for which the data is shown headsign: End Station >> headsign of the vehicle for which the data is shown trip_id: '1907425342153' direction_id: 1 icon: mdi:bus ``` -------------------------------- ### Automate GTFS-RT Cache Refresh Source: https://context7.com/vingerha/gtfs2/llms.txt Automates the refreshing of the GTFS-RT cache for a specific file. Ensure the service 'gtfs2.update_gtfs_rt_local' is correctly configured. ```yaml automation: alias: "Refresh NL GTFS-RT Cache" trigger: - platform: time_pattern seconds: "/60" action: - service: gtfs2.update_gtfs_rt_local data: file: "netherlands_rt" url: "https://gtfs.ovapi.nl/nl/tripUpdates.pb" api_key_location: "not_applicable" api_key_name: "Authorization" accept: true rt_type: "trip_data" debug_output: false ``` -------------------------------- ### Update Local Stops Source: https://context7.com/vingerha/gtfs2/llms.txt This service manually triggers a refresh of local stop data, useful for updating departures based on a person's or zone's location. ```APIDOC ## gtfs2.update_gtfs_local_stops ### Description Manually triggers a refresh of local stop data based on a specified entity's location. ### Service gtfs2.update_gtfs_local_stops ### Data - **entity_id** (string) - Required - The Home Assistant entity ID (e.g., `person.john` or `zone.home`) to use as the location reference. ``` -------------------------------- ### Caching GTFS Real-Time Data Locally Source: https://context7.com/vingerha/gtfs2/llms.txt Use the `update_gtfs_rt_local` service to download and store GTFS-RT feeds locally. This reduces redundant external requests when multiple sensors use the same feed. ```yaml service: gtfs2.update_gtfs_rt_local data: file: "netherlands_rt" # Saved as config/www/gtfs2/netherlands_rt.rt url: "https://gtfs.ovapi.nl/nl/tripUpdates.pb" api_key: "" api_key_name: "Authorization" api_key_location: "not_applicable" accept: true # Adds application/protobuf to the Accept header rt_type: "trip_data" # "trip_data", "vehicle_positions", or "alerts" debug_output: false # If true, saves human-readable .txt to www/gtfs2/ ``` -------------------------------- ### Update GTFS RT Cache Source: https://context7.com/vingerha/gtfs2/llms.txt This service updates the GTFS Realtime cache for a specified file and URL. It allows configuration of API keys, accept headers, and debug output. ```APIDOC ## gtfs2.update_gtfs_rt_local ### Description Updates the GTFS Realtime cache with data from a specified URL. ### Service gtfs2.update_gtfs_rt_local ### Data - **file** (string) - Required - The name of the file to update. - **url** (string) - Required - The URL of the GTFS-RT feed. - **api_key_location** (string) - Optional - The location of the API key. - **api_key_name** (string) - Optional - The name of the API key header. - **accept** (boolean) - Optional - Whether to set the Accept header. - **rt_type** (string) - Optional - The type of real-time data. - **debug_output** (boolean) - Optional - Whether to enable debug output. ``` -------------------------------- ### Map Card with Auto-Entities for Route B Geo-Location Source: https://context7.com/vingerha/gtfs2/llms.txt Displays all geo_location entities for a specific route using auto-entities. Requires entities matching the pattern 'geo_location.b_0*'. ```yaml type: custom:auto-entities filter: include: - entity_id: geo_location.b_0* # Pattern: __ exclude: - state: unavailable show_empty: true card: type: map hours_to_show: 2 auto_fit: true card_mod: style: ha-map: $: .leaflet-marker-icon: ha-entity-marker $: | .marker { width: 25px !important; height: 25px !important; border: 0px solid var(--ha-marker-color, var(--primary-color)) !important; background-color: var(--ha-marker-color, none) !important; } ``` -------------------------------- ### Map Card for Vehicle Positions Source: https://github.com/vingerha/gtfs2/wiki/5.-Visualizing-the-data Configure a map card to display active vehicle positions. This snippet uses auto-entities to filter and display geo_location entities, with custom styling for map markers. Ensure geojson entities are correctly configured and accessible. ```yaml type: custom:auto-entities filter: include: - entity_id: geo_location.b_0* exclude: - state: unavailable show_empty: true card: type: map hours_to_show: 2 auto_fit: true card_mod: style: ha-map: $: .leaflet-marker-icon: ha-entity-marker $: | .marker { vertical-align: right !important; width: 25px !important; height: 25px !important; border: 0px solid var(--ha-marker-color,var(--primary-color)) !important; background-color: var(--ha-marker-color,none) !important; } .div:hover { --webkit-transform: scale(0.1); --ms-transform: scale(0.1); transform: scale(0.1); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.