Commit Graph
32 Commits
Author SHA1 Message Date
magnusandClaude Opus 4.7 1958ac9c5a Fetch prices from elprisenligenu.dk
Swap the Energi Data Service datasets (DayAheadPrices + Elspotprices)
for elprisenligenu.dk's public hourly JSON API. The new source covers
both historical and post-2025 dates — previously, Elspotprices was
empty for all 2026 dates and DayAheadPrices was scoped to tomorrow
only, leaving days like 2026-04-07 uncovered.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 13:31:47 +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 139c028607 Format codebase with cljstyle
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 18:59:18 +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
magnus c54ecd2cfa Add .token 2026-02-14 15:06:55 +01:00
magnusandClaude Opus 4.6 feef551fc6 Add green gradient background for the 8 cheapest hours
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:45:43 +01:00
magnusandClaude Opus 4.6 9844803882 Add red gradient background for the 8 most expensive hours
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:40:20 +01:00
magnusandClaude Opus 4.6 83d9f22bbd Add hourly price rank (#1 = cheapest) based on total price
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:35:39 +01:00
magnusandClaude Opus 4.6 2000154c8a Display prices as total(spot) including N1 network tariff
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:26:07 +01:00
magnusandClaude Opus 4.6 d4fd3a7512 Add N1 network tariff data with season/hour-based lookup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:22:48 +01:00
magnusandClaude Opus 4.6 4d8d692dfc Hide Tomorrow tab when no data is available
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:15:32 +01:00
magnusandClaude Opus 4.6 99780ebf60 Show date on Today/Tomorrow tabs and remove table headings
Tabs now display the date (e.g. "Today 2026-02-14"). Removed redundant
"Today — DK1" / "Tomorrow — DK1" headings from the price tables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:10:25 +01:00
magnusandClaude Opus 4.6 4ef693168c Fetch prices on page load and refresh on headline click
Remove the Refresh Prices button. Prices are fetched automatically on
page load, and clicking the headline triggers a re-fetch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:04:49 +01:00
magnusandClaude Opus 4.6 6b95a95ca6 Highlight active tab when switching between Today/Tomorrow
Swap the full tab panel on click so the active tab styling updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:01:34 +01:00
magnusandClaude Opus 4.6 bca9da4639 Add tailwind target and auto-start system in make run
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:56:55 +01:00
magnusandClaude Opus 4.6 9e78275c83 Add Today/Tomorrow tabs for price display
HTMX-powered tabs switch between today's and tomorrow's prices without
full page reload. Today tab is active by default.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:42:52 +01:00
magnusandClaude Opus 4.6 4fc2f82fbb Split API fetch into separate requests per price area
One request per area (DK1, DK2) avoids hitting the 200-record limit
that was truncating tomorrow's data when both areas were fetched together.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:38:33 +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 9554e511ad Collapse quarter-hour details by default
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:57:24 +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 c5ccada192 Fix URL encoding of JSON filter parameter in API request
URI/create rejects raw braces/brackets in query strings. URL-encode the
filter JSON so the request succeeds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:32:44 +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 07b442a579 Add CLAUDE.md with project architecture and development commands
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 12:03:38 +01:00
magnusandClaude Opus 4.6 c3b2efd68c Remove unused kit-mysql require from core.clj
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 11:50:12 +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