Skip to content

Add history subcommand to explore recent SolMate logs#32

Merged
haraldschilly merged 4 commits into
mainfrom
claude/solmate-historical-curves-560ka
Apr 21, 2026
Merged

Add history subcommand to explore recent SolMate logs#32
haraldschilly merged 4 commits into
mainfrom
claude/solmate-historical-curves-560ka

Conversation

@haraldschilly
Copy link
Copy Markdown
Owner

Summary

  • New read-only history subcommand (also registered as standalone history entry point) that calls SolMateAPIClient.get_recent_logs(days=N) and prints a compact summary of the response shape (top-level keys, list lengths, sample item types).
  • --raw dumps the full JSON to stdout; --dump FILE writes it to disk for offline inspection.
  • No changes to logic.py or the optimizer flow — this is an exploration tool. Once we know the response schema, we can add daily averages and trend analysis in a follow-up.

Why

The SolMate SDK exposes get_recent_logs, but the response schema is undocumented. Before building trend/average logic on top, we need to see what the cloud actually returns for PV power, injection, and battery state over time. This command lets us look without committing to a shape.

Test plan

  • uv run solmate history --help shows the subcommand
  • uv run history --help shows the standalone entry point
  • Existing pytest suite still passes (60 tests, logic.py coverage 100 %)
  • Run history --days 3 --dump logs.json against a real SolMate and inspect the output

https://claude.ai/code/session_01XkPiC4MQxgGaybR8ivBXd3

claude and others added 4 commits April 20, 2026 22:02
Exposes solmate_sdk's get_recent_logs via a new read-only command that
fetches PV / injection / battery time-series data from the cloud and
prints a structure summary. --raw dumps JSON to stdout, --dump writes
it to a file for offline analysis.

Intended as a first exploration step toward computing daily averages
and trend lines over the last N days — the response schema is not
documented, so the summary keeps us honest before building
aggregation logic.

https://claude.ai/code/session_01XkPiC4MQxgGaybR8ivBXd3
Adds --plot to the history subcommand: renders PV (orange),
injection (blue) and battery state (green, scaled to % on the same
watts axis) as a single plotext chart. A flexible extractor walks the
undocumented response, matches timestamp / pv / inject / battery keys
against a candidate list, and falls back to a clear error that points
at --raw for inspection.

Also adds --from-file so a previously dumped JSON can be re-plotted
offline without hitting the cloud.

https://claude.ai/code/session_01XkPiC4MQxgGaybR8ivBXd3
- history: plot by default (no --plot flag), default window 7 days,
  fills terminal width and 2/3 of height (min 30 lines).
- Dual y-axis: watts (0/200/400/600/800) left, battery % (0..100) right.
- Parser rewritten for the real columnar response schema
  (logs[*].{timestamp, pv_power, inject_power, battery_state, ...}).
- --raw dumps numeric arrays, --no-plot prints structure, --from-file
  replays a previously dumped JSON.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@haraldschilly haraldschilly marked this pull request as ready for review April 21, 2026 12:35
@haraldschilly haraldschilly merged commit 99d0290 into main Apr 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants