hafas-m - Interface to the DeutscheBahn/HAFAS online departure monitor
hafas-m [-a] [-d date] [-t time] [-m motlist] [-v via] [-s service] [-l language] station
hafas-m [-s service] ?query|lat:lon
hafas-m [-s service] [-l language] !query|journeyID
version 6.03
hafas-m is an interface to HAFAS public transport services such as the one operated by Deutsche Bahn.
It has four operating modes that depend on the contents of its argument.
Show departures (or arrivals) at station, optionally filtered by mode of transport. station may be given as a station name or HAFAS station ID. For each train, hafas-m shows
estimated departure (or arrival) time,
delay, if known,
trip name, number, or line,
direction / destination,
platform, if known (! indicates a platform change), and
expected occupancy of first and second class, if known.
Times are always given in the selected service's default time zone (see --list). Times that differ from the queried stop's local time are marked with *. Occupancy indicators are, from least occupied to fully booked: . o * !.
*
List stations that match query or that are located in the vicinity of lat:lon geocoordinates with EVA ID and name.
Show trip details (see below) for the train number provided in query (e.g. "ICE 205" or "S 31111") if it resolves into a single journey ID. Otherwise, list all journey IDs that match query.
List intermediate stops of journeyID with arrival/departure time, delay (if available), occupancy (if available), and stop name. Also includes line/journey, operator, and heading information.
Times are reported in the selected HAFAS service's default time zone (typically Europe/Berlin). If a stop's local time differs, it is also provided.
Show arrivals instead of departures, including trains ending at the specified station. Note that this causes the output to display the start instead of the end station.
Date to list departures for. Default: today.
Show journey IDs in arrival/departure board. These can be used to obtain details on individual journeys with subsequent hafas-m invocations.
Print result(s) as JSON and exit. This is a dump of internal data structures and not guaranteed to remain stable between minor versions. Please use the Travel::Status::DE::HAFAS(3pm) module if you need a proper API.
Request free-text messages to be provided in language. See --list for a list of languages supported by individual HAFAS instances. Note that requesting an invalid/unsupported language may lead to garbage output.
List known HAFAS instances and exit. Use -s|--service to select a service from this list for a HAFAS request.
By default, hafas-m shows all modes of transport arriving/departing at the specified station. With motlist, it is possible to either exclude a list of modes, or exclusively show only a select list of modes.
To exclude modes, set motlist to !mot1,!mot2,...
To show them exclusively, set motlist to mot1,mot2,...
The mot types depend on the used service. Use -m help to list them.
-m help
Print unprocessed HAFAS response as JSON and exit. Useful for debugging and development purposes.
Request arrivals/departures using the API provided by service, defaults to DB (Deutsche Bahn). See --list for a list of known services.
Time to list departures for. Must be specified in the selected HAFAS service's default time zone, see --list. Default: now.
Only show departures that pass by stopname (or arivals that have passed by stopname). If stopname is given as a list of numeric EVA IDs, only arrivals/departures with an exact EVA ID match are shown. Otherwise stopname is treated as a regular expression and matched against stop names.
Show version information and exit.
0 upon success, 1 upon internal error, 2 upon backend error.
None.
Class::Accessor(3pm)
LWP::UserAgent(3pm)
The non-default services (anything other than DB) are not well-tested.
HAFAS does not provide real-time data for routes of stationboard entries. Hence, --via estimates the arrival time from scheduled departure and departure delay
Copyright (C) 2015-2023 by Birte Kristina Friesel <derf@finalrewind.org>
This program is licensed under the same terms as Perl itself.
To install Travel::Status::DE::DeutscheBahn, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Travel::Status::DE::DeutscheBahn
CPAN shell
perl -MCPAN -e shell install Travel::Status::DE::DeutscheBahn
For more information on module installation, please visit the detailed CPAN module installation guide.