Skip to content

About

2026 AQA A Level Computer Science NEA

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

43 Commits

Folders and files

Repository files navigation

OpenHaven logo

OpenHaven

A desktop dashboard for monitoring and managing a UniFi home network.
Built for my AQA A Level Computer Science NEA (2026), achieving 70/75.


About

OpenHaven connects to a local UniFi console through the official UniFi Network API, stores what it collects in a local SQLite database, and presents it as a desktop app. It aims to give a household a clearer view of its network than the stock controller UI: who is connected, to which access point, and how much traffic is flowing.

It was written as my Non-Exam Assessment for AQA A Level Computer Science, so the code is heavily commented to explain the reasoning behind each decision.

Features

  • Overview: headline stats, clients per access point and traffic over time
  • Devices: connected clients and access points, plus a live network topology graph
  • Admin actions: restart an access point, or show/hide a Wi-Fi network's SSID
  • Audit logs: a record of every admin action and who performed it
  • User accounts: admin and member access levels, with passwords hashed using Argon2 and checked against complexity rules
  • Data retention: automatically delete history older than 7, 30 or 90 days, or keep it forever
  • Auto-refresh: fetches new data from the console every 60 seconds, with a manual refresh option

How it works

flowchart LR
    subgraph app["OpenHaven desktop app (pywebview)"]
        direction LR
        ui["<b>Frontend</b><br/>HTML · CSS · JS SPA<br/><i>served by Express on :3000</i>"]
        api["<b>Python backend</b><br/>Api class<br/><i>src/index.py</i>"]
        ui <-- "JS bridge" --> api
    end

    subgraph services["backend/services"]
        direction TB
        collect["collectData +<br/>unifi_api"]
        admin["adminActions"]
        db["database +<br/>dataRetention"]
        users["user_service"]
    end

    api --> collect & admin & db & users

    unifi[("UniFi console<br/>Network API")]
    sqlite[("SQLite<br/>data/database.db")]

    collect -- "fetch every 60s" --> unifi
    admin -- "restart AP · toggle SSID" --> unifi
    db --> sqlite
    users -- "Argon2 hashes" --> sqlite
Loading
  • Desktop shell: pywebview opens a native window and exposes the Python Api class to JavaScript.
  • Frontend: a vanilla JS single-page app with one class per view, styled with Appwrite Pink. The topology graph uses vis-network.
  • Backend services (backend/services/):
    • unifi_api.py: HTTP client for the UniFi Network API
    • collectData.py: turns API responses into model objects
    • database.py: writes those objects to SQLite
    • adminActions.py: restarts access points and toggles SSID broadcasts
    • user_service.py: handles accounts and authentication
    • dataRetention.py: deletes outdated records
  • Database schema: data/schema.sql

Getting started

Prerequisites

  • A UniFi console (e.g. a Cloud Gateway or Dream Machine) running UniFi Network with the Integration API available, and an API key for it
  • Python 3.13+ and uv
  • Node.js 18+

1. Configure

cp .env.example .env

Fill in API_KEY, CONSOLE_IP, SITE_ID and CONSOLE_ID in .env.

2. Install dependencies

uv sync
cd frontend && npm install && cd ..

3. Create the database

uv run scripts/init_db.py

4. Run

Start the frontend server in one terminal:

node frontend/server.js

Then launch the desktop app in another:

uv run src/index.py

The first time you open it, create an admin account. You can add member accounts from the Users page afterwards.

Project structure

backend/
  config/       # loads .env and shared constants
  models/       # model classes (devices, clients, traffic samples…)
  services/     # API client, data collection, DB, users, admin actions
data/schema.sql # SQLite schema
frontend/       # Express server + single-page app (views in static/js/views)
scripts/        # database initialisation
src/index.py    # entry point: pywebview window + Api bridge
testing/        # ad-hoc scripts used during development

Limitations

  • OpenHaven is a student project designed for a trusted home network, not a hardened production tool.
  • TLS certificate verification is turned off for requests to the console, because UniFi consoles use self-signed certificates on the local network.
  • The scripts in testing/ were used during development and may need small import path changes to run against the current layout.

Acknowledgements

  • The setInterval helper in src/index.py is taken from pywebview-react-boilerplate (BSD 3-Clause).
  • Other sources and tutorials are credited in comments where they were used.

Licence

OpenHaven is released under the MIT License. Third-party code is credited in comments where it is used and remains under its original licence.

About

2026 AQA A Level Computer Science NEA

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages