diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..632f1ca --- /dev/null +++ b/.env.template @@ -0,0 +1,3 @@ +GOVEE_API_KEY= +GOVEE_DEVICE= +GOVEE_SKU= \ No newline at end of file diff --git a/readme.md b/readme.md index c87830d..920637e 100644 --- a/readme.md +++ b/readme.md @@ -2,14 +2,23 @@ Scoreboard script for showing active sports I like. -# Setup +## Equipment -Must have _rpi-rgb-led-matrix_ setup prior to use & installed via pip. Run `python download_logos.py` to download logos to reflect, also configure the values in the ENV example. +I have a small setup to make this work, all specs found below -# Running +- [Raspberry Pi 4, 2GB](https://www.amazon.com/dp/B07TYK4RL8?ref=ppx_yo2ov_dt_b_fed_asin_title) +- [4x waveshare P2.5 64x32 LED panels](https://www.amazon.com/dp/B0BRBGHFKQ?ref=ppx_yo2ov_dt_b_fed_asin_title) +- [MEAN WELL LRS-100-5 5v PSU](https://www.amazon.com/dp/B07DKCMJN9?ref=ppx_yo2ov_dt_b_fed_asin_title) +- [Adafruit Triple LED Matrix HUB75 Bonnet](https://www.adafruit.com/product/6358) -Just run +## Setup -```bash -python scoreboard.py -``` +- Install Python, Python build tools & build rpi-rgb-led-matrix [from source](https://github.com/hzeller/rpi-rgb-led-matrix) or install it via pip +- Clone this repository +- Install requirements using `pip install -r requirements.txt` +- Download logos using the `download_logos.py` Python script +- Run `scoreboard.py` Python script + +## Govee Lighting + +If you have Govee lighting you want to setup for celebrations, create a `.env` file and complete the arguments in the template file. diff --git a/scoreboard.py b/scoreboard.py index 95a8b46..d83baa2 100644 --- a/scoreboard.py +++ b/scoreboard.py @@ -56,12 +56,12 @@ class Colors(Enum): # --- Govee API --- -govee_api = govee.GoveeApi(key=os.environ["GOVEE_API_KEY"]) +if os.environ['GOVEE_API_KEY']: + govee_api = govee.GoveeApi(key=os.environ["GOVEE_API_KEY"]) # --- PyGame Audio --- pygame.mixer.init() - # --- Goal celebrations --- def render_goal_frame(text, text_scale, bg_color, text_color): big_h = max(8, int(32 * text_scale)) @@ -279,7 +279,7 @@ def draw_all_games(canvas, games, start_index): font_small, offset + 18, 11, - graphics.Color(255, 255, 255), + graphics.Color(*Colors.RED.value), game["away"], ) graphics.DrawText( @@ -287,7 +287,7 @@ def draw_all_games(canvas, games, start_index): font_small, offset + 18, 27, - graphics.Color(255, 255, 255), + graphics.Color(*Colors.WHITE.value), game["home"], ) @@ -296,7 +296,7 @@ def draw_all_games(canvas, games, start_index): font, offset + 40, 13, - graphics.Color(255, 255, 255), + graphics.Color(*Colors.WHITE.value), str(game["away_score"]), ) graphics.DrawText( @@ -304,7 +304,7 @@ def draw_all_games(canvas, games, start_index): font, offset + 40, 29, - graphics.Color(255, 255, 255), + graphics.Color(*Colors.WHITE.value), str(game["home_score"]), ) @@ -325,7 +325,7 @@ def draw_single_game(canvas, game): font_small, 18, 11, - graphics.Color(255, 255, 255), + graphics.Color(*Colors.WHITE.value), game["away"], ) graphics.DrawText( @@ -333,7 +333,7 @@ def draw_single_game(canvas, game): font_small, 18, 27, - graphics.Color(255, 255, 255), + graphics.Color(*Colors.WHITE.value), game["home"], ) @@ -342,7 +342,7 @@ def draw_single_game(canvas, game): font, 40, 13, - graphics.Color(255, 255, 255), + graphics.Color(*Colors.WHITE.value), str(game["away_score"]), ) graphics.DrawText( @@ -350,7 +350,7 @@ def draw_single_game(canvas, game): font, 40, 29, - graphics.Color(255, 255, 255), + graphics.Color(*Colors.WHITE.value), str(game["home_score"]), ) graphics.DrawText( @@ -358,7 +358,7 @@ def draw_single_game(canvas, game): font, 55, 22, - graphics.Color(255,255,255), + graphics.Color(*Colors.WHITE.value), str(game["status"]) ) @@ -420,7 +420,7 @@ def run(): draw_single_game(canvas, preferred_games[current_preferred_game]) else: # no games available, just draw placeholder - graphics.DrawText(canvas, font, 10, 22, graphics.Color(255,0,0), "No games today") + graphics.DrawText(canvas, font, 10, 22, graphics.Color(*Colors.RED.value), "No games today") canvas = matrix.SwapOnVSync(canvas) sleep(0.03)