Skip to content

JakeTheRabbit/rosinlab

Repository files navigation

RosinLab (local-first rosin press + sift logging)

This is a small, self-hosted web app for recording R&D parameters for:

  • Presses (with hero photo + full video + microscope media)
  • Sift batches (with microscope slide media + batch metadata)

It’s built to run on your LAN and be embedded inside Home Assistant via an iframe/webpage card.

image

What you get

  • Web-based forms (press + sift)
  • Upload hero photo + video (and extra photos/microscope media)
  • Press detail view: video player + parameters displayed alongside
  • Compare view: choose up to 3 presses and play videos simultaneously, with parameters next to each one
  • SQLite database + on-disk media storage (simple to backup)

Quick start (plain Python)

1) Install deps

cd rosinlab
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

2) Run

python app.py

Default: http://0.0.0.0:8099

Database file is created at ./rosinlab.db and media goes in ./uploads/.


Hosting options

Option A: Run anywhere on your LAN

  • Run this on a small box (NUC, Pi, server, etc)
  • Then add it to Home Assistant as a Panel iFrame or use a Webpage Card pointing to: http://<that-host>:8099

Option B: Run in Docker (recommended if you live in containers)

You can containerise this easily. Example docker run:

docker run -it --rm \
  -p 8099:8099 \
  -v "$(pwd)/data:/data" \
  -e ROSINLAB_DB=/data/rosinlab.db \
  -e ROSINLAB_UPLOADS=/data/uploads \
  ghcr.io/<your-org>/<your-image>:latest

(You’ll need to build/publish an image, or you can just run it with Python.)


Configuration

Optional: API key for write operations

If you set an API key, creating/editing records and uploading media requires the browser to send X-Api-Key.

export ROSINLAB_API_KEY="your-secret"
python app.py

In the UI, go to Process and paste the key (stored in that browser only).

Optional: Home Assistant environment snapshot

This lets the press form auto-fill room temp/RH from HA sensors.

Create config.json next to app.py:

{
  "ha_base_url": "http://homeassistant.local:8123",
  "ha_token": "LONG_LIVED_ACCESS_TOKEN_HERE",
  "ha_temp_entity": "sensor.press_room_temperature",
  "ha_rh_entity": "sensor.press_room_humidity",
  "db_path": "./rosinlab.db",
  "upload_dir": "./uploads",
  "max_upload_mb": 10240
}

Then press “Auto-fill from Home Assistant sensors” in the press form.


Backups (do not skip this)

To back up everything:

  • Copy rosinlab.db
  • Copy the entire uploads/ directory

That’s your whole dataset.


Notes about big videos

Browser uploads work best when videos are:

  • 720p (or 1080p if you must)
  • H.264 MP4
  • Reasonable bitrate

If you upload 5GB monsters, it’ll work… but your patience won’t.


Future: microscope AI counting

This app stores microscope media and has DB fields to save AI outputs later (ai_version, ai_metrics_json). Recommended architecture:

  • Keep this app as the “truth database + UI”
  • Add a separate analysis service later that:
    1. downloads microscope images from /api/media/<id>
    2. runs counting/detection
    3. writes results back to /api/sifts/<id> or /api/presses/<id> via the API

Modular > monolith.

About

Local-first rosin press and sift logging app for Home Assistant

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors