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.

FieldTypeReqDescription
charging_timeTariffTime
currencyStringCurrency code according to ISO 4217 (max 3 chars)
custom_dataCustomData
descriptionList(MessageContent)
energyTariffEnergy
fixed_feeTariffFixed
idle_timeTariffTime
max_costPrice
min_costPrice
reservation_fixedTariffFixed
reservation_timeTariffTime
tariff_idStringUnique id of tariff (max 60 chars)
valid_fromDateTimeTime 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

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.

pub fn to_json(value: Tariff) -> json.Json

Encode a Tariff to its OCPP-J JSON object.

Search Document