NAME
hafas-m - Interface to the DeutscheBahn/HAFAS online departure monitor
SYNOPSIS
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
version 6.11
DESCRIPTION
hafas-m is an interface to HAFAS public transport services such as the one operated by Deutsche Bahn.
It can serve as an arrival/departure monitor, request details about a specific trip/journey, and look up public transport stops by name or geolocation. The operating mode depends on the contents of its non-option argument.
Arrival/Departure Monitor (station)
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 * !.
Location Search (?query|lat:lon)
List stations that match query or that are located in the vicinity of lat:lon geocoordinates with EVA ID and name.
Trip Search (!query)
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.
Trip Details (journeyID)
List intermediate stops of journeyID (as given by arrival/departure monitor mode when invoked with -j, --with-jid) 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.
OPTIONS
Values in brackets indicate options that only apply to the indicated operating mode(s).
- -a, --arrivals (monitor)
-
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.
- -d, --date dd.mm.[yyyy]
-
Request date. Default: today.
- -j, --with-jid (monitor)
-
Show journey IDs in arrival/departure board. These can be used to obtain details on individual journeys with subsequent hafas-m invocations.
- --json
-
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.
- -l, --language language
-
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
-
List known HAFAS instances and exit. Use -s|--service to select a service from this list for a HAFAS request.
- -m, --mot motlist (monitor)
-
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. - -n, --num-results count (monitor)
-
Request up to count results. Default: 30.
- --no-cache
-
If the Cache::File module is available, server replies are cached in ~/.cache/Travel-Status-DE-HAFAS (or a path relative to
$XDG_CACHE_HOME
, if set) for 90 seconds. Use this option to disable caching. You can also use --cache to re-enable it. - --raw-json
-
Print unprocessed HAFAS response as JSON and exit. Useful for debugging and development purposes.
- -s, --service service
-
Request arrivals/departures using the API provided by service, defaults to DB (Deutsche Bahn). See --list for a list of known services.
- -t, --time hh:mm (monitor)
-
Request time. Must be specified in the selected HAFAS service's default time zone, see --list. Default: now.
- -v, --via stopname|eva1,eva2,... (monitor)
-
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.
- -V, --version
-
Show version information and exit.
EXIT STATUS
0 upon success, 1 upon internal error, 2 upon backend error.
CONFIGURATION
None.
DEPENDENCIES
Class::Accessor(3pm)
LWP::UserAgent(3pm)
BUGS AND LIMITATIONS
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
AUTHOR
Copyright (C) 2015-2023 by Birte Kristina Friesel <derf@finalrewind.org>
LICENSE
This program is licensed under the same terms as Perl itself.