Implement calendar display application

Built a full-featured smart display app with Flask backend and responsive frontend.

Features:
- Real-time clock display
- Weather integration (OpenWeatherMap API) for Hamilton, NZ
- Google Calendar integration (placeholder, needs credentials)
- Rotating background images from local directory
- Dad jokes display (icanhazdadjoke API)

Technical stack:
- Backend: Python Flask with API endpoints
- Frontend: HTML/CSS/JavaScript with auto-updating data
- Caching system to avoid API rate limits
- Responsive design for various screen sizes

Deployment ready for Raspberry Pi with systemd service and Chromium kiosk mode setup instructions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 17:23:11 +13:00
parent 4977016a64
commit ae11476245
11 changed files with 1083 additions and 2 deletions

30
config.py Normal file
View File

@@ -0,0 +1,30 @@
import os
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
class Config:
# Flask settings
SECRET_KEY = os.getenv('FLASK_SECRET_KEY', 'dev-secret-key-change-in-production')
# OpenWeatherMap API settings
OPENWEATHER_API_KEY = os.getenv('OPENWEATHER_API_KEY', '')
WEATHER_LOCATION = os.getenv('WEATHER_LOCATION', 'Hamilton,NZ')
WEATHER_LAT = float(os.getenv('WEATHER_LAT', '-37.7870'))
WEATHER_LON = float(os.getenv('WEATHER_LON', '175.2793'))
WEATHER_UNITS = 'metric' # Use Celsius
# Google Calendar settings
GOOGLE_CALENDAR_ID = os.getenv('GOOGLE_CALENDAR_ID', '')
CALENDAR_DAYS_AHEAD = int(os.getenv('CALENDAR_DAYS_AHEAD', '7'))
# Update intervals (in seconds)
IMAGE_ROTATION_INTERVAL = int(os.getenv('IMAGE_ROTATION_INTERVAL', '300')) # 5 minutes
WEATHER_UPDATE_INTERVAL = int(os.getenv('WEATHER_UPDATE_INTERVAL', '900')) # 15 minutes
CALENDAR_UPDATE_INTERVAL = int(os.getenv('CALENDAR_UPDATE_INTERVAL', '300')) # 5 minutes
JOKE_UPDATE_INTERVAL = int(os.getenv('JOKE_UPDATE_INTERVAL', '3600')) # 1 hour
# Directories
BACKGROUNDS_DIR = os.path.join('static', 'backgrounds')
CREDENTIALS_DIR = 'credentials'