M8-T06: add meter source management API

This commit is contained in:
2026-08-23 21:22:05 +02:00
parent 1ea2f659e0
commit 5855fff451
10 changed files with 3857 additions and 8 deletions
+17
View File
@@ -49,10 +49,21 @@ class MeterResponse(BaseModel):
reason: str
note: str | None
created_at: datetime
bindings: list["MeterBindingSummary"] = Field(default_factory=list)
model_config = {"from_attributes": True}
class MeterBindingSummary(BaseModel):
"""Stable, non-sensitive binding identity embedded in meter responses."""
uuid: str
source_channel_uuid: str
source_uuid: str
started_at: datetime
ended_at: datetime | None
class MeterListResponse(BaseModel):
"""Response schema for GET /api/energy/meters.
@@ -107,6 +118,12 @@ class MeterDeclareRequest(BaseModel):
max_length=32,
description="Energy commodity this meter measures. Defaults to 'electricity'.",
)
source_channel_uuid: str | None = Field(
default=None,
min_length=1,
max_length=36,
description="Optional compatible source channel to bind atomically to this meter.",
)
class MeterPatchRequest(BaseModel):