Dynamic Data

VERSION 0.2.3323

The Dynamic Data module provides real-time information about charging park availability and fuel prices. With dynamic data, users can check whether the right connectors are available for charging their electric vehicles, find the lowest fuel price before stopping to fill up, or know in advance where there are parking places available (and at what price).

EV Charging Park Availability

The EV charging park availability search checks the availability of Electric Vehicle (EV) charging points at a specific charging park. To make the request, create an EVChargingAvailabilityOptions. The only required parameter is the charging availability identifier. You can get this identifier by doing a Fuzzy Search. The identifier is in the DataSources of the SearchResult, labeled ChargingAvailabilityDataSource.

Not every SearchResult contains charging station information.

let searchResult = fuzzySearchResponse.results.first
let chargingStationId = searchResult?.id.evConnectorAvailabilityDataSourceId ?? ""

You can add optional restrictions to the request: connector type, minimum power (expressed in kilowatts) and maximum power (expressed in kilowatts).

1let options = EVChargingAvailabilityOptions(
2 availabilityID: chargingStationId,
3 connectors: [.iec62196Type1, .iec62196Type1CCS],
4 minPower: Measurement<UnitPower>(value: 1, unit: .kilowatts),
5 maxPower: Measurement<UnitPower>(value: 5, unit: .kilowatts)

A successful request returns EVChargingAvailabilityResponse. If the request fails, an Error is provided.

1let evChargingAvailabilityProvider = OnlineDynamicDataProviderFactory
2 .createEVChargingAvailabilityProvider(apiKey: "REPLACE_WITH_YOUR_API_KEY")
3evChargingAvailabilityProvider.requestEVChargingAvailability(options: options) { result in
4 switch result {
5 case let .success(response):
6 // handle success
7 break
8 case let .failure(error):
9 // handle error
10 break
11 }