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

61 lines
1.5 KiB
Python
Raw Normal View History

2024-04-20 02:36:46 +02:00
from decimal import Decimal
from typing import Optional
from uuid import UUID
from pydantic import BaseModel
import enum
class AttributeType(enum.Enum):
ACTUAL = "Actual"
TARGET = "Target"
MIN_SET = "MinSet"
MAX_SET = "MaxSet"
class MutabilityType(enum.Enum):
READ_ONLY = "ReadOnly"
WRITE_ONLY = "WriteOnly"
READ_WRITE = "ReadWrite"
class DataType(enum.Enum):
STRING = "string"
DECIMAL = "decimal"
INTEGER = "integer"
DATETIME = "dateTime"
BOOLEAN = "boolean"
OPTION_LIST = "OptionList"
SEQUENCE_LIST = "SequenceList"
MEMBER_LIST = "MemberList"
class SetVariableStatusType(enum.Enum):
ACCEPTED = "Accepted"
REJECTED = "Rejected"
UNKNOWN_COMPONENT = "UnknownComponent"
NOT_SUPPORTED_ATTRIBUTE_TYPE = "NotSupportedAttributeType"
REBOOT_REQUIRED = "RebootRequired"
class ChargepointVariable(BaseModel):
id: UUID
name: str
type: AttributeType
value: Optional[str] = None
mutability: MutabilityType
persistent: bool
constant: bool
unit: Optional[str] = None
data_type: Optional[DataType] = None
min_limit: Optional[Decimal] = None
max_limit: Optional[Decimal] = None
values_list: Optional[str] = None
component_name: str
component_instance: Optional[str] = None
evse: Optional[int] = None
connector_id: Optional[int] = None
class Config:
from_attributes = True
class ChargepointVariableUpdate(BaseModel):
value: str
class ChargepointVariableResponse(BaseModel):
status: SetVariableStatusType