# ThermoPro CYD Frontend

A Progressive Web App (PWA) that consumes the CYD ThermoPro Bridge API, stores session history in SQLite, and displays probe temperatures with charts, target setpoints, and freeform notes.

## Architecture

```
LXC/container
├── Python backend (Flask)
│   ├── Polls CYD /api/latest periodically
│   ├── Stores readings + sessions + notes in SQLite
│   └── Serves the static PWA and API
└── PWA (HTML/CSS/JS)
    ├── Dashboard with probe cards
    ├── Temperature history charts
    ├── Target setpoint editor
    └── Session notes
```

## Requirements

- Python 3.10+ (system install or any working Python interpreter)
- SQLite (stdlib)

Dependencies are installed locally into `frontend/vendor/` so no virtual environment is required.

## Installing dependencies

```bash
cd frontend
pip install --target vendor -r requirements.txt
```

On Windows with PowerShell:

```powershell
cd "C:\Users\ksolo\Projects\House Projects\ThermoPro CYD\frontend"
pip install --target vendor -r requirements.txt
```

## Running locally

```bash
cd frontend
CYD_BASE_URL=http://192.168.2.55 python app.py
```

On Windows with PowerShell:

```powershell
cd "C:\Users\ksolo\Projects\House Projects\ThermoPro CYD\frontend"
$env:CYD_BASE_URL = "http://192.168.2.55"
python app.py
```

Then open `http://localhost:5000`.

## Configuration

| Environment variable | Default | Description |
|----------------------|---------|-------------|
| `CYD_BASE_URL` | `http://192.168.2.55` | Base URL of the CYD bridge |
| `POLL_INTERVAL` | `5` | Seconds between backend polls |
| `DATABASE_PATH` | `thermopro.db` | SQLite database file |
| `DEFAULT_CHART_MINUTES` | `60` | Default chart time range |

## Deployment

See `deploy/README.md` for step-by-step Proxmox LXC deployment instructions.

For a quick local test:

```bash
cd frontend
pip install --target vendor -r requirements.txt
CYD_BASE_URL=http://192.168.2.55 python app.py
```
