FastAPI app that pulls interval usage from Sungrow iSolarCloud (OAuth2), caches AER Consumer Data Right electricity plan data, and compares actual metered usage against every available plan to estimate real annual cost (TOU, tiered feed-in, and flat tariffs). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
23 lines
598 B
Python
23 lines
598 B
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class IntervalDataPoint(BaseModel):
|
|
ts: datetime
|
|
generation_kwh: float
|
|
load_kwh: float
|
|
import_kwh: float
|
|
export_kwh: float
|
|
resolution_minutes: int
|
|
|
|
def as_row(self, source: str) -> dict:
|
|
return {
|
|
"ts": self.ts,
|
|
"source": source,
|
|
"generation_kwh": self.generation_kwh,
|
|
"load_kwh": self.load_kwh,
|
|
"import_kwh": self.import_kwh,
|
|
"export_kwh": self.export_kwh,
|
|
"resolution_minutes": self.resolution_minutes,
|
|
}
|