16 Commits
Author SHA1 Message Date
magnus 22aa590de2 new database 2026-09-08 19:42:00 +02:00
magnus fc071af990 Fix local price fetching 2026-09-08 15:55:35 +02:00
magnus e088d67308 Use eur if not present 2026-05-16 11:33:16 +02:00
magnusandClaude Opus 4.7 da20691d2b Add tariff_dkk + total_dkk to elprice
Each hourly row now carries the N1 time-of-use tariff (øre/kWh × 10
to match the DKK/MWh unit of price_dkk) and the combined consumer
price (spot + tariff). Existing rows are backfilled in the migration
with a CASE expression mirroring tariffs/tariff-for-hour; new writes
compute it in the controller. API response exposes both fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 12:48:46 +02:00
magnusandClaude Opus 4.7 06b575d709 Add elprice table + JSON API (GET /api/elprice?date=...)
New `elprice` table with a simpler shape (time_dk, price_area,
price_dkk) backing a JSON endpoint that returns hourly DK1 + DK2
prices for any date. Cache-miss path fetches from the same
DayAheadPrices dataset as day_ahead_prices, upserts, and returns.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 12:36:01 +02:00
magnusandClaude Opus 4.7 ce1c3822a2 Add solar table migration
Records hourly solar panel readings imported from /home/pmp/ai/solar/csv
by the sibling repo's import-csv.mjs. Schema includes only the 8
columns that always carry data; the 5 always-empty CSV columns are
dropped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 10:40:21 +02:00
magnusandClaude Opus 4.6 3a319f5cf4 Fix sync: add missing tables, Linux date, token from env
Add production and consumption table migrations. Fix sync-month.sh
to use Linux date syntax and default to port 3030. Read Eloverblik
token from ELOVERBLIK_TOKEN env var with .token file fallback.
Mount .token into Docker container.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 13:06:14 +01:00
magnusandClaude Opus 4.6 14b583ccb9 Add multi-stage Dockerfile, docker-compose, and fix insert conflict
Rebuild Dockerfile with 3 stages (CSS, uberjar, runtime) on port 3030.
Add docker-compose.yml loading .env. Fix insert-price! ON CONFLICT to
target (time_dk, price_area) matching the actual unique index.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:44:50 +01:00
magnusandClaude Opus 4.6 4984c1b207 Replace local Docker PostgreSQL with external DB via .env
Remove docker-compose.yml and use JDBC_URL from .env for all
profiles. Makefile now exports .env variables automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:25:04 +01:00
magnusandClaude Opus 4.6 d0ff9b485d Skip sync for existing data and too-recent dates
- Check consumption table before fetching; return early if data exists
- Return "no data to fetch" for dates >= yesterday (not yet available)
- Add sync-month.sh script to sync all days in a month
- Add kill-server.sh script to free port 3000

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 18:50:41 +01:00
magnusandClaude Opus 4.6 d756c98810 Add date-parameterized sync with production and consumption tables
- Accept ?date= param on POST /eloverblik/sync (defaults to today)
- Populate production table from D06 meter (571313113163368491)
- Populate consumption table from D07 meter (571313113163368507)
- ON CONFLICT DO NOTHING to skip existing data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 18:09:36 +01:00
magnusandClaude Opus 4.6 ca473c62bb Add Eloverblik data pipeline: fetch metering points, readings, and charges to PostgreSQL
- Add eloverblik controller with API client for metering points, time series, and charges
- Add migrations for metering_points, meter_readings, and charges tables
- Add HugSQL queries (upsert-metering-point!, insert-meter-reading!, insert-charge!)
- Add POST /eloverblik/sync route to trigger sync from browser

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 16:25:59 +01:00
magnusandClaude Opus 4.6 97a95684cf Skip existing prices on insert and add unique index on (time_dk, price_area)
Changed upsert to INSERT ON CONFLICT DO NOTHING so existing prices are
never overwritten. Added unique index on (time_dk, price_area) to enforce
no duplicate quarter-hour entries per area.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:14:28 +01:00
magnusandClaude Opus 4.6 7e7b28cf85 Group prices by hour with expandable quarter details and blue borders
Each hour shows as an open-by-default card with the average price and
indented quarter-hour rows. Added @source directive to Tailwind v4 input
so .clj files are scanned for utility classes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:51:07 +01:00
magnusandClaude Opus 4.6 1b600ad8d4 Fetch and display day-ahead electricity spot prices from Energi Data Service
Adds a prices controller that fetches DK1/DK2 hourly spot prices via the
Energi Data Service API, stores them in PostgreSQL, and displays today's
and tomorrow's DK1 prices on the home page in øre/kWh. An HTMX "Refresh
Prices" button triggers the fetch-and-display cycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:23:40 +01:00
magnusandClaude Opus 4.6 c1f386ef44 Initial Kit project with PostgreSQL, HTMX, Hiccup, and Tailwind
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 11:45:09 +01:00