ocpp/v2_1/datatype/tariff
OCPP 2.1 Tariff data type (schema TariffType).
to_json/decoder map to/from its OCPP-J JSON object; new (when
present) builds a value from the required fields only.
Types
A tariff is described by fields with prices for: energy, charging time, idle time, fixed fee, reservation time, reservation fixed fee. + Each of these fields may have (optional) conditions that specify when a price is applicable. + The description contains a human-readable explanation of the tariff to be shown to the user. + The other fields are parameters that define the tariff. These are used by the charging station to calculate the price.
| Field | Type | Req | Description |
|---|---|---|---|
charging_time | TariffTime | — | |
currency | String | ✓ | Currency code according to ISO 4217 (max 3 chars) |
custom_data | CustomData | — | |
description | List(MessageContent) | — | |
energy | TariffEnergy | — | |
fixed_fee | TariffFixed | — | |
idle_time | TariffTime | — | |
max_cost | Price | — | |
min_cost | Price | — | |
reservation_fixed | TariffFixed | — | |
reservation_time | TariffTime | — | |
tariff_id | String | ✓ | Unique id of tariff (max 60 chars) |
valid_from | DateTime | — | Time when this tariff becomes active. When absent, it is immediately active. |
Schema: TariffType
pub type Tariff {
Tariff(
charging_time: option.Option(tariff_time.TariffTime),
currency: String,
custom_data: option.Option(custom_data.CustomData),
description: option.Option(
List(message_content.MessageContent),
),
energy: option.Option(tariff_energy.TariffEnergy),
fixed_fee: option.Option(tariff_fixed.TariffFixed),
idle_time: option.Option(tariff_time.TariffTime),
max_cost: option.Option(price.Price),
min_cost: option.Option(price.Price),
reservation_fixed: option.Option(tariff_fixed.TariffFixed),
reservation_time: option.Option(tariff_time.TariffTime),
tariff_id: String,
valid_from: option.Option(timestamp.Timestamp),
)
}
Constructors
-
Tariff( charging_time: option.Option(tariff_time.TariffTime), currency: String, custom_data: option.Option(custom_data.CustomData), description: option.Option(List(message_content.MessageContent)), energy: option.Option(tariff_energy.TariffEnergy), fixed_fee: option.Option(tariff_fixed.TariffFixed), idle_time: option.Option(tariff_time.TariffTime), max_cost: option.Option(price.Price), min_cost: option.Option(price.Price), reservation_fixed: option.Option(tariff_fixed.TariffFixed), reservation_time: option.Option(tariff_time.TariffTime), tariff_id: String, valid_from: option.Option(timestamp.Timestamp), )
Values
pub fn decoder() -> decode.Decoder(Tariff)
Decode a Tariff from its OCPP-J JSON object, enforcing schema constraints.
pub fn new(
currency currency: String,
tariff_id tariff_id: String,
) -> Tariff
Construct a Tariff from its required fields, with every optional field set to None.