Semaphor blog
Blog: Semaphor

JSON-fed Raspberry Pi Infoscreen

Controlled by simple JSON files, this updated version of the 'infopi' infoscreen project allows the Raspberry to show URLs at varying time intervals, include URL specific refresh timers, choice of browser as well as the ability to interpret updates to the JSON configuration in real time - all of which is Ansible managed and works straight from boot either from SD card or through Preboot Execution Environment (PXE Boot).



Each Raspberry is paired with a configuration file dubbed after the Pi's MAC-address, and multiple configuration files can be located on a single supply server for a multi infoscreen-Pi setup. The configuration files are split into two categories; some global defaults and the targets:



The first option is the choice of browser. Currently the code is shown to run best using the Chromium browser, but also works with Firefox! The "check_json_source" option is the amount time, in seconds, that will pass before the code will match its current configuration with the one present at the supply server, to check for any mismatch and update in case any are found:



The "max_runtime" option simply refers to the total runtime the infoscreen will run before it will exit and subsequently be rebooted by a system service, simply to refresh the entire process. The "default_time" option is the amount of time a URL will be shown if otherwise not specified by the target "time" key value pair , here shown to vary between 2 and 5 seconds:



The "default_refresh" works the same as the "default_time" and is the total time that can pass before a target is subtly refreshed in the background by emulating an "F5" keypress just as the the targets are switched.

The targets are simply dictionaries with "url" being a required key, while "time" and "refresh" are optional keys to be substituted with the global default values if nothing else is specified. While the code runs, python will print some relevant information that is useful for testing that all is working as the user intends:




26-01-2022 16:10

0 Comments

Add comment

Name:
E-mail:
City:
Job:
Subject:
Comment:
 
It may take a moment until your comment is published.