A kiosk device used to display useful information for an office desk, specifically my own at home weather, events, Liverpool FC scores and even what song I am currently listening to on Spotify. The device uses Python scripts to retrieve data needed, store in a MySQL database then host a dashboard using Flask. The device itself uses a Linux Debian distribution to manage the running of these scripts and the Chromium browser used to access the dashboard.


The Kiosk (as shown above) retrieves data from a variety of sources and extracts them on schedules dependent on the source. The majority of the scripts access API’s providing the needed data then write to a specific MySQL table.


These sources are extracted either every 15 minutes (news, weather and events) or every hour (stocks, flights and LFC). As well as storing the data, the database also keeps track of runs using a logging table that records each script runtime as well as the record counts and any error messages that occur.


Unlike the other sources, the indicator for Spotify’s current tracks is taken directly from the API and not stored in a database. As the function of this data needs regular live access, performance loss from regularly having to read and write would be a major issue. Instead a direct connection to the Spotify API is made that polls the currently listening endpoint every three seconds with a Python script. Using Flask WebSockets the results of the script are then communicated to the webserver and live updated upon any changes. This allows the display to change as soon as a song plays or changes rather than waiting for a scheduled refresh.


The kiosk itself is a website locally hosted on a Raspberry Pi 3 with the device hardcoded to boot into a Chromium window displaying the website and locking into it. Instead of the site using Javascript scripts to display the values of the data, the site is hosted using Flask, a lightweight Python web-app hosting framework that is appropriate for this use case (and retroactively would have been more useful for the van kiosk as well). With Flask, the data stored in SQLite can be accessed with ease and Pythonically, making the design and structure of the kiosk incredibly straightforward.


Visit Github Repo