simple-ocpp-cs/app/schemas/meter_value.py

58 lines
1.9 KiB
Python
Raw Permalink Normal View History

2024-03-28 21:23:25 +01:00
from datetime import datetime
2024-04-19 00:08:29 +02:00
from decimal import Decimal
2024-03-28 21:23:25 +01:00
import enum
2024-04-19 00:08:29 +02:00
from typing import Optional
2024-04-13 22:43:03 +02:00
from uuid import UUID
2024-03-28 21:23:25 +01:00
from pydantic import BaseModel
class PhaseType(enum.Enum):
L1 = "L1"
L2 = "L2"
L3 = "L3"
N = "N"
L1_N = "L1-N"
L2_N = "L2-N"
L3_N = "L3-N"
L1_L2 = "L1-L2"
L2_L3 = "L2-L3"
L3_L1 = "L3-L1"
class Measurand(enum.Enum):
CURRENT_EXPORT = "Current.Export"
CURRENT_IMPORT = "Current.Import"
CURRENT_OFFERED = "Current.Offered"
ENERGY_ACTIVE_NET = "Energy.Active.Net"
ENERGY_ACTIVE_EXPORT_REGISTER = "Energy.Active.Export.Register"
ENERGY_ACTIVE_IMPORT_REGISTER = "Energy.Active.Import.Register"
ENERGY_ACTIVE_EXPORT_INTERVAL = "Energy.Active.Export.Interval"
ENERGY_ACTIVE_IMPORT_INTERVAL = "Energy.Active.Import.Interval"
ENERGY_REACTIVE_NET = "Energy.Reactive.Net"
ENERGY_REACTIVE_EXPORT_REGISTER = "Energy.Reactive.Export.Register"
ENERGY_REACTIVE_IMPORT_REGISTER = "Energy.Reactive.Import.Register"
ENERGY_REACTIVE_EXPORT_INTERVAL = "Energy.Reactive.Export.Interval"
ENERGY_REACTIVE_IMPORT_INTERVAL = "Energy.Reactive.Import.Interval"
ENERGY_APPARENT_NET = "Energy.Apparent.Net"
ENERGY_APPARENT_IMPORT = "Energy.Apparent.Import"
ENERGY_APPARENT_EXPORT = "Energy.Apparent.Export"
FREQUENCY = "Frequency"
POWER_ACTIVE_EXPORT = "Power.Active.Export"
POWER_ACTIVE_IMPORT = "Power.Active.Import"
POWER_FACTOR = "Power.Factor"
POWER_OFFERED = "Power.Offered"
POWER_REACTIVE_EXPORT = "Power.Reactive.Export"
POWER_REACTIVE_IMPORT = "Power.Reactive.Import"
SOC = "SoC"
VOLTAGE = "Voltage"
class MeterValue(BaseModel):
2024-04-13 22:43:03 +02:00
id: UUID
2024-03-28 21:23:25 +01:00
timestamp: datetime
measurand: Measurand
2024-04-19 00:08:29 +02:00
phase_type: Optional[PhaseType] = None
unit: Optional[str] = None
value: Decimal
2024-03-28 21:23:25 +01:00
transaction_id: str
class Config:
from_attributes = True