ocpp/v2_1/message/transaction_event
OCPP 2.1 TransactionEvent action.
Request/Response payload types with their OCPP-J codecs
(request_to_json/request_decoder, response_to_json/
response_decoder). Transport-agnostic; the action-string mapping
lives in ocpp/v2_1/dispatch.
Types
| Field | Type | Req | Description |
|---|---|---|---|
cable_max_current | Int | — | The maximum current of the connected cable in Ampere (A). |
cost_details | CostDetails | — | |
custom_data | CustomData | — | |
event_type | TransactionEvent | ✓ | |
evse | Evse | — | |
evse_sleep | Bool | — | (2.1) True when EVSE electronics are in sleep mode for this transaction. Default value (when absent) is false. |
id_token | IdToken | — | |
meter_value | List(MeterValue) | — | |
number_of_phases_used | Int | — | If the Charging Station is able to report the number of phases used, then it SHALL provide it. When omitted the CSMS may be able to determine the number of phases used as follows: + 1: The numberPhases in the currently used ChargingSchedule. + 2: The number of phases provided via device management. (0–3) |
offline | Bool | — | Indication that this transaction event happened when the Charging Station was offline. Default = false, meaning: the event occurred when the Charging Station was online. |
preconditioning_status | PreconditioningStatus | — | |
reservation_id | Int | — | This contains the Id of the reservation that terminates as a result of this transaction. (≥ 0) |
seq_no | Int | ✓ | Incremental sequence number, helps with determining if all messages of a transaction have been received. (≥ 0) |
timestamp | DateTime | ✓ | The date and time at which this transaction event occurred. |
transaction_info | Transaction | ✓ | |
trigger_reason | TriggerReason | ✓ |
Schema: TransactionEventRequest
pub type Request {
Request(
cable_max_current: option.Option(Int),
cost_details: option.Option(cost_details.CostDetails),
custom_data: option.Option(custom_data.CustomData),
event_type: transaction_event.TransactionEvent,
evse: option.Option(evse.Evse),
evse_sleep: option.Option(Bool),
id_token: option.Option(id_token.IdToken),
meter_value: option.Option(List(meter_value.MeterValue)),
number_of_phases_used: option.Option(Int),
offline: option.Option(Bool),
preconditioning_status: option.Option(
preconditioning_status.PreconditioningStatus,
),
reservation_id: option.Option(Int),
seq_no: Int,
timestamp: timestamp.Timestamp,
transaction_info: transaction.Transaction,
trigger_reason: trigger_reason.TriggerReason,
)
}
Constructors
-
Request( cable_max_current: option.Option(Int), cost_details: option.Option(cost_details.CostDetails), custom_data: option.Option(custom_data.CustomData), event_type: transaction_event.TransactionEvent, evse: option.Option(evse.Evse), evse_sleep: option.Option(Bool), id_token: option.Option(id_token.IdToken), meter_value: option.Option(List(meter_value.MeterValue)), number_of_phases_used: option.Option(Int), offline: option.Option(Bool), preconditioning_status: option.Option( preconditioning_status.PreconditioningStatus, ), reservation_id: option.Option(Int), seq_no: Int, timestamp: timestamp.Timestamp, transaction_info: transaction.Transaction, trigger_reason: trigger_reason.TriggerReason, )
| Field | Type | Req | Description |
|---|---|---|---|
charging_priority | Int | — | Priority from a business point of view. Default priority is 0, The range is from -9 to 9. Higher values indicate a higher priority. The chargingPriority in TransactionEventResponse is temporarily, so it may not be set in the IdTokenInfoType afterwards. Also the chargingPriority in TransactionEventResponse has a higher priority than the one in IdTokenInfoType. |
custom_data | CustomData | — | |
id_token_info | IdTokenInfo | — | |
total_cost | Float | — | When eventType of TransactionEventRequest is Updated, then this value contains the running cost. When eventType of TransactionEventRequest is Ended, then this contains the final total cost of this transaction, including taxes, in the currency configured with the Configuration Variable: Currency. Absence of this value does not imply that the transaction was free. To indicate a free transaction, the CSMS SHALL send a value of 0.00. |
transaction_limit | TransactionLimit | — | |
updated_personal_message | MessageContent | — | |
updated_personal_message_extra | List(MessageContent) | — |
Schema: TransactionEventResponse
pub type Response {
Response(
charging_priority: option.Option(Int),
custom_data: option.Option(custom_data.CustomData),
id_token_info: option.Option(id_token_info.IdTokenInfo),
total_cost: option.Option(Float),
transaction_limit: option.Option(
transaction_limit.TransactionLimit,
),
updated_personal_message: option.Option(
message_content.MessageContent,
),
updated_personal_message_extra: option.Option(
List(message_content.MessageContent),
),
)
}
Constructors
-
Response( charging_priority: option.Option(Int), custom_data: option.Option(custom_data.CustomData), id_token_info: option.Option(id_token_info.IdTokenInfo), total_cost: option.Option(Float), transaction_limit: option.Option( transaction_limit.TransactionLimit, ), updated_personal_message: option.Option( message_content.MessageContent, ), updated_personal_message_extra: option.Option( List(message_content.MessageContent), ), )
Values
pub fn new_request(
event_type event_type: transaction_event.TransactionEvent,
seq_no seq_no: Int,
timestamp timestamp: timestamp.Timestamp,
transaction_info transaction_info: transaction.Transaction,
trigger_reason trigger_reason: trigger_reason.TriggerReason,
) -> Request
Construct a Request from its required fields, with every optional field set to None.
pub fn new_response() -> Response
Construct a Response from its required fields, with every optional field set to None.
pub fn request_decoder() -> decode.Decoder(Request)
Decode a Request from its OCPP-J JSON object, enforcing schema constraints.
pub fn response_decoder() -> decode.Decoder(Response)
Decode a Response from its OCPP-J JSON object, enforcing schema constraints.