Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 4.04 KB

info.md

File metadata and controls

56 lines (40 loc) · 4.04 KB

hacs_badge CZ-Public-Transport Maintenance

Buy me a coffee

End of free API trial?

It looks like CHAPS made some change in December 2019, and the API does not work anymore without a valid userid (eventhoug the documentation states that userid parameter is optional). Let's wait what the future brings.

Czech Public Transport

The CZ-Public-Transport component is a Home Assistant custom sensor that finds Public Transport connections in the Czech Republic. It uses test version of CRWS - an REST API managed by CHAPS s.r.o. The test version is unfortunately limited to limited combinations of connections - ABCz, witch is PID (Pražská Integrovaná Doprava) without trains. The full version would require client ID, but CHAPS does not provide that to public as far as I know. I did write them an email about my intention to write this sensor, but they did not respond.

Overview (using standard picture-elements card - with the table in background image)

Connection detail (using markdown custom card, displayed as popup-card)

Configuration

There are 2 ways to configure the integration:

  1. Using Config Flow: in Configuration/Integrations click on the + button, select CZ Public Transport and configure the sensor (prefered). If you configure the integration using Config Flow, you can change the entity_name, name and change the sensor parameters from the Integrations configuration. The changes are instant and do not require HA restart.
  2. Using YAML: Add cz_pub_tran sensor in your configuration.yaml as per the example below:

Or you can use combination of both. The configuration of user_id, detail_format, scan_interval and force_refresh_period is currently possible only in YAML. To configure these, only add these paramaters and no sensors configuration, then configure sensors using Home Assistant GUI.

# Simple example configuration.yaml
cz_pub_tran:
  sensors:
    - origin: "Zbraslavské náměstí"
      destination: "Poliklinika Barrandov"
    - origin: "Cernosice, zel.zast."
      destination: "Florenc"

For more detailed configuration please look at the README.md

STATE AND ATTRIBUTES

STATE

The next connection short description in format time (bus line). If there are line changes to be made, the status will only show the first connection (see attribute description for the complete plan)

ATTRIBUTES

Attribute Description
departure Departure time
line Bus line (1st one if there are more connections - for more look in the description)
connections List of the connections to take (or simply line number if this is a direct connection)
duration Trip duration
delay Dlayed connections (including the line number and the delay)
description Full description of the connections - each connection on 1 line, in the format
line time (bus stop to get-in) -> time (bus stop to get-off) (!!! delay if applicable),
or as a HTML table
detail A list of 2 connections. Each connection is a dictionary of values (see the example at the end of README.md)

SERVICE sensor.set_start_time

Set the time to start searching for connections - see README.md for details