A Django based web app to configure an NHL LED Scoreboard, and others, running on a Raspberry Pi.
- Description
- Features
- Config Generator
- Boards/Profile Manager (NEW!)
- Disclaimer
- Requirements
- Installation
- Usage
- Screenshots
Designed as a solution to manage the NHL LED Scoreboard project by Joel Joannisse, as well as custom board integration.
The app uses a Django webserver to manage profiles in a simple SQLite database. Users can access the web interface which can be hosted on their local machine or network. If a schema is found in a board's config directory, Django dynamically generates and validates an easy to use form to create a config.json
file. It saves a new config.json
in the appropriate config
directory and restarts your board process to implement any changes on the fly!
JSON can also be edited manually in the /admin
interface. The profiles dashboard also has the ability to backup configurations on the fly. The admin panel also has a section for global RGB Matrix flags/arguments.
Boards and their paths/settings may also be added or configured in the admin panel.
- GUI / Today's NHL Games Dashboard
- Swap between various board projects ie. NHL, NFL, MLB, etc.
- Easily Toggle your scoreboard On and Off
- Profile Status & Resource Monitor
- Profiles Dashboard
- Manage Configurations on the Fly
- Create Configurations with a Simple Form (schema dependant)
- Configuration/Profile Backup
- Supervisor Integration
- Activating A Profile Updates the Board in Real Time
- Scoreboard Status Monitor
- Pi Commands
- Scoreboard On/Off Toggle
- Stop Server
- Reboot
- Shutdown
- Admin Dashboard
- Boards Management (NHL / NFL / MLB / etc.)
- Profiles Management
- User Management
- Scoreboard Flags (ie.
--led-brightness
,--led-gpio-mapping
,--update-check
, etc.) - WebGUI Defaults (ie. Default paths, Supervisor
[program:names]
)
- REST API (W.I.P.)
- Interact with the board management backend API routes. (via http://
YOUR_IP
:9002/api)
- Interact with the board management backend API routes. (via http://
(Work in Progress)
This project is still in development. Development of the NHL LED Scoreboard is similarly evolving. They both rely on the external NHL API which, at any time may be inaccessible or updated. This app does modify your configuration files in the nhl-led-scoreboard/config
directory. While these files are cloned during installation, please backup any prized configurations on your own accord.
-
...and similar forks.
Be sure to back up any previous configurations before use!!!
git clone --recursive https://github.com/sflems/led-board-manager.git
cd led-board-manager
You can skip to this step if you have an active `supervisor' installation.
sudo apt update >&3
sudo apt install -y supervisor >&3
sudo cp scoreboard/static/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
sudo sed -i -E "s#/home/pi/#$HOME/#g" /etc/supervisor/supervisord.conf
sudo sed -i -E "s#=pi:pi\$#=$USER:$USER#g" /etc/supervisor/supervisord.conf
sudo chmod 644 /etc/supervisor/supervisord.conf
Sample configurations can be found in the nhl-led-scoreboard-img
project, by @falkyre.
To run the server in a development environment, python3-venv
can be a solution to create a separate "environment" for the server to run in.
sudo apt install python3-venv python3-dev
python3 -m venv env
./scripts/install.sh
Once finished, you can start the server with:
source env/bin/activate
gunicorn Capstone.wsgi -b 0:9002
If all is working, you should then be able to access the app @ YOUR_IP:9002
in the browser. You can deactivate the env with the command deactivate
.
Username: admin
Password: scoreboard
If you can't access the server and are using a firewall such as ufw
or iptables
, be sure to allow access to your local network only over the 9002
port (or whatever you set it to if so). If you have ports 80/443 open on your Pi/Router, this site WILL be accessable by all, so be sure to have your firewall(s) in order.
See also: Usage Instructions
See the wiki for the Manual Installation steps.
See the wiki for the complete Auto-Start Instructions.
The latest update notes can be found under the project releases.
Stop the server, then:
cd led-board-manager/
git reset --hard
git checkout main
git pull
When updating, or if stated in the release notes, it may be necessary to run the update script from the led-board-manager
directory.
./scripts/update.sh
Then, restart the web server.
Alternatively, manually enter the following commands:
source env/bin/activate
pip3 install -r requirements.txt
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py test
Then, restart the web server. You can deactivate
the (env)
if you are using the ./scripts/autorun.sh
script or supervisor
.
Be sure to back up any previous configurations before use!!!
To start the server manually, and from the led-board-manager
directory, enter:
source env/bin/activate && gunicorn Capstone.wsgi -b 0:9002
Simply run ./scripts/autorun.sh
from the same location.
This command, and the default configuration, start the server on 0.0.0.0
and port 9002
making it available to any connected devices on your local network. Alternatively, you can run the server on a different port, e.g. 0:8000
, 0:PORT
, or available to just the localhost
machine by running:
source env/bin/activate
gunicorn Capstone.wsgi -b 127.0.0.1:9002
Note: This server should not be served over a public connection or used in a production environment. If you wish to view the scoreboard WebGUI remotely, you can do so securely by accessing your local network using a VPN service.
Access the dashboard at YOUR_IP:PORT
in the browser.
Username: admin
Password: scoreboard
Viewing the board manager from an external network is possible. For more information, see the following wiki article.
In a terminal shell with the server running, Ctrl
+ C
will terminate the process. Then, deactivate
at any time to stop the venv
.
pkill -f Capstone.wsgi
...Or to find the process IDs, enter ps aux | grep gunicorn
Example response:
user@raspi:~ $ ps aux | grep gunicorn
--> user 6300 26.6 0.8 38236 33364 pts/0 S+ 00:22 0:01 gunicorn Capstone.wsgi -b 0:9002
user 6319 0.0 0.0 3160 1536 pts/1 S+ 00:22 0:00 grep --color=auto gunicorn
user@raspi:~ $
This is the second number in the table following the username (Use caution if you have more than one python/Django server running!). Change the PID
in the following command to that number to kill the server:
kill -9 PID
Better yet... simply stop the server from supervisor, or the dashboard :).
YOUR_IP:9002/admin
Username: admin
Password: scoreboard
Please change this password! You can do this by visiting YOUR IP:PORT/admin
and clicking the change password button. Email currently isn't configured.
- The supervisor configuration is updated when saving flag settings or BoardType settings in the admin panel.
- When a profile is activated, the appropriate
config.json
contents are replaced with an updated configuration. You can do this on the profiles page. Your previous config.json is still "active" until you activate one here. - When a profile is backed up, a file is created in the same folder as
profile_name.config.json
. It's path and name are displayed as a message in the browser. - Deleted profiles do not delete the
config.json
files; it only removes them from the Django Sqlite database. - The
supervisor-daemon.conf
used by theled-board-manager
app prefixes any configured BoardTypes withboards:
.- These programs are grouped in supervisor with the
boards:
prefix. sudo supervisorctl restart scoreboard
would becomesudo supervisorctl restart boards:scoreboard
.
- These programs are grouped in supervisor with the
- The GUI Defaults (ie Scoreboard path, Supervisor Program Name, etc.) can be changed in the admin panel. Alternatively, they can be modified manually in the
Capstone/settings.py
file under theCONSTANCE_CONFIG
variable.- Scoreboard Flags (ie.
--led-brightness
,--led-gpio-mapping
,--update-check
, etc.) can be changed here too.
- Scoreboard Flags (ie.
I encourage anyone interested to take a quick peek at the demo on YouTube: