# piNail Runbook

Short operational steps for common issues.

## URLs
- LAN UI: `http://192.168.0.159:5000`
- Reverse proxy: `https://nail.sethpc.xyz`

## Service control
- Status: `ssh pinail "sudo systemctl status pinail2"`
- Restart: `ssh pinail "sudo systemctl restart pinail2"`
- Enable at boot: `ssh pinail "sudo systemctl enable pinail2"`
- Logs: `ssh pinail "sudo journalctl -u pinail2 -f"`

## If buttons do not work
1. Hard refresh browser (`Ctrl+Shift+R` / `Cmd+Shift+R`).
2. Confirm backend is online in header (`Backend: Online`).
3. Restart service: `ssh pinail "sudo systemctl restart pinail2"`.
4. Recheck UI and verify `Last command` line updates after click.

## If heater does not respond
1. Ensure ON state in UI and watch `Relay` status.
2. Check thermocouple status (`TC` should be `OK`).
3. Verify no safety trip banner is active.
4. Check logs for relay/GPIO errors.

## If temperature is far off target
1. Use `P Mode = P-on-Error` for stronger tracking.
2. Click `Reset I` after major setpoint changes.
3. Start autotune and wait for completion.
4. If autotune is too aggressive, manually lower `kP`/`kI` and increase `kD`.

## Autotune quick steps
1. Set desired target temp.
2. Turn heater ON.
3. Click `Start Autotune`.
4. Watch status (`Running heating/cooling`, peak counter).
5. Wait for `Autotune: Complete`.

## Deploy updated code
- From this repo: `cd /root/piNail/piNail2 && ./deploy.sh`
- Then restart: `ssh pinail "sudo systemctl restart pinail2"`
