Skip to content

Claude/grid cost credit calc e9z al - #1

Merged
xntrik merged 2 commits into
mainfrom
claude/grid-cost-credit-calc-e9zAL
Mar 29, 2026
Merged

xntrik merged 2 commits into
mainfrom
claude/grid-cost-credit-calc-e9zAL

Conversation

@xntrik

@xntrik xntrik commented Mar 29, 2026

Copy link
Copy Markdown
Owner

No description provided.

claude and others added 2 commits March 29, 2026 06:16
Implements a tariff system that calculates grid import costs and export
credits based on configurable time-of-use windows. Uses a hybrid approach:
cumulative kWh counter deltas when available (most accurate), falling back
to trapezoidal integration of instantaneous power for cross-day boundaries.

- tariff/tariff.go: Config model with timezone, day-of-week, and time
  window matching for both import and export tariffs
- tariff/calculator.go: Energy bucketing engine that queries readings,
  computes per-window kWh, and multiplies by configured rates
- growatt/store.go: QueryRangeReadings for multi-day cost queries
- main.go: `growud cost` CLI subcommand with --date/--from/--to flags
- server/server.go: /api/cost JSON endpoint for web dashboard
- paths.go: TariffPath added to AppPaths for tariff.json resolution
- tariff.example.json: Example config with peak/shoulder/off-peak rates

https://claude.ai/code/session_01HEKBz4fG3L7uJCZS2r4Jvq
@xntrik
xntrik merged commit 9e224e7 into main Mar 29, 2026
1 check passed
@xntrik
xntrik deleted the claude/grid-cost-credit-calc-e9zAL branch March 29, 2026 08:01
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