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.
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.
There are 2 ways to configure the integration:
- Using Config Flow: in
Configuration/Integrations
click on the+
button, selectCZ 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. - Using YAML: Add
cz_pub_tran
sensor in yourconfiguration.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
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)
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) |
Set the time to start searching for connections - see README.md for details