NS (Nederlandse Spoorwegen - Dutch rail service) departure timetables for terminals and PaPiRus ePaper displays, in Python
NOTE: this died 1 API update ago, and I no longer live in the Netherlands, so I am archiving the repo for posterity.
Prints the next up to four trains, from a configurable start point, to a configurable destination or two, on a PaPiRus ePaper screen attached to a Raspberry Pi (Zero).
Prints the same information as above to your terminal.
Step zero, register for an NS API key (free), copy the provided settings_example.py to settings.py, and populate it with the credentials you are provided by NS. The scripts will not work without this key.
Then, install required libraries.
pip install -r requirements.txt
If you are using nsclock.py, also manually install the 'papirus' library and dependencies as instructed by the documentation at https://github.com/PiSupply/PaPiRus
Then, just run in a terminal (or call with cron).
./nsclock.py
or
./nscliclock.py
The scripts are commented and contain a number of configurable variables which you can use to customize them to be useful to your own situation, e.g. start and end stations, etc.
nsclock.py requires Python 2.7, because as of 2017-07-01 there was no available LM75B temperature sensor library for Python 3, and the PaPiRus screen uses such a sensor.
This script makes use of the NS API, documented extensively here: http://www.ns.nl/en/travel-information/ns-api
Small pieces of code related to ePaper screen setup stolen whole from demo scripts included with PaPiRus
I owe thanks to:
+friends willing to answer my daft questions.