Skip to content

spate141/BlinkThink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlinkThink

BlinkThink

Self-hosted web UI for capturing and analyzing snapshots from Blink security cameras.


Features

  • Multi-camera snapshot capture with per-camera selection
  • Gallery with filter chips per camera and a full-size lightbox
  • Snapshots saved to ./snapshots/{CameraName}/YYYYMMDD_HHMMSS.jpg
  • MFA login flow; auto-login on restart via persisted OAuth tokens
  • Optional AI image analysis via Google Gemini

Requirements

  • Python 3.11+
  • A Blink account with at least one camera
  • uv

Quick Start

git clone https://github.com/your-username/BlinkThink.git
cd BlinkThink

uv sync
cp .env.example .env   # add GEMINI_API_KEY if desired

uv run uvicorn main:app --host 0.0.0.0 --port 8000 --reload

Open http://localhost:8000 in your browser.


Configuration

Copy .env.example to .env. All variables are optional — defaults are shown below.

Variable Default Description
SNAPSHOT_DIR ./snapshots Root directory for saved snapshots
CREDENTIALS_FILE ./blink_credentials.json Path for persisted Blink OAuth tokens
ALLOWED_ORIGINS http://localhost:8000,http://127.0.0.1:8000 Comma-separated CORS origins
GEMINI_API_KEY (empty) Google Gemini API key — enables the Analyze button
GEMINI_MODEL gemini-2.5-flash Gemini model for image analysis

Authentication

  1. Enter your Blink email and password in the login screen.
  2. Enter the verification code sent to your email.
  3. Tokens are saved to blink_credentials.json and reused on restart — no MFA required.

To force re-authentication, delete blink_credentials.json.


Snapshot Storage

snapshots/
├── FrontDoor/
│   ├── 20250315_143022.jpg
│   └── 20250315_143501.jpg
└── Backyard/
    └── 20250315_143022.jpg

Camera names are sanitised ([A-Za-z0-9_-] only) before use as directory names.


Security

  • Local-only by default. Do not expose port 8000 publicly. Use a VPN or authenticated reverse proxy for remote access.
  • CORS is restricted to ALLOWED_ORIGINS — wildcard * is never used.
  • Login fields and MFA codes are validated via Pydantic before any Blink API call.
  • .env, blink_credentials.json, and snapshots/ are gitignored.

Project Structure

BlinkThink/
├── main.py              # FastAPI app, routes, lifespan
├── clients/
│   ├── blink_client.py  # BlinkClient singleton (blinkpy wrapper)
│   └── ai/
│       ├── base.py      # AIImageAnalyzer ABC
│       └── gemini.py    # GeminiClient (google-genai wrapper)
├── utils/
│   └── files.py         # Path/timestamp helpers
├── static/
│   ├── index.html       # Single-page frontend
│   ├── app.js           # Camera selection, gallery, lightbox, analysis
│   ├── style.css
│   └── logo.png
├── .env.example
└── pyproject.toml

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors