Files
goodwe-addon/goodwe_controller/tools/ux13_screenshots.sh
T
Claude 2d2b6afb07
checks / unit (pull_request) Successful in 11m9s
infra-pin / fresh (pull_request) Successful in 2s
UX-13 P3: Simple view and Batteries screen
- Batteries: one card per battery with On/Off, the mode list (cheap hours
  and selling greyed out until OPT-11 P3), level, and Now / Today / Why
  lines built in homeview.py. Replaces the OPT-11 P1 minimal cards and uses
  the existing pack_use / pack_mode actions and store keys.
- An Off battery the peak limit still needs says so with its figure; no line
  shows 0 W beside moving power (OPT-11 P1 test F2). Today says "Not planned
  yet" until OPT-11 P3/P4.
- Home's plan leaves Off batteries out, except for the peak limit.
- Settings opens on Simple: the layout's simple fields with an applies chip
  and a note, plus the battery switches and modes. Installer is one tap.
- English and Dutch words in app/ui_text; test_batteries_screen.py; browser
  check tools/ux13_browser_check.py (CHECK=1 ux13_screenshots.sh); new and
  changed screenshots only.

No control, allocator, arbiter or command module changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UBtqPrG1mDLXzTEBnhEkkV
2026-09-28 22:39:43 +02:00

47 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
# UX-13 P5: regenerate the DOCS screenshots in docs/img/ux13/ from the real page.
#
# sh goodwe_controller/tools/ux13_screenshots.sh [OUT_DIR]
# CHECK=1 sh goodwe_controller/tools/ux13_screenshots.sh # P3 browser check
#
# Serves tools/ux13_demo.py's fixtures (running, shadow, new, setup) in the CI
# test image, then runs tools/ux13_screenshots.py in the Playwright image on a
# private Docker network (the image has the browsers; the matching Python
# package is installed into the container on each run). Nothing talks to Home Assistant or an inverter. The
# prices and the "now" line follow the clock, so the pictures change a little
# from run to run. Needs Docker and PyPI access; pulls the Playwright image once.
set -eu
HERE=$(cd "$(dirname "$0")/.." && pwd)
OUT=${1:-$HERE/../docs/img/ux13}
PW=mcr.microsoft.com/playwright/python:v1.55.0-noble
NET=ux13-shots-$$
STATES="running shadow new setup modes off off_peak refusal maint"
RUN=/t/ux13_screenshots.py
[ "${CHECK:-}" = 1 ] && RUN=/t/ux13_browser_check.py
mkdir -p "$OUT"
OUT=$(cd "$OUT" && pwd)
cleanup() {
for s in $STATES; do docker rm -f "$NET-$s" >/dev/null 2>&1 || true; done
docker network rm "$NET" >/dev/null 2>&1 || true
}
trap cleanup EXIT INT TERM
docker build -q -t goodwe-addon-checks:1 "$HERE/../.gitea/ci" >/dev/null
docker network create "$NET" >/dev/null
ENVS=""
for s in $STATES; do
docker run -d --name "$NET-$s" --network "$NET" -e PYTHONDONTWRITEBYTECODE=1 \
-v "$HERE:/w:ro" goodwe-addon-checks:1 \
python3 /w/tools/ux13_demo.py "$s" 8099 0.0.0.0 >/dev/null
ENVS="$ENVS -e DEMO_$(echo "$s" | tr a-z A-Z)=http://$NET-$s:8099/"
done
sleep 3
# shellcheck disable=SC2086
docker run --rm --network "$NET" --user "$(id -u):$(id -g)" -e HOME=/tmp \
$ENVS -v "$HERE/tools:/t:ro" -v "$OUT:/out" "$PW" \
sh -euc 'pip install -q --disable-pip-version-check --target /tmp/pw \
playwright==1.55.0
PYTHONPATH=/tmp/pw python3 '"$RUN"' /out'
echo "screenshots in $OUT"