NAME

hafas-m - Interface to the DeutscheBahn/HAFAS online departure monitor

SYNOPSIS

hafas-m [-d date] [-t time] [-m motlist] [-s service] [-l language] station

hafas-m [-s service] ?query|lat:lon

hafas-m [-s service] [-l language] !query|journeyID

VERSION

version 5.00

DESCRIPTION

hafas-m is an interface to HAFAS arrival/departure monitors such as the one available at https://reiseauskunft.bahn.de//bin/bhftafel.exe/dn.

It has three operating modes that depend on the contents of its argument.

Arrival/Departure Monitor (station)

Show departures (or arrivals) at station, optionally filtered by date, time and mode of transport. station may be given as a station name or EVA ID. EVA IDs tend to be similar to, but not always identical with, UIC station codes. Output format:

  • scheduled departure (or arrival) time

  • delay, if known

  • trip number or line

  • direction / destination

  • platform (! indicates a platform change)

  • expected occupancy of first and second class, if known

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 with arrival/departure time, delay (if available), occupancy (if available), and stop name.

OPTIONS

-a, --arrivals

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]

Date to list departures for. Default: today.

--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 installations and exit. Use -s|--service to select an operator from this list for a HAFAS request.

-m, --mot motlist

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.

--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

Time to list departures for. Default: now.

-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.

AUTHOR

Copyright (C) 2015-2023 by Birte Kristina Friesel <derf@finalrewind.org>

LICENSE

This program is licensed under the same terms as Perl itself.