# Tank dashboard

Read-only dashboard for the display tank: temperature, pH, and heater run time over 24h, pulled from the HYDROS API.

Needs Node 20.6 or newer (for `--env-file`). One dependency, Express: run `npm install` once.

## Run it locally

    node server.js

Open http://localhost:3000. With no keys set it shows sample data.

## Go live

1. In the HYDROS app: Device Properties > Manage API Keys > +. Pick your provider, choose **Read only**.
2. Copy `.env.example` to `.env`, then fill in both keys and a dashboard password.
3. Start it with the env loaded: `node --env-file=.env server.js`
4. Open `/api/series` once. It lists the series names Hydros reports. If the heater isn't called `Heater`, set `HEATER_SERIES` to match and restart.

## How it works

- The server calls Hydros every 5 minutes (one logs call covering the last 24h at 10-minute resolution) and caches the result. That stays well under the API limits no matter how many browser tabs are open.
- The page reloads from the cache every minute. If Hydros errors, the last good data stays up with a warning.
- Keys never reach the browser.
- Hydros reports temperature in Celsius; it's converted to °F on the server.
- Heater % is the share of the 24h window the heater output was on.

## Hosting

**DigitalOcean:** copy the folder up, run it under pm2 or a systemd service, and put nginx or Apache in front as a reverse proxy to port 3000 with HTTPS.

**Buddy Drop:** drop the folder. Set the same variables from `.env.example` in the project's environment settings (don't upload `.env` itself). If Buddy can't store env vars, use DigitalOcean.
