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>
This commit is contained in:
@@ -47,3 +47,15 @@ INSERT INTO charges (metering_point_id, charge_type, name, description, owner,
|
||||
VALUES (:metering-point-id, :charge-type, :name, :description, :owner,
|
||||
:valid-from-date, :valid-to-date, :period-type, :price, :quantity, :position)
|
||||
ON CONFLICT (metering_point_id, charge_type, name, owner, valid_from_date, position) DO NOTHING;
|
||||
|
||||
-- :name insert-production! :! :n
|
||||
-- :doc Insert a production record, skip if already exists
|
||||
INSERT INTO production (time_start, hour, kwh)
|
||||
VALUES (:time-start, :hour, :kwh)
|
||||
ON CONFLICT (time_start, hour) DO NOTHING;
|
||||
|
||||
-- :name insert-consumption! :! :n
|
||||
-- :doc Insert a consumption record, skip if already exists
|
||||
INSERT INTO consumption (time_start, hour, kwh)
|
||||
VALUES (:time-start, :hour, :kwh)
|
||||
ON CONFLICT (time_start, hour) DO NOTHING;
|
||||
|
||||
Reference in New Issue
Block a user