ista Integration
Status: TODO
Diese Integration erfordert Web Scraping und ist noch nicht implementiert.
Übersicht
ista bietet keine öffentliche API. Die Integration erfolgt über Web Scraping des Kundenportals.
Technologie
- Puppeteer oder Playwright für Browser Automation
- Session-basierte Authentifizierung
- HTML Parsing für Datenextraktion
Geplante Endpoints
| Endpoint | Beschreibung | Cache TTL |
|---|---|---|
/portal/login |
Login | - |
/portal/properties |
Immobilien Liste | 1h |
/portal/properties/{id}/consumption |
Verbrauchsdaten | 1h |
/portal/properties/{id}/readings |
Zählerstände | 1h |
/portal/properties/{id}/costs |
Kostendaten | 1h |
/portal/properties/{id}/units |
Wohneinheiten | 1h |
/portal/download/report/{id} |
Report PDF | 24h |
Datentypen
interface IstaProperty {
id: string;
address: string;
name: string;
unitCount: number;
lastReading?: string;
}
interface IstaConsumption {
meterId: string;
meterType: "HEATING" | "WATER_HOT" | "WATER_COLD" | "ELECTRICITY";
readings: Array<{
date: string;
value: number;
unit: string;
}>;
consumption: {
period: string;
value: number;
unit: string;
comparison?: number; // vs Vorjahr %
};
}
interface IstaCost {
period: string;
heating: number;
hotWater: number;
coldWater: number;
total: number;
currency: "EUR";
}
D1 Cache Tables
ista_properties
CREATE TABLE ista_properties (
id TEXT PRIMARY KEY,
ista_id TEXT NOT NULL UNIQUE,
name TEXT,
address TEXT NOT NULL,
unit_count INTEGER,
last_reading TEXT,
property_id TEXT, -- Link zu PostgreSQL
synced_at INTEGER NOT NULL
);
ista_consumption
CREATE TABLE ista_consumption (
id TEXT PRIMARY KEY,
ista_property_id TEXT NOT NULL,
meter_id TEXT NOT NULL,
meter_type TEXT NOT NULL,
period_start TEXT NOT NULL,
period_end TEXT NOT NULL,
value REAL NOT NULL,
unit TEXT NOT NULL,
cost REAL,
synced_at INTEGER NOT NULL
);
Implementation Steps
- [ ] Puppeteer/Playwright Setup
- [ ] Login Flow implementieren
- [ ] Session Management
- [ ] Data Extraction
- [ ] Sync Service
- [ ] Cloudflare Worker (headless-chrome?)