# Temps front end (Ubuntu)

Web UI that shows the **newest** record per `unit_id` from the MySQL `Temps` table (database `shop_stats`). Each line displays: **unit_id**, **node_name**, **temp**, **humidity**, **bat**. Newest is determined by the `entry_date` column.

## Requirements

- Python 3
- pip

## Setup on Ubuntu

1. Install dependencies:

   ```bash
   pip install -r requirements.txt
   ```

2. Set the MySQL password (required). Other options are optional if they match the Temps connection:

   ```bash
   export TEMPS_MYSQL_PASSWORD="your_password"
   ```

   Optional env vars (defaults match the Temps connection):

   - `TEMPS_MYSQL_HOST` (default: `192.168.50.5`)
   - `TEMPS_MYSQL_PORT` (default: `3306`)
   - `TEMPS_MYSQL_DATABASE` (default: `shop_stats`)
   - `TEMPS_MYSQL_USER` (default: `bill`)

## Run

Development server (bind all interfaces, port 5000):

```bash
python3 app.py
```

Then open http://localhost:5000 (or http://\<ubuntu-host\>:5000 from another machine).

For production on Ubuntu, use a WSGI server such as Gunicorn and optionally put it behind a reverse proxy (e.g. nginx):

```bash
pip install gunicorn
gunicorn -w 2 -b 0.0.0.0:5000 app:app
```
