Files
KH_Clock/main.py
Spencer 0c2392b2b3 Initial implementation of Sahsa Clock
Pygame framebuffer clock for Le Potato (ARM Debian) with aiohttp webhook server.
Renders 12-hour clock directly to /dev/fb0 (no X11/Wayland). Supports full-screen
message overlays pushed via a browser dashboard or Bearer-token API. Includes
first-run setup wizard, session-based dashboard auth, bcrypt password storage,
per-IP rate limiting, and systemd service unit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 16:22:10 -06:00

48 lines
1.3 KiB
Python

import argparse
import asyncio
import sys
from config import AppConfig
from server import run_server
from state import MessageState
def main() -> None:
parser = argparse.ArgumentParser(description="Sahsa Clock Display")
parser.add_argument(
"--dev",
action="store_true",
help="Windowed dev mode — renders to an x11 window instead of the framebuffer",
)
parser.add_argument(
"--no-display",
action="store_true",
help="Start the HTTP server only, with no display output (useful for testing the dashboard/API)",
)
parser.add_argument(
"--config",
default="config.toml",
metavar="PATH",
help="Path to config.toml (default: config.toml)",
)
args = parser.parse_args()
config = AppConfig.load(args.config)
state = MessageState()
if not args.no_display:
# Import display only when needed — keeps --no-display working without pygame
from display import DisplayThread
display = DisplayThread(state, config, dev_mode=args.dev)
display.start()
try:
asyncio.run(run_server(state, config))
except KeyboardInterrupt:
print("\n[sahsa-clock] Shutting down.")
sys.exit(0)
if __name__ == "__main__":
main()