Your personal departures screen for Västtrafik buses. Currently it is hardcoded to look for buses going from Lindholmen to the center, but can be easily modified or extended. It uses a Python wrapper (PyTrafik), around the Västtrafik API by Axel Niklasson. Read more about the project and its background here.
How to install
First, prepare your Raspberry Pi for connecting with your local wireless network and enable SSH. The following guide has been tested on 2017-03-02-raspbian-jessie running on a Raspberry Pi Zero W.
- Set the correct timezone to your Pi
- Localisation Options
- Change timezone
- Clone the vasttraPi repository
git clone https://github.com/platisd/vasttraPi.git
- Clone the PyTrafik repository
git clone https://github.com/axelniklasson/PyTrafik.git
- Install the PyTrafik Python3 module
sudo pip3 install PyTrafik/
- Make sure you have PySerial 3.3 or greater installed
- sudo pip3 install pyserial --upgrade
- Create an api-config file with your Västtrafik API tokens
- Make the Python3 GUI start right after boot
- To undo this, do not just empty the .xsession file, remove it completely.
- Sync, reboot and the departures screen should pop up
Read-only & OverlayFS (Optional)
The Python3 script, which is configured to run on startup, is listening to the serial port for an "off" string in order to shutdown the Raspberry Pi. This is done in order to protect the SD card from being corrupted, even though this has rarely happened to me. That being said, if you do not want to bother with the extra USB-serial connection or feel like trying something new, an effective way of protecting the SD card is by using a read-only filesystem and OverlayFS. After a lot of search I found the great instructions by Pascal Suter who provided a very useful script in order to achieve that.
- Copy the
sudo cp /home/pi/vasttraPi/overlayRoot.sh /sbin/
- Disable swap
sudo dphys-swapfile swapoff
sudo dphys-swapfile uninstall
sudo update-rc.d dphys-swapfile remove
- Once you have your partitions set up the way you want them edit the
/boot/cmdline.txtto run the
init=/sbin/overlayRoot.shto the end of the existing file.
- After rebooting, any changes to the partitions will be non-persistent. If you want to undo this, simply restore the
/boot/cmdline.txtto its original state.